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

SLY Syntax Error for Numbers in 'READ' cards #206

Closed
MicahGale opened this issue Jan 10, 2024 · 1 comment · Fixed by #372
Closed

SLY Syntax Error for Numbers in 'READ' cards #206

MicahGale opened this issue Jan 10, 2024 · 1 comment · Fixed by #372
Assignees
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.
Milestone

Comments

@MicahGale
Copy link
Collaborator

In GitLab by @tjlaboss on Jan 10, 2024, 10:25

MCNP allows numbers 0123456789 in READ cards, but this causes a syntax error when parsing in MontePy.

MWE

/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/

testRead.imcnp:

Testing read card
C this is a comment
read file=file2read.imcnp

1 so 0.5 

mode n

file2read.imcnp:

1 0 -1
c

Traceback:

Traceback (most recent call last):
  File "/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/TestRead.py", line 3, in <module>
    deck = montepy.read_input(fname)
  File "/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/montepy/input_parser/input_reader.py", line 26, in read_input
    problem.parse_input()
  File "/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/montepy/mcnp_problem.py", line 284, in parse_input
    raise e
  File "/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/montepy/mcnp_problem.py", line 269, in parse_input
    obj = obj_parser(input)
  File "/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/montepy/cell.py", line 82, in __init__
    super().__init__(input, self._parser)
  File "/projects/experiment_analysis/tjlaboss/mcnpy_testing/numberead/montepy/mcnp_object.py", line 57, in __init__
    raise ParsingError(
montepy.errors.ParsingError:     testRead.imcnp, line 3

         2| C this is a comment
    >    3| read file=file2read.imcnp
          |  ^^^^ not expected here.
There was an error parsing "read".
sly: Syntax error at line 2, token=KEYWORD
@MicahGale
Copy link
Collaborator Author

Hmmm. I suspect the read might not be the issue here.

@MicahGale MicahGale added this to the Release-0.3 milestone Jan 16, 2024
@MicahGale MicahGale self-assigned this Jan 16, 2024
@MicahGale MicahGale added the parsers are hard Examples of where MCNP syntax is complicated and should be simplified. label Feb 13, 2024
MicahGale added a commit that referenced this issue Feb 15, 2024
@MicahGale MicahGale linked a pull request Feb 15, 2024 that will close this issue
@MicahGale MicahGale mentioned this issue Mar 9, 2024
1 task
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

Successfully merging a pull request may close this issue.

1 participant