Repository navigation
fix!: parse grouped declarations without final semicolons - #63
Merged
Merged
Conversation
Allow the last constant or variable specification before a closing parenthesis to omit its terminator, using the existing separated-list rule. Keep regression coverage for explicit and implicit constant values and variable declarations, and regenerate the profiled parser. Co-authored-by: WillBooster (Codex) <agent@willbooster.com>
The pinned bug123 fixture has a grouped constant without a final semicolon and now parses. Go's syntax parser accepts the complete file; its expected compiler diagnostic concerns calling the integer constant. Co-authored-by: WillBooster (Codex) <agent@willbooster.com>
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.
Why
Valid Go such as
const ( A = 1 )andvar ( B = 2 )produces an error node because both grouped declaration rules require a final terminator. The Go specification permits omitting a semicolon before), and Go 1.27.3 compiles these declarations.Requirements
Customer Summary
Grouped constant and variable declarations accept an omitted final semicolon before the closing parenthesis.
Technical Summary
Use
optionalTrailingSepin both declaration rules and regenerate the profiled parser. Extend three existing corpus inputs to omit the final terminator. Update the expected recovery tree for an existing malformed string while retaining its error node. The breaking marker covers that recovery-tree change. Remove the pinned Go compiler fixturebug123.gofrom expected parse failures: it contains the supported grouped constant form, and Go's syntax parser accepts its complete source.The upstream type-declaration fix in
tree-sitter/tree-sitter-gocommite25214e92f1e997940a3bd2f3ced2a2ddf7f027fuses the same helper; constant and variable groups need the same treatment.Testing
bun run verifypassed; code-gauge reported no violations in changed code.bun wb test test/unit/corpus.test.tspassed all 79 corpus cases. The three edited declaration cases failed before the grammar fix.bun wb test test/unit/examples.test.tspassed the pinned real-world parse baseline, with 133 expected failures across 19,898 files.