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 5e7a1add authored by eckhart's avatar eckhart
Browse files

- parser.py: error reporting of HistoryRecord changed

parent b00c3789
......@@ -161,7 +161,9 @@ class HistoryRecord:
(self.line_col[0], self.line_col[1], self.stack, str(self.node))
def err_msg(self) -> str:
return self.ERROR + ": " + "; ".join(str(e) for e in self.node._errors) # .replace('\n', '\\')
return self.ERROR + ": " + "; ".join(
str(e) for e in (self.node._errors if self.node._errors else
self.node.collect_errors()[:1]))
@property
def stack(self) -> str:
......@@ -171,7 +173,7 @@ class HistoryRecord:
@property
def status(self) -> str:
return self.FAIL if self.node is None else \
self.err_msg() if has_errors(self.node._errors) else self.MATCH
self.err_msg() if self.node.error_flag else self.MATCH # has_errors(self.node._errors)
@property
def extent(self) -> slice:
......@@ -273,7 +275,7 @@ def add_parser_guard(parser_func):
if grammar.history_tracking__:
# don't track returning parsers except in case an error has occurred
remaining = len(rest)
if grammar.moving_forward__ or (node and node._errors):
if grammar.moving_forward__ or (node and node.error_flag): # node._errors
record = HistoryRecord(grammar.call_stack__, node, remaining)
grammar.history__.append(record)
# print(record.stack, record.status, rest[:20].replace('\n', '|'))
......@@ -838,7 +840,7 @@ class Grammar:
record.node.pos = 0
record = HistoryRecord(self.call_stack__.copy(), stitches[-1], len(rest))
self.history__.append(record)
self.history_tracking__ = False
self.history_tracking__ = False # TODO: add an explanation here
if stitches:
if rest:
stitches.append(Node(None, rest))
......
This diff is collapsed.
#cython: infer_types=True
#cython: language_level=3
#cython: c_string_type=unicode
#cython: c_string_encoding=utf-8
import cython
# type hints for Cython python -> C compiler to speed up the most
......
......@@ -246,9 +246,9 @@ class Node(collections.abc.Sized):
def __str__(self):
if self.children:
return "".join(str(child) for child in self.children)
elif isinstance(self.result, StringView):
self.result = str(self.result)
return self.result
elif isinstance(self._result, StringView):
self.result = str(self._result)
return self._result
def __repr__(self):
......
#!/bin/sh
# CFLAGS="-O3 -march=native -mtune=native"
python3 setup.py build_ext --inplace
......@@ -374,14 +374,9 @@ Match-test "2"
% Comment
### AST
(LFF
(NEW_LINE
""
""
)
(WSPC
"% Comment"
)
(NEW_LINE
""
""
)
Match-test "3"
......@@ -393,20 +388,9 @@ Match-test "3"
### AST
(LFF
(NEW_LINE
""
""
)
(WSPC
(:RegExp
"% Comment"
)
(:RegExp
""
""
)
)
(NEW_LINE
""
""
)
Match-test "4"
......@@ -419,16 +403,9 @@ Match-test "4"
### AST
(LFF
(NEW_LINE
""
""
)
(WSPC
""
""
""
)
(NEW_LINE
""
""
)
Fail-test "10"
......
......@@ -51,13 +51,9 @@ Match-test "1"
\command
### AST
(text_element
(command
(generic_command
(CMDNAME
"\command"
)
)
(generic_command
(CMDNAME
"\command"
)
)
......@@ -68,13 +64,9 @@ Match-test "2"
\textbackslash
### AST
(text_element
(command
(text_command
(TXTCOMMAND
"\textbackslash"
)
)
(text_command
(TXTCOMMAND
"\textbackslash"
)
)
......@@ -85,38 +77,24 @@ Match-test "3"
\footnote{footnote}
### AST
(text_element
(command
(known_command
(footnote
(:Token
(:RegExp
"\footnote"
)
)
(block_of_paragraphs
(:Token
(:RegExp
"{"
)
)
(sequence
(paragraph
(text_element
(text
"footnote"
)
)
)
)
(:Token
(:RegExp
"}"
)
)
(footnote
(:Token
"\footnote"
)
(block_of_paragraphs
(:Token
"{"
)
(sequence
(paragraph
(text
"footnote"
)
)
)
(:Token
"}"
)
)
)
......@@ -127,13 +105,9 @@ Match-test "4"
[
### AST
(text_element
(command
(text_command
(BRACKETS
"["
)
)
(text_command
(BRACKETS
"["
)
)
......@@ -144,27 +118,23 @@ Match-test "5"
\begin{generic} unknown inline environment \end{generic}
### AST
(text_element
(generic_inline_env
(begin_environment
"generic"
(generic_inline_env
(begin_environment
"generic"
)
(:Whitespace
" "
)
(paragraph
(text
"unknown inline environment"
)
(:Whitespace
" "
)
(paragraph
(text_element
(text
"unknown inline environment"
)
)
(:Whitespace
" "
)
)
(end_environment
"generic"
)
)
(end_environment
"generic"
)
)
......@@ -175,27 +145,23 @@ Match-test "6"
\begin{small} known inline environment \end{small}
### AST
(text_element
(generic_inline_env
(begin_environment
"small"
(generic_inline_env
(begin_environment
"small"
)
(:Whitespace
" "
)
(paragraph
(text
"known inline environment"
)
(:Whitespace
" "
)
(paragraph
(text_element
(text
"known inline environment"
)
)
(:Whitespace
" "
)
)
(end_environment
"small"
)
)
(end_environment
"small"
)
)
......@@ -206,21 +172,13 @@ Match-test "7"
{\em block}
### AST
(text_element
(block
(text_element
(command
(generic_command
(CMDNAME
"\em"
)
)
)
)
(text_element
(text
"block"
)
(block
(generic_command
(CMDNAME
"\em"
)
)
(text
"block"
)
)
\ No newline at end of file
......@@ -31,20 +31,16 @@ Match-test "1"
)
(sequence
(paragraph
(text_element
(text
"A generic block element is a block element"
"that is unknown to DHParser."
)
(text
"A generic block element is a block element"
"that is unknown to DHParser."
)
)
(paragraph
(text_element
(text
"Unknown begin-end-structures are always"
"considered as block elements and not"
"as inline elements."
)
(text
"Unknown begin-end-structures are always"
"considered as block elements and not"
"as inline elements."
)
(:Whitespace
""
......@@ -86,10 +82,8 @@ Match-test "2"
)
(sequence
(paragraph
(text_element
(text
"a single block paragraph"
)
(text
"a single block paragraph"
)
(:Whitespace
""
......@@ -101,27 +95,16 @@ Match-test "2"
(end_environment
"generic"
)
(LFF
(NEW_LINE
(:RegExp
" "
)
(:RegExp
"% ending with"
)
(:RegExp
""
""
)
(NEW_LINE
(:RegExp
" "
)
(WSPC
(:RegExp
"% a comment"
)
(:RegExp
""
""
)
(:RegExp
"% ending with"
)
(:RegExp
""
""
)
)
)
......@@ -139,10 +122,8 @@ Match-test "3"
(quotation
(sequence
(paragraph
(text_element
(text
"a known block element"
)
(text
"a known block element"
)
(:Whitespace
""
......@@ -192,10 +173,8 @@ Match-test "1"
"generic"
)
(paragraph
(text_element
(text
"inline environment"
)
(text
"inline environment"
)
)
(end_environment
......@@ -216,10 +195,8 @@ Match-test "2"
"generic"
)
(paragraph
(text_element
(text
"inline environment"
)
(text
"inline environment"
)
(:Whitespace
""
......@@ -269,10 +246,8 @@ Match-test "1"
(item
(sequence
(paragraph
(text_element
(text
"Items doe not need to be"
)
(text
"Items doe not need to be"
)
(:Whitespace
""
......@@ -284,10 +259,8 @@ Match-test "1"
(item
(sequence
(paragraph
(text_element
(text
"separated by empty lines."
)
(text
"separated by empty lines."
)
(:Whitespace
""
......@@ -316,18 +289,11 @@ Match-test "2"
### AST
(itemize
(WSPC
""
""
""
)
(item
(sequence
(paragraph
(text_element
(text
"But items may be"
)
(text
"But items may be"
)
)
)
......@@ -335,26 +301,17 @@ Match-test "2"
(item
(sequence
(paragraph
(text_element
(text
"separated by blank lines."
)
(text
"separated by blank lines."
)
)
)
)
(item
(WSPC
""
""
""
)
(sequence
(paragraph
(text_element
(text
"Empty lines at the beginning of an item will be ignored."
)
(text
"Empty lines at the beginning of an item will be ignored."
)
)
)
......@@ -377,17 +334,13 @@ Match-test "3"
(item
(sequence
(paragraph
(text_element
(text
"Items can consist of"
)
(text
"Items can consist of"
)
)
(paragraph
(text_element
(text
"several paragraphs."
)
(text
"several paragraphs."
)
(:Whitespace
""
......@@ -399,10 +352,8 @@ Match-test "3"
(item
(sequence
(paragraph
(text_element
(text
"Or of one paragraph"
)
(text
"Or of one paragraph"
)
(:Whitespace
""
......@@ -432,10 +383,8 @@ Match-test "4"
(item
(sequence
(paragraph
(text_element
(text
"Item-lists can be nested!"
)
(text
"Item-lists can be nested!"
)
(:Whitespace
""
......@@ -462,10 +411,8 @@ Match-test "5"
(item
(sequence
(paragraph
(text_element
(text
"Item-lists may consist of just one item."
)
(text
"Item-lists may consist of just one item."
)
(:Whitespace
""
......@@ -503,10 +450,8 @@ Match-test "1"
(item
(sequence
(paragraph
(text_element
(text
"Enumerations work just like item-lists."
)
(text
"Enumerations work just like item-lists."
)
(:Whitespace
""
......@@ -518,10 +463,8 @@ Match-test "1"
(item
(sequence
(paragraph
(text_element
(text
"Only that the bullets are numbers."
)
(text
"Only that the bullets are numbers."
)
(:Whitespace
""
......@@ -557,10 +500,8 @@ Match-test "2"
(item
(sequence
(paragraph
(text_element
(text
"Item-lists and"
)
(text
"Item-lists and"
)
(:Whitespace
""
......@@ -572,10 +513,8 @@ Match-test "2"
(item
(sequence
(paragraph