lark
lark copied to clipboard
ABNF grammar support V2
trafficstars
This PR implements feature request #318 in different approach from PR #1017.
Now it parses ABNF grammar and convert it to EBNF parse-tree. %import is implemented for convenience, and %terminal to control parse-tree construction. These directives are non-standard extension to ABNF.
The first commit refactors GrammarBuilder into syntax independent GrammarLoaderBase and the rest so that we can share/reuse code to implement %import for EBNF and ABNF (and other grammars).
Second commit is a plugin loader. It loads GrammarLoader instance as a plugin from lark/syntax/*.py.
These commits implements PR #1019 in different approach.