Commit 0faae5f5 authored by Igor Dejanovic's avatar Igor Dejanovic

Small performance fix

parent 6ae9d264
...@@ -157,15 +157,12 @@ class ParsingExpression(object): ...@@ -157,15 +157,12 @@ class ParsingExpression(object):
if parser.debug: if parser.debug:
print(">> Entering rule {}".format(self.name)) print(">> Entering rule {}".format(self.name))
if parser._in_parse_intro: parser._in_parse_intro = True
# Do not recurse in parse_intro
return
# Skip whitespaces and parse comments if we are not # Skip whitespaces and parse comments if we are not
# in the lexical rule # in the lexical rule
if not parser._in_lex_rule: if not parser._in_lex_rule:
parser._skip_ws() parser._skip_ws()
parser._in_parse_intro = True
if parser.comments_model and not parser._in_parse_comment: if parser.comments_model and not parser._in_parse_comment:
parser._in_parse_comment = True parser._in_parse_comment = True
try: try:
...@@ -181,10 +178,12 @@ class ParsingExpression(object): ...@@ -181,10 +178,12 @@ class ParsingExpression(object):
finally: finally:
parser._in_parse_comment = False parser._in_parse_comment = False
parser._in_parse_intro = False parser._in_parse_intro = False
def parse(self, parser): def parse(self, parser):
self._parse_intro(parser)
if not parser._in_parse_intro:
self._parse_intro(parser)
# Current position could change in recursive calls # Current position could change in recursive calls
# so save it. # so save it.
......
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