Skip to content

Fix #7: Code readthrough, comments#19

Open
leftibot wants to merge 1 commit intolefticus:mainfrom
leftibot:fix/issue-7-code-readthrough-comments
Open

Fix #7: Code readthrough, comments#19
leftibot wants to merge 1 commit intolefticus:mainfrom
leftibot:fix/issue-7-code-readthrough-comments

Conversation

@leftibot
Copy link
Copy Markdown

Automated fix by @leftibot.

What changed

Fix #7: tokenizer treats \\ before " as escaped terminator
next_token set in_escape = true on every backslash instead of
toggling it. After an even run of backslashes the flag stayed true, so
the following " was consumed as an escaped quote and the tokenizer
ran past the end of the literal. Toggling in_escape makes each
backslash cancel its predecessor, matching what process_string_escapes
already does in the second pass.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Files

 include/cons_expr/cons_expr.hpp |  2 +-
 test/string_escape_tests.cpp    | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

Closes #7

Triggered by @lefticus.

`next_token` set `in_escape = true` on every backslash instead of
toggling it. After an even run of backslashes the flag stayed true, so
the following `"` was consumed as an escaped quote and the tokenizer
ran past the end of the literal. Toggling `in_escape` makes each
backslash cancel its predecessor, matching what `process_string_escapes`
already does in the second pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code readthrough, comments

1 participant