Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E0 not allowed by Parser #551

Open
MicahGale opened this issue Sep 19, 2024 · 0 comments
Open

E0 not allowed by Parser #551

MicahGale opened this issue Sep 19, 2024 · 0 comments
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". parsers are hard Examples of where MCNP syntax is complicated and should be simplified.

Comments

@MicahGale
Copy link
Collaborator

Describe the bug

While playing around with a huge set of MCNP input files I found this error. I suspect it is due to the fact that the ParserBase distinguishes between 0 and non-0 numbers. I think this comes from this line.

To Reproduce

A short code snippet of what you have ran. Please change or remove any specific values or anything that can't be public. For example:

problem = montepy.read_input("foo.imcnp")

Error Message (if any)

If an error message was printed please include the entire stacktrace. If it includes any specific values please change or remove them. For example:

MontePy/montepy/input_parser/input_reader.py:31: in read_input
    problem.parse_input(replace=replace)
MontePy/montepy/mcnp_problem.py:297: in parse_input
    raise e
MontePy/montepy/mcnp_problem.py:282: in parse_input
    obj = obj_parser(input)
MontePy/montepy/data_inputs/data_parser.py:42: in parse_data
    base_input = data_input.DataInput(input, fast_parse=True)
MontePy/montepy/data_inputs/data_input.py:340: in __init__
    super().__init__(input, fast_parse)
MontePy/montepy/data_inputs/data_input.py:64: in __init__
    super().__init__(input, self._classifier_parser)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <montepy.data_inputs.data_input.DataInput object at 0x7f27acb0b080>
input = INPUT: BlockType.DATA: ['E0  1.0000E-10 1.0500E-10 1.1000E-10 1.1500E-10 1.2000E-10', '      1.2750E-10 1.3500E-10 1.4...                                   ***', 'c *************************************************************************']
parser = <montepy.input_parser.data_parser.ClassifierParser object at 0x7f27f003bce0>

    def __init__(self, input, parser):
        self._problem = None
        self._parameters = ParametersNode()
        self._input = None
        if input:
            if not isinstance(input, montepy.input_parser.mcnp_input.Input):
                raise TypeError("input must be an Input")
            try:
                try:
                    parser.restart()
                # raised if restarted without ever parsing
                except AttributeError as e:
                    pass
                self._tree = parser.parse(input.tokenize(), input)
                self._input = input
            except ValueError as e:
                raise MalformedInputError(
                    input, f"Error parsing object of type: {type(self)}: {e.args[0]}"
                )
            if self._tree is None:
>               raise ParsingError(
                    input,
                    "",
                    parser.log.clear_queue(),
                )
E               montepy.errors.ParsingError:     tests/models/icsbep/IEU-SOL-THERM-005_IST005_MCNP6.imcnp, line 91
E
E                   >   91| E0  1.0000E-10 ...
E                         |  ^ not expected here.
E               There was an error parsing "0".
E               sly: Syntax error at line 1, token=NULL

MontePy/montepy/mcnp_object.py:57: ParsingError

MCNP input file snippet

If applicable, please include a small section of the input file you were working on. If it includes any specific values please change or remove them. For example:

Demo model with significant redactions. 
...

...

E0  1.0000E-10 ...

Version

  • Version 0.4.1

Additional context

Specifical file is: tests/models/icsbep/IEU-SOL-THERM-005_IST005_MCNP6.imcnp'

@MicahGale MicahGale added bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". parsers are hard Examples of where MCNP syntax is complicated and should be simplified. labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". parsers are hard Examples of where MCNP syntax is complicated and should be simplified.
Projects
None yet
Development

No branches or pull requests

1 participant