Commit c2d5de0e authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

renamed name property of class Node to 'tag'

parent 261dfa0a
...@@ -189,7 +189,7 @@ class Node: ...@@ -189,7 +189,7 @@ class Node:
Represents a node in the concrete or abstract syntax tree. Represents a node in the concrete or abstract syntax tree.
Attributes: Attributes:
name (str): The name of the node, which is either its parser's tag (str): The name of the node, which is either its parser's
name or, if that is empty, the parser's class name name or, if that is empty, the parser's class name
result (str or tuple): The result of the parser which result (str or tuple): The result of the parser which
generated this node, which can be either a string or a generated this node, which can be either a string or a
...@@ -241,7 +241,7 @@ class Node: ...@@ -241,7 +241,7 @@ class Node:
return str(self.result) return str(self.result)
@property @property
def name(self): def tag(self):
return self.parser.name or self.parser.__class__.__name__ return self.parser.name or self.parser.__class__.__name__
@property @property
...@@ -330,7 +330,7 @@ class Node: ...@@ -330,7 +330,7 @@ class Node:
in the text will be reported as line and column. in the text will be reported as line and column.
""" """
def opening(node): def opening(node):
s = '(' + node.name s = '(' + node.tag
# s += " '(pos %i)" % node.pos # s += " '(pos %i)" % node.pos
if src: if src:
s += " '(pos %i %i %i)" % (node.pos, *line_col(src, node.pos)) s += " '(pos %i %i %i)" % (node.pos, *line_col(src, node.pos))
...@@ -355,7 +355,7 @@ class Node: ...@@ -355,7 +355,7 @@ class Node:
""" """
def opening(node): def opening(node):
s = '<' + node.name s = '<' + node.tag
# s += ' pos="%i"' % node.pos # s += ' pos="%i"' % node.pos
if src: if src:
s += ' line="%i" col="%i"' % line_col(src, node.pos) s += ' line="%i" col="%i"' % line_col(src, node.pos)
...@@ -365,7 +365,7 @@ class Node: ...@@ -365,7 +365,7 @@ class Node:
return s return s
def closing(node): def closing(node):
s = '</' + node.name + '>' s = '</' + node.tag + '>'
return s return s
return self._tree_repr(' ', opening, closing) return self._tree_repr(' ', opening, closing)
...@@ -578,7 +578,7 @@ def is_whitespace(node): ...@@ -578,7 +578,7 @@ def is_whitespace(node):
def is_comment(node): def is_comment(node):
return node.name == WHITESPACE_KEYWORD return node.parser.name == WHITESPACE_KEYWORD
def is_scanner_token(node): def is_scanner_token(node):
...@@ -719,7 +719,7 @@ def DEBUG_DUMP_PARSING_HISTORY(grammar_base, document): ...@@ -719,7 +719,7 @@ def DEBUG_DUMP_PARSING_HISTORY(grammar_base, document):
for record in grammar_base.history: for record in grammar_base.history:
line = "; ".join(prepare_line(record)) line = "; ".join(prepare_line(record))
full_history.append(line) full_history.append(line)
if record.node and record.node.name != WHITESPACE_KEYWORD: if record.node and record.node.parser.name != WHITESPACE_KEYWORD:
match_history.append(line) match_history.append(line)
if record.node.errors: if record.node.errors:
errors_only.append(line) errors_only.append(line)
......
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