No successful run was found on main (47c22df) during the generation of this report, so 58a9d81 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.
fix(lexer): Handle unrecognized escape sequences correctly
Fixes #11214
This commit fixes a bug in the ECMAScript lexer where Windows file paths
with backslashes were being inconsistently escaped in the AST's value field
for string literals.
The issue occurred when a backslash preceded a character that doesn't form
a valid escape sequence (like `\s` in `spec\util`). According to ECMAScript
specification, when a backslash precedes a character that doesn't form a
valid escape sequence, both the backslash and the character should be
preserved in the string value.
Changes:
- Added explicit handling for `\'` and `\"` as valid escape sequences
- Modified the catch-all case in `read_escaped_char` to return the backslash
character and not consume the following character for unrecognized escapes
- Added comprehensive tests for Windows paths and unrecognized escape sequences
Test cases:
- `issue_11214_windows_path_escape`: Tests Windows file paths with backslashes
- `issue_11214_unrecognized_escape_sequences`: Tests various unrecognized
escape sequences like `\s`, `\g`, `\a`
All existing tests continue to pass, confirming no regressions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
46fdbb3
20 days ago
by github-actions[bot]
0%
Add strict mode and template literal error handling for unrecognized escape sequences
This commit addresses the PR review feedback to properly handle unrecognized
escape sequences according to ECMAScript specification:
- In template literals: unrecognized escape sequences are always syntax errors
- In strict mode: unrecognized escape sequences are syntax errors
- In non-strict mode: unrecognized escape sequences preserve the backslash
The implementation follows the same pattern used for octal escape sequences,
ensuring consistent error handling behavior across the lexer.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>