How should I best define scanner.c if my grammar inherits from a base grammar with external rules? #3142
Unanswered
michaelfortunato
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Say I have a grammar which has a few external rules defined.
Say I then the base grammar for a new grammar by doing
The problem is that because the baseGrammar's external rules are used in my new grammar. My new grammar requires its own scanner.c.
How should I define scanner.c?
I was thinking I just include the base grammar as a dev dependency, and then manually copy the contents of that base grammar's scanner.c to my new grammar.
Alternatively, maybe I can create a .h file containing the inlined code use by the base grammar that both my new grammar and the base can consume the header.
I see tree-sitter-typescript had to make a decision on this and it seems like they went with copying javascript's scanner.c and modifying it from there.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions