Merged
Conversation
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.
Type of change
What does this PR do?
Two bugs found during a proactive audit of
bisonParser.ts, analogous to the Flex audit in #35.audit-E — uppercase-only regex in
%left/%right/%nonassocparsing[A-Z_][A-Z0-9_]*inbisonParser.ts:169silently dropped lowercase/mixed-casetokens (e.g.
kPLUS,kMINUS,tTOKEN) fromdoc.precedence. These tokenswere then falsely reported as
bison/undeclared-token(or missed by theshift/reduce heuristic). Fixed to
[A-Za-z_][A-Za-z0-9_]*.audit-F —
[^}]*inextractDollarRefsmisses$Nafter nested sub-blocks/\{([^}]*)\}/gstops at the first}, so a$Nreference appearing aftera nested
{ ... }block inside the same action (e.g.{ if (cond) { log(); } $$ = $5; }) was not detected, producing a falsenegative for
bison/out-of-bounds. RewroteextractDollarRefswith abrace-depth scanner. Added
removeBalancedBraces()helper and applied it toextractSymbols,getFirstSymbol, andextractRuleReferencesfor consistency.Related issue
No dedicated issue — found during internal audit.
How to test manually
.yfile with%left kPLUS kMINUS(lowercase tokens) — no falsebison/undeclared-tokenshould appear forkPLUS/kMINUS.A { if (1) { int x = 0; } $$ = $5; }—$5should be flagged as out-of-bounds (1symbol + 1 action = 2 positions).Checklist
npm run compilepasses with no new errorstests/test-diagnostic-codes.ts(196 total, 0 failed)