Skip to content

Commit

Permalink
Merge pull request #479 from idaholab/476-parsing-of-transformations-…
Browse files Browse the repository at this point in the history
…on-fill-keywords-appears-to-be-failing

Fix issue with floats in fill transform.
  • Loading branch information
MicahGale authored Aug 13, 2024
2 parents e63392e + f0d4cd8 commit 496c19c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ MontePy Changelog
* Fixed bug with material compositions not being updated when written to file (:issue:`470`).
* 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`).
* Fixed parser bug with having spaces in the start of the transform input for the fill of a cell (:pull:`479`).
* Fixed bug with trying to get trailing comments from non-existant parts of the syntax tree (:pull:`480`).

**Code Quality**
Expand Down
4 changes: 4 additions & 0 deletions montepy/input_parser/cell_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,15 @@ def geometry_factory(self, p):
# support for fill card weirdness
@_(
'number_sequence "(" number_sequence ")"',
'number_sequence "(" padding number_sequence ")"',
'number_sequence "(" number_sequence ")" padding',
'number_sequence "(" padding number_sequence ")" padding',
'number_sequence ":" numerical_phrase',
'number_sequence ":" padding numerical_phrase',
# support for TRCL syntax
'"(" number_sequence ")"',
'"(" number_sequence ")" padding',
'"(" padding number_sequence ")" padding',
)
def number_sequence(self, p):
if isinstance(p[0], str):
Expand Down
3 changes: 2 additions & 1 deletion montepy/input_parser/parser_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,9 @@ def _debug_parsing_error(self, token): # pragma: no cover
debugfile = 'parser.out'
"""
print("********* New Parsing Error ************ ")
print(f"********* New Parsing Error from: {type(self)} ************ ")
print(f"Token: {token}")
print(f"State: {self.state}, statestack: {self.statestack}")
print(f"Symstack: {self.symstack}")
print(f"Log length: {len(self.log)}")
print()
8 changes: 8 additions & 0 deletions tests/test_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ def test_material_float(self):
" )",
" IMP:N=1.000000 IMP:P=1.000000",
],
[
"1 0 3 -2",
" IMP:N=1.000000 IMP:P=1.000000",
" *FILL=1 ( 0.000 0.000 0.000",
" 30.000 120.000 90.000",
" 60.000 30.000 90.000",
" 90.000 90.000 0.000)",
],
],
)
def test_complex_cell_parsing(lines):
Expand Down

0 comments on commit 496c19c

Please sign in to comment.