Skip to content

Scan macro identifiers in external scanner #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

d-alonso
Copy link

and allow them specifically for type specifiers in variable declarations. "Macro identifiers" can be set through an environment variable that users of this grammar can set

This is a bit esoteric but allowing any identifier in that grammar rule makes conflicts that are impossible to untangle

@d-alonso d-alonso self-assigned this Jun 26, 2025
@d-alonso d-alonso requested review from a team, ruifm, daniel-otero and inaki-amatria and removed request for a team and daniel-otero June 26, 2025 14:16
@d-alonso d-alonso force-pushed the feature/macroIdentifiersInVarDecls branch from 84e41cd to 7ac095a Compare June 26, 2025 15:32
Copy link

@jgonzac jgonzac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test?

@d-alonso d-alonso force-pushed the feature/macroIdentifiersInVarDecls branch from 7ac095a to 2de8450 Compare June 27, 2025 08:04
Copy link
Member

@inaki-amatria inaki-amatria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! This is phenomenal work, kudos!! One suggestion: could we add some links in the code to other grammars that use this same mechanism to identify macros? That would help with context for future readers.

@d-alonso d-alonso force-pushed the feature/macroIdentifiersInVarDecls branch from 8caf37f to 4ccf497 Compare June 27, 2025 09:20
@d-alonso d-alonso force-pushed the feature/macroIdentifiersInVarDecls branch from 4ccf497 to 5a7fa76 Compare June 27, 2025 09:21
@d-alonso d-alonso merged commit 5a7fa76 into base/MergeTreeSitterFortranAndSomeGrammarImprovements Jun 27, 2025
1 check passed
@d-alonso
Copy link
Author

One suggestion: could we add some links in the code to other grammars that use this same mechanism to identify macros?

Sorry if I gave that impression, but I found no such grammar (I didn't look much though). I did found examples of grammars being tweaked by environment variables, for example markdowns': https://github.com/tree-sitter-grammars/tree-sitter-markdown/blob/7462bb66ac7e90312082269007fac2772fe5efd1/common/common.js#L3

@inaki-amatria inaki-amatria deleted the feature/macroIdentifiersInVarDecls branch June 30, 2025 07:39
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.

3 participants