Skip to content

Lex use/include as keywords only before '<'; reset lexer state per parse - #17

Merged
revarbat merged 1 commit into
mainfrom
fix/include-as-identifier
Nov 16, 2026
Merged

revarbat merged 1 commit into
mainfrom
fix/include-as-identifier

Conversation

@revarbat

Copy link
Copy Markdown
Member
  • use/include are keywords only when followed by < (flex trailing context), as in OpenSCAD's lexer.l; otherwise ordinary names, so module m(include = undef) parses.
  • lexerBeginString resets the start condition to INITIAL. A parse that failed inside INCFILE/STR left the next parse there, which read text up to the first <...> (even in a comment) as a file name; that is the comment-line syntax errors in the report.

New UseIncludeAsName tests; 3 of 4 fail without the fix. 674 tests pass.

Refs BelfrySCAD/BelfrySCAD#1138

🤖 Generated with Claude Code

…e per parse

As in OpenSCAD's lexer, `use` and `include` are keywords only when a
`<` follows; elsewhere they are names, so `module m(include = undef)`
parses. The start condition also outlived a failed parse, so the next one
read text up to the first `<...>`, even in a comment, as a file name.

Refs BelfrySCAD/BelfrySCAD#1138

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@revarbat
revarbat merged commit 25608a2 into main Nov 16, 2026
3 checks passed
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.

1 participant