A Grammar which takes a list of pre-lexed tokens instead of text
This is useful if you want to do the lexing yourself, as a separate pass:
for example, to implement indentation-based languages.
| parsimonious.grammar.TokenGrammar._expressions_from_rules |
( |
|
self, |
|
|
|
rules, |
|
|
|
custom_rules |
|
) |
| |
|
protected |
Return a 2-tuple: a dict of rule names pointing to their
expressions, and then the first rule.
It's a web of expressions, all referencing each other. Typically,
there's a single root to the web of references, and that root is the
starting symbol for parsing, but there's nothing saying you can't have
multiple roots.
:arg custom_rules: A map of rule names to custom-coded rules:
Expressions
Reimplemented from parsimonious.grammar.Grammar.