Commit 33be075
Fix block comment not recognized inside switch expressions
The NEWLINE handler's peek-ahead used skip_whitespace_and_comments,
which consumed block comments as skipped characters. When it decided
not to emit NEWLINE (e.g. because } follows the comment), the scanner
returned false and all advances rolled back. The internal tokenizer
then tokenized the leading / of /* as a standalone slash, leaving the
block comment unrecognized.
Fix: replace skip_whitespace_and_comments with skip_whitespace_and_line_comments
in the NEWLINE peek path. Block comments (/* */) are external tokens
and must not be consumed during peek — only line comments (//) are skipped.
When the peek now stops at /*, no continuation pattern matches, so NEWLINE
is emitted and the next scanner call correctly handles /* as BLOCK_COMMENT.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 14222e3 commit 33be075
5 files changed
Lines changed: 136143 additions & 136705 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments