-
Notifications
You must be signed in to change notification settings - Fork 18
Labels
bugsA deviation from expected behavior that does not reach the level of being reportable as an "Error".A deviation from expected behavior that does not reach the level of being reportable as an "Error".parsers are hardExamples of where MCNP syntax is complicated and should be simplified.Examples of where MCNP syntax is complicated and should be simplified.
Description
Bug Description
The FMESHn card takes several keywords whose values are a 3-tuple of numbers; namely origin, axs, and vec: MCNP 6.3.1 Manual § 5.11.2
These values may be given with or without commas. Commas are used in the default. MontePy cannot parse the input with the commas.
To Reproduce
>>> problem = montepy.MCNP_Problem("")
>>> problem.parse("fmesh1:n vec=0 0 0")
DATA INPUT: fmesh1:n
>>> problem.parse("fmesh1:n vec=0, 0, 0")
montepy.exceptions.ParsingError:
. . .This also breaks with axs and origin.
Error Message
>>>problem.parse("fmesh1:n vec=0,0,0")
Traceback (most recent call last):
File "./montepy/mcnp_problem.py", line 729, in parse
obj = montepy.parse_data(input)
File "./montepy/data_inputs/data_parser.py", line 54, in parse_data
return data_input.DataInput(input, prefix=prefix)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "./montepy/mcnp_object.py", line 49, in wrapped
add_line_number_to_exception(e, self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "./montepy/exceptions.py", line 235, in add_line_number_to_exception
raise error
File "./montepy/mcnp_object.py", line 41, in wrapped
return func(*args, **kwargs)
File "./montepy/data_inputs/data_input.py", line 327, in __init__
super().__init__(input, fast_parse)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "./montepy/mcnp_object.py", line 49, in wrapped
add_line_number_to_exception(e, self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "./montepy/exceptions.py", line 235, in add_line_number_to_exception
raise error
File "./montepy/mcnp_object.py", line 41, in wrapped
return func(*args, **kwargs)
File "./montepy/data_inputs/data_input.py", line 62, in __init__
super().__init__(input, self._parser)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "./montepy/mcnp_object.py", line 49, in wrapped
add_line_number_to_exception(e, self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "./montepy/exceptions.py", line 259, in add_line_number_to_exception
raise error.with_traceback(trace)
File "./montepy/mcnp_object.py", line 41, in wrapped
return func(*args, **kwargs)
File "./montepy/mcnp_object.py", line 137, in __init__
raise ParsingError(
...<3 lines>...
)
montepy.exceptions.ParsingError: , line 0
> 0| fmesh1:n vec=0,0,0
| ^ not expected here.
There was an error parsing ",".
sly: Syntax error at line 1, token=,(First attempts to parse as data card, and then tries surface and cell. I've removed the surface and cell attempts from the traceback.)
Version
- Latest
develop(commit 8a0e7af)
Metadata
Metadata
Assignees
Labels
bugsA deviation from expected behavior that does not reach the level of being reportable as an "Error".A deviation from expected behavior that does not reach the level of being reportable as an "Error".parsers are hardExamples of where MCNP syntax is complicated and should be simplified.Examples of where MCNP syntax is complicated and should be simplified.