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:

Commit 54722cc2 authored by eckhart's avatar eckhart
Browse files

- minor adjustments

parent acc52924
......@@ -164,7 +164,7 @@ ZOMBIE_PARSER = ZombieParser()
ChildrenType = Tuple['Node', ...]
NoChildren = cast(ChildrenType, ()) # type: ChildrenType
StrictResultType = Union[ChildrenType, str]
StrictResultType = Union[ChildrenType, StringView, str]
ResultType = Union[ChildrenType, 'Node', StringView, str, None]
......@@ -194,6 +194,10 @@ class Node(
children (tuple): The tuple of child nodes or an empty tuple
if there are no child nodes. READ ONLY!
content (str): Yields the contents of the tree as string. The
difference to ``str(node)`` is that ``node.content`` does
not add the error messages to the returned string.
parser (Parser): The parser which generated this node.
WARNING: In case you use mock syntax trees for testing or
parser replacement during the AST-transformation: DO NOT
......@@ -232,10 +236,13 @@ class Node(
dictionary is created lazily upon first usage. The attributes
will only be shown in the XML-Representation, not in the
__slots__ = ['_result', 'children', '_errors', '_len', '_pos', 'parser', 'error_flag',
'_xml_attr', '_parent']
def __init__(self, parser, result: ResultType, leafhint: bool = False) -> None:
......@@ -248,7 +255,7 @@ class Node(
# Assignment to self.result initializes the attributes _result, children and _len
# The following if-clause is merely an optimization, i.e. a fast-path for leaf-Nodes
if leafhint:
self._result = str(result) # type: StrictResultType
self._result = result # type: StrictResultType
self.children = NoChildren # type: ChildrenType
self._len = -1 # type: int # lazy evaluation
......@@ -412,7 +419,6 @@ class Node(
Returns content as string, omitting error messages.
# TODO: Optimize with caching and StringViews
if self.children:
return "".join(child.content for child in self.children)
return cast(str, self._result)
......@@ -11,7 +11,7 @@ Match-test "1"
### CST
### AST
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