Grammar limitations: no float literals, no dynamic index/render name #26

Open
opened 2026-08-07 13:33:19 +02:00 by Hemera · 0 comments
Owner

Minor grammar gaps (may be intentional, but they make some documented/obvious uses impossible):

  1. No float literals. {{= 1.5 }} is a parse error (parse_number only accepts digit1). Float values exist (NomoValue::Float) and can be emitted when they arrive via a serde_json context, but they cannot be written or combined in template math.
  2. Array index must be a literal. {{= xs[i] }} doesn't parse — the postfix [ handler uses parse_literal (src/parser/mod.rs:1001-1008), so dynamic indexing with a variable is impossible.
  3. render name must be a string literal. parse_render uses parse_literal_string (src/parser/mod.rs:759-773), so the template name cannot be a variable/expression.

If these are intentional, consider documenting them; if not, they are candidates for the parser rework.

Minor grammar gaps (may be intentional, but they make some documented/obvious uses impossible): 1. **No float literals.** `{{= 1.5 }}` is a parse error (`parse_number` only accepts `digit1`). `Float` values exist (`NomoValue::Float`) and can be emitted when they arrive via a `serde_json` context, but they cannot be written or combined in template math. 2. **Array index must be a literal.** `{{= xs[i] }}` doesn't parse — the postfix `[` handler uses `parse_literal` (`src/parser/mod.rs:1001-1008`), so dynamic indexing with a variable is impossible. 3. **`render` name must be a string literal.** `parse_render` uses `parse_literal_string` (`src/parser/mod.rs:759-773`), so the template name cannot be a variable/expression. If these are intentional, consider documenting them; if not, they are candidates for the parser rework.
Sign in to join this conversation.
No labels
automated-🤖
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Hemera/nomo#26
No description provided.