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
How should Grammar objects be composed? #23
Comments
It is possible to compose grammars by composing their The main trick here is that you can override Note that if the grammars for header, line, and footer have any tokens that would be ambiguous together, you need to move those tokens out of the grammars and reuse them in the grammars. Here's a simplified example of how I achieved this for two grammars. Composing three would be similar. :)
|
Thanks for the explanation. This did the trick. |
The goal
I have a file that looks like this:
And I would like to parse it into the following container:
The problem
I have written a grammar for each of the different variants, i.e
Grammar<Header
,Grammar<Line>
, andGrammar<Footer>
. There is some similarity in how these different lines look. How can I compose these grammars together? The variants are split on a newline\n
character.Any help would be much appreciated.
The text was updated successfully, but these errors were encountered: