Open subnut opened 6 months ago
_string
is a rule template, that can't be used in a terminal. Currently there are no terminal templates. (and the expansion you wrote is not in fact equivalent. rule template generate new rules with impossible-to-recreate names instead of inlining)
Thanks for letting us know. This is indeed an incorrect grammar, but we should throw a better error message for the user.
_string
is a rule template, that can't be used in a terminal. Currently there are no terminal templates.
Then that should be mentioned at https://lark-parser.readthedocs.io/en/stable/grammar.html#templates
Yep, that documentation is wrong: templates aren't "expanded", they are instantiated. We had considered adding expanding templates (probably with __
prefix), but haven't gotten around to that.
Describe the bug
AssertionError
To Reproduce
This grammar fails with
AssertionError
whereas the same grammar, when expanded, works perfectly fine!