2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit fa071299 authored by di68kap's avatar di68kap
Browse files

- Autor/Werk wieder getrennt

parent beb4bedc
......@@ -378,7 +378,7 @@ LOG_SIZE_THRESHOLD = 100000 # maximum number of history records to log
LOG_TAIL_THRESHOLD = 500 # maximum number of history recors for "tail log"
def log_parsing_history(grammar, log_file_name: str = '', html: bool=False) -> None:
def log_parsing_history(grammar, log_file_name: str = '', html: bool=True) -> None:
"""
Writes a log of the parsing history of the most recently parsed document.
......
......@@ -298,13 +298,14 @@ def grammar_unit(test_unit, parser_factory, transformer_factory, report=True, ve
cst = parser(test_code, parser_name)
except UnknownParserError as upe:
cst = Node(ZOMBIE_PARSER, "").add_error(str(upe)).init_pos(0)
log_ST(cst, "match_%s_%s.cst" % (parser_name, test_name))
clean_test_name = test_name.replace('*', '')
log_ST(cst, "match_%s_%s.cst" % (parser_name, clean_test_name))
tests.setdefault('__cst__', {})[test_name] = cst
if "ast" in tests or report:
ast = copy.deepcopy(cst)
transform(ast)
tests.setdefault('__ast__', {})[test_name] = ast
log_ST(ast, "match_%s_%s.ast" % (parser_name, test_name))
log_ST(ast, "match_%s_%s.ast" % (parser_name, clean_test_name))
if is_error(cst.error_flag):
errors = adjust_error_locations(cst.collect_errors(), test_code)
errata.append('Match test "%s" for parser "%s" failed:\n\tExpr.: %s\n\n\t%s\n\n' %
......@@ -313,7 +314,7 @@ def grammar_unit(test_unit, parser_factory, transformer_factory, report=True, ve
tests.setdefault('__err__', {})[test_name] = errata[-1]
# write parsing-history log only in case of failure!
if is_logging():
log_parsing_history(parser, "match_%s_%s.log" % (parser_name, test_name))
log_parsing_history(parser, "match_%s_%s.log" % (parser_name, clean_test_name))
elif "cst" in tests and mock_syntax_tree(tests["cst"][test_name]) != cst:
errata.append('Concrete syntax tree test "%s" for parser "%s" failed:\n%s' %
(test_name, parser_name, cst.as_sxpr()))
......
......@@ -592,7 +592,7 @@ def flatten(context: List[Node], condition: Callable=is_anonymous, recursive: bo
Applying flatten recursively will result in these kinds of
structural transformation::
(1 (+ 2) (+ 3) -> (1 + 2 + 3)
(1 (+ 2) (+ 3)) -> (1 + 2 + 3)
(1 (+ (2 + (3)))) -> (1 + 2 + 3)
"""
node = context[-1]
......
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