unexpected_token

Diagnostic `nanook::template::unexpected_token`

Summary

expected {0}, got {1}

Help

check the syntax: {0} is required at this position

Details

When this fires

The parser was looking for one specific thing (a closing brace, a comma, an identifier, a %}, etc.) and got something else. The diagnostic names both sides: expected X, got Y. Caught by nanook check.

What to check

Common cases:

  • Missing , between filter args: truncate(80 "...") should be truncate(80, "...").
  • Stray keyword inside an expression: {{ if x }} should be {% if x %}...{% endif %}.
  • Forgot the closing tag for a block: {% endfor %}, {% endif %}.
broken: {% for x in xs %}{{ x }}
fixed:  {% for x in xs %}{{ x }}{% endfor %}

Full grammar lives in @/docs/nanook-templates.md.