Repository navigation
lexer: a / first on its line opens a regex literal, never a division (#2233) - #2236
Merged
Merged
Conversation
added 2 commits
October 6, 2026 19:43
#2233) The lexer decided regex-vs-division from the previous significant token and skipped NEWLINE, so a statement or tail beginning with a regex literal after a line that ended in `)` or an identifier was read as a division with a missing left operand ("expected expression"). A newline ends a statement outside every bracket, so a `/` that is the first token on its line at bracket depth 0 starts a regex; `line_start` and `bracket_depth` are the two facts the token loop keeps. Divisions keep every spelling they had. The behavior fixture fails on the previous compiler with "expected expression".
Contributor
Author
|
Battery GREEN on stack top dd1c22f (seed-driven): gate rc=0 555s, uat rc=0 26s, battery-checks rc=0 823s. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The lexer decided regex-vs-division from the previous significant token and skipped NEWLINE, so a statement or tail beginning with a regex literal after a line ending in
)was read as a division with a missing left operand. A newline ends a statement outside every bracket, so a/first on its line at bracket depth 0 starts a regex. Divisions keep every spelling they had; the fixture fails on the previous compiler with "expected expression". The migrate_diff tool drops its workaround.Fixes #2233. Draft until the stack's battery is green.