Merge pull request #1603 from sarathfrancis90/fix/declare-rule-name-crash Raise GrammarError for non-terminal names in %declare
Recent Commits to lark:master
-
Merge pull request #1603 from sarathfrancis90/fix/declare-rule-name-c…
-
Raise GrammarError for non-terminal names in %declare
Raise GrammarError for non-terminal names in %declare %declare is for terminals, but the grammar accepted any symbol, so a lowercase (rule) name like `%declare foo` defined an abstract rule with no tree. The compiler later called iter_subtrees() on that missing tree and crashed with `AttributeError: 'NoneType' object has no attribute 'iter_subtrees'` instead of reporting the bad grammar. Reject non-terminal names in %declare with a clear GrammarError.