Commit bebd3fa3 authored by eckhart's avatar eckhart

ebnf.py: added a fast-path ebnf-Parser if less flexibility regarding the variants

of EBNF-syntax is acceptable.
parent b00c2671
......@@ -674,13 +674,13 @@ def get_ebnf_grammar() -> EBNFGrammar:
raise AttributeError
except AttributeError:
if mode in ('fixed', 'configurable'):
grammar = FixedEBNFGrammar()
grammar = FixedEBNFGrammar(static_analysis=False)
if mode == "fixed":
# configure grammar once
update_scanner(grammar, get_config_value('delimiter_set'))
THREAD_LOCALS.ebnf_grammar_singleton = grammar
else:
grammar = EBNFGrammar()
grammar = EBNFGrammar(static_analysis=False)
THREAD_LOCALS.ebnf_grammar_singleton = grammar
if mode == 'configurable':
# configure grammar on each request of the grammar object
......
......@@ -1121,9 +1121,11 @@ class Grammar:
def __init__(self, root: Parser = None, static_analysis: Optional[bool] = None) -> None:
"""Constructor of class Grammar.
:param root: Overrides default root parser. By default the root parser
is the parser assigned to the class field `root__`. This is useful for
executing or testing certain parts of a complex parser ensemble.
:param root: If not None, this is goind to be the root parser of the grammar.
This allows to first construct an ensemble of parser objects and then
link those objects in a grammar-object, rather than adding the parsers
as fields to a derived class of class Grammar. (See the doc-tests in this
module for examples.)
:param static_analysis: If not None, this overrides the config value
"static_analysis".
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment