fix: preserve macro adjacency with the C 2 scanner - #65
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Integrate current main and regenerate the parser with its conversion fixes. Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Use the shared newline scanner for pack-index whitespace and integrate the fixture-isolated typeof checks from main. Co-authored-by: WillBooster (Codex CLI) <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
Comments between a macro name and
(make the macro object-like, while a line splice alone preserves function-like adjacency. C++ inherits the grammar from C and must adopt the C 2.0.0 scanner contract to distinguish these cases. This is the corresponding C++ repair forWillBooster/tree-sitter-c#40.Requirements
Customer Summary
Comments and whitespace keep C++ macros object-like. Line splices alone preserve function-like parameters, including when an editor adds or removes the separating text.
Technical Summary
Pin C 2.0.0, copy its shared preprocessor headers and wire the inherited macro-name external token into the C++ scanner. Consume splice-only separation before the opening parameter parenthesis. Regenerate the parser while retaining the node schema and C++ scanner features.
Testing
Parser generation, Wasm build and
bun run verifypass. The macro-adjacency, corpus, inherited-C and query suites pass; the latest main integration also passes all nine macro-adjacency and typeof tests. Regression coverage includes actual configured C/C++ highlight queries. All checks on c2062c4 pass, including platform, examples, performance and robustness coverage.