Commit a7c3bfda authored by eckhart's avatar eckhart

- parser.py Grammar.static_analysis_pending__ made cython compatible (turned...

- parser.py Grammar.static_analysis_pending__ made cython compatible (turned into a list, because cython cannot write class attrributes for extension types)
parent 05cb32cd
......@@ -167,7 +167,7 @@ class EBNFGrammar(Grammar):
"""
expression = Forward()
source_hash__ = "82a7c668f86b83f86515078e6c9093ed"
static_analysis_pending__ = False
static_analysis_pending__ = []
parser_initialization__ = ["upon instantiation"]
COMMENT__ = r'#.*(?:\n|$)'
WHITESPACE__ = r'\s*'
......@@ -835,7 +835,7 @@ class EBNFCompiler(Compiler):
+ ' source file'
+ ('. Grammar:' if self.grammar_source and show_source else '.')]
definitions.append(('parser_initialization__', '["upon instantiation"]'))
definitions.append(('static_analysis_pending__', 'True'))
definitions.append(('static_analysis_pending__', '[True]'))
if self.grammar_source:
definitions.append(('source_hash__',
'"%s"' % md5(self.grammar_source, __version__)))
......@@ -921,7 +921,7 @@ class EBNFCompiler(Compiler):
self.grammar_name)
_ = grammar_class()
grammar_python_src = grammar_python_src.replace(
'static_analysis_pending__ = True', 'static_analysis_pending__ = False', 1)
'static_analysis_pending__ = [True]', 'static_analysis_pending__ = []', 1)
except NameError:
pass # undefined name in the grammar are already cuaght and reported
except GrammarError as error:
......
......@@ -738,7 +738,7 @@ class Grammar:
# some default values
# COMMENT__ = r'' # type: str # r'#.*(?:\n|$)'
# WSP_RE__ = mixin_comment(whitespace=r'[\t ]*', comment=COMMENT__) # type: str
static_analysis_pending__ = True # type: bool
static_analysis_pending__ = [True] # type: List[bool]
@classmethod
......@@ -805,7 +805,7 @@ class Grammar:
result = self.static_analysis()
if result:
raise GrammarError(result)
self.__class__.static_analysis_pending__ = False
self.__class__.static_analysis_pending__.pop()
except (NameError, AttributeError):
pass # don't fail the initialization of PLACEHOLDER
......
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