Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

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

Commit 46992549 authored by di68kap's avatar di68kap
Browse files

- bug fixes

parent 0f447391
......@@ -1263,7 +1263,7 @@ class ZeroOrMore(Option):
results += (node,)
node = Node(self, results)
if infinite_loop_error:
self.grammar.tree__.add_error(node, infinite_loop_error)
self.grammar.tree__.add_error_obj(node, infinite_loop_error)
return node, text
def __repr__(self):
......@@ -1315,7 +1315,7 @@ class OneOrMore(UnaryOperator):
return None, text
node = Node(self, results)
if infinite_loop_error:
self.grammar.tree__.add_error(node, infinite_loop_error)
self.grammar.tree__.add_error_obj(node, infinite_loop_error)
return node, text_
def __repr__(self):
......@@ -1373,11 +1373,12 @@ class Series(NaryOperator):
i = max(1, text.index(match.regs[1][0])) if match else 1
location = self.grammar.document_length__ - len(text_)
node = Node(self, text_[:i]).init_pos(location)
msg = '%s expected, "%s" found!' \
% (parser.repr, text_[:10].replace('\n', '\\n '))
node.errors.append(Error(msg, Error.MESSAGE, location))
node.errors.append(Error("§ %s violation" % parser.repr,
Error.MESSAGE, location))
if not mandatory_violation:
mandatory_violation = Error(msg, Error.ERROR, location)
msg = '%s expected, "%s" found!' \
% (parser.repr, text_[:10].replace('\n', '\\n '))
mandatory_violation = Error(msg, Error.MANDATORY_CONTINUATION, location)
text_ = text_[i:]
results += (node,)
# if node.error_flag: # break on first error
......
......@@ -736,7 +736,7 @@ class RootNode(Node):
code(int): An error code to identify the kind of error
"""
error = Error(message, code, node=node)
self.add_error_obj(error)
self.add_error_obj(node, error)
def collect_errors(self) -> List[Error]:
......@@ -748,7 +748,7 @@ class RootNode(Node):
self.all_errors.sort(key=lambda e: e.pos)
for node in self.err_nodes_keep: # redundant: consider removing Error.Error._node_keep
for error in node.errors:
assert error._pos < 0 or error._pos == node.pos
# assert error._pos < 0 or node.pos <= error._pos <= node.len
error._pos = node.pos
self.err_nodes_keep = []
errors = self.all_errors
......
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