Skip to content

Commit

Permalink
Merge pull request #471 from idaholab/461-multiline-parentheses-cell-…
Browse files Browse the repository at this point in the history
…definition-appears-not-to-be-supported-by-the-parser

Fixed edge case of bad typing in parser
  • Loading branch information
MicahGale authored Aug 8, 2024
2 parents 896ee12 + e98eb45 commit 55d0c4d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ MontePy Changelog

**Bug fixes**

* Fixed bug with appending and renumbeing numbered objects from other MCNP problems (:issue:`466`).
* Fixed bug with appending and renumbering numbered objects from other MCNP problems (:issue:`466`).
* Fixed bug with dynamic typing and the parsers that only appear in edge cases (:issue:`461`).


0.3.2
Expand Down
6 changes: 3 additions & 3 deletions montepy/input_parser/syntax_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ def append(self, val, is_comment=False):
:param is_comment: whether or not the node is a comment.
:type is_comment: bool
"""
if is_comment:
if not isinstance(val, CommentNode):
val = CommentNode(val)
if is_comment and not isinstance(val, CommentNode):
val = CommentNode(val)
if isinstance(val, CommentNode):
self.nodes.append(val)
return
parts = val.split("\n")
Expand Down
8 changes: 8 additions & 0 deletions tests/test_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ def test_material_float(self):
" 3201 15i 3217",
" u=20",
],
# issue #461
[
"43 0",
" ( $ a dollar comment here",
" -1 2",
" )",
" IMP:N=1.000000 IMP:P=1.000000",
],
],
)
def test_complex_cell_parsing(lines):
Expand Down

0 comments on commit 55d0c4d

Please sign in to comment.