Escape sequences are tokenized but never interpreted; backslashes leak into output #21

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

String parsing uses take_escaped(none_of(['"', '\\']), '\\', one_of(['"', 'n'])) (src/lexer/mod.rs:445), which accepts \" and \n, but the backslash is captured verbatim and nothing unescapes the value afterwards.

Verified output:

  • {{= "a\nb" }} → outputs the 4 literal characters a\nb (backslash + n), not a newline.
  • {{= "say \"hi\"" }} → outputs say \"hi\" (backslashes preserved).

So the escape syntax works (the string doesn't terminate early) but the escapes have no effect on the value. Either interpret \n/\" (and reject unknown escapes), or document that backslashes are kept literally.

String parsing uses `take_escaped(none_of(['"', '\\']), '\\', one_of(['"', 'n']))` (`src/lexer/mod.rs:445`), which accepts `\"` and `\n`, but the backslash is captured verbatim and nothing unescapes the value afterwards. Verified output: - `{{= "a\nb" }}` → outputs the 4 literal characters `a\nb` (backslash + `n`), not a newline. - `{{= "say \"hi\"" }}` → outputs `say \"hi\"` (backslashes preserved). So the escape *syntax* works (the string doesn't terminate early) but the escapes have no effect on the value. Either interpret `\n`/`\"` (and reject unknown escapes), or document that backslashes are kept literally.
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#21
No description provided.