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

Commit 05cb32cd authored by Eckhart Arnold's avatar Eckhart Arnold

- slight adjustments

parent 9e1686d9
......@@ -1006,8 +1006,9 @@ class EBNFCompiler(Compiler):
elif key == 'drop':
check_argnum(2)
for child in node.children[1:]:
node_type = child.content.lower()
assert node_type in DROP_VALUES, child.content
content = child.content
node_type = content.lower()
assert node_type in DROP_VALUES, content
self.directives[key].add(node_type)
elif key == 'ignorecase':
......@@ -1190,8 +1191,8 @@ class EBNFCompiler(Compiler):
if len(symlist) == 1:
nd = symlist[0].children[1]
break
if (nd.tag_name != "regexp" or nd.content[:1] != '/'
or nd.content[-1:] != '/'):
content = nd.content
if (nd.tag_name != "regexp" or content[:1] != '/' or content[-1:] != '/'):
self.tree.new_error(node, "Lookbehind-parser can only be used with RegExp"
"-parsers, not: " + nd.tag_name)
......
......@@ -198,9 +198,10 @@ class Node: # (collections.abc.Sized): Base class omitted for cython-compatibil
errors = root.errors_sorted
if errors:
e_pos = errors[0].pos
return self.content[:e_pos] + \
content = self.content
return content[:e_pos] + \
' <<< Error on "%s" | %s >>> ' % \
(self.content[e_pos - self.pos:], '; '.join(e.message for e in errors))
(content[e_pos - self.pos:], '; '.join(e.message for e in errors))
return self.content
def __repr__(self):
......@@ -376,8 +377,8 @@ class Node: # (collections.abc.Sized): Base class omitted for cython-compatibil
"""
return ''.join(self._content())
## unoptimized
# return "".join(child.content for child in self.children) if self.children else str(
# self._result)
# return "".join(child.content for child in self.children) if self.children \
# else str(self._result)
## obsolete
# if self._content is None:
# if self.children:
......
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