Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit b25f87b6 authored by di68kap's avatar di68kap
Browse files

- DHParser.testing Lookahead checking bug fixed

parent 98fc3fa7
...@@ -308,33 +308,31 @@ def grammar_unit(test_unit, parser_factory, transformer_factory, report=True, ve ...@@ -308,33 +308,31 @@ def grammar_unit(test_unit, parser_factory, transformer_factory, report=True, ve
parser = parser_factory() parser = parser_factory()
transform = transformer_factory() transform = transformer_factory()
is_lookahead = set() # type: Dict[str] # Dictionary of parser names is_lookahead = set() # type: Set[str] # Dictionary of parser names
with_lookahead = set() # type: Set[Parser] with_lookahead = set() # type: Set[Parser]
visited = set() # type: Set[Parser] lookahead_flag = False # type: bool
def find_lookahead(p: Parser): def find_lookahead(p: Parser):
"""Raises a StopIterationError if parser `p` is or contains """Raises a StopIterationError if parser `p` is or contains
a Lookahead-parser.""" a Lookahead-parser."""
nonlocal is_lookahead, with_lookahead, visited nonlocal is_lookahead, with_lookahead, lookahead_flag
if p in visited: if p in with_lookahead:
raise StopIteration lookahead_flag = True
visited.add(p) else:
if isinstance(p, Lookahead): if isinstance(p, Lookahead):
is_lookahead.add(p.tag_name) is_lookahead.add(p.tag_name)
with_lookahead.add(p) with_lookahead.add(p)
lookahead_flag = True
def has_lookahead(parser_name: str): def has_lookahead(parser_name: str):
"""Returns `True`, if given parser is or contains a Lookahead-parser.""" """Returns `True`, if given parser is or contains a Lookahead-parser."""
nonlocal is_lookahead, with_lookahead, visited, parser nonlocal is_lookahead, with_lookahead, lookahead_flag, parser
p = parser[parser_name] p = parser[parser_name]
num_lookaheads = len(is_lookahead)
if p in with_lookahead: if p in with_lookahead:
return True return True
try: lookahead_flag = False
p.apply(find_lookahead) p.apply(find_lookahead)
except StopIteration: if lookahead_flag:
pass
if len(is_lookahead) > num_lookaheads:
with_lookahead.add(p) with_lookahead.add(p)
return True return True
return False return False
......
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