diff --git a/montepy/data_inputs/tally.py b/montepy/data_inputs/tally.py index d9738be8..6a5ca764 100644 --- a/montepy/data_inputs/tally.py +++ b/montepy/data_inputs/tally.py @@ -37,8 +37,6 @@ def __init__(self, input=None): num = self._input_number self._old_number = copy.deepcopy(num) self._number = num - print(self._tree["tally"]) - assert False try: tally_type = TallyType(self.number % _TALLY_TYPE_MODULUS) except ValueError as e: diff --git a/montepy/input_parser/tally_parser.py b/montepy/input_parser/tally_parser.py index 0f3e8096..b1bad16c 100644 --- a/montepy/input_parser/tally_parser.py +++ b/montepy/input_parser/tally_parser.py @@ -27,6 +27,11 @@ def tally_specification(self, p): "tally list", {"tally": p.tally_numbers, "end": text} ) + @_('"("', '"(" padding', '")"', '")" padding') + def paren_phrase(self, p): + """ """ + return self._flush_phrase(p, str) + @_("PARTICLE", "PARTICLE padding") def end_phrase(self, p): """ @@ -41,31 +46,24 @@ def end_phrase(self, p): "tally_numbers tally_numbers", "number_sequence", "tally_group", - "tally_numbers padding", ) def tally_numbers(self, p): - if hasattr(p, "tally_numbers"): - ret = p.tally_numbers - ret.nodes["right"] += p.padding - return ret if hasattr(p, "tally_numbers1"): - return syntax_node.SyntaxNode("tally tree", {"left": p[0], "right": p[1]}) + ret = p.tally_numbers1 + for node in p.tally_numbers2.nodes: + ret.append(node) + return ret else: - left = syntax_node.PaddingNode(None) - right = syntax_node.PaddingNode(None) - return syntax_node.SyntaxNode( - "tally set", {"left": left, "tally": p[0], "right": right} - ) + return p[0] @_( - '"(" number_sequence ")"', - '"(" padding number_sequence ")"', + 'paren_phrase number_sequence paren_phrase', ) def tally_group(self, p): - left = syntax_node.PaddingNode(p[0]) - if hasattr(p, "padding"): - left.append(p.padding) - right = syntax_node.PaddingNode(p[-1]) - return syntax_node.SyntaxNode( - "tally set", {"left": left, "tally": p.number_sequence, "right": right} - ) + ret = syntax_node.ListNode() + ret.append(p[0]) + for node in p.number_sequence.nodes: + ret.append(node) + ret.append(p[2]) + return ret +