Parser error interpretation
Issue #170
resolved
After writing a machine with a muspoiler named 'ms', the following message was displayed:
main> Using input file : test.gmad
parser> reading file /Users/williamshields/bdsim/medical/working_dir/testScripts/test_components.gmad
syntax error at line 6 of file /Users/williamshields/bdsim/medical/working_dir/testScripts/test_components.gmad
symbol ':' unexpected
The file test.gmad is attached.
Now I know that 'ms' is actually reserved for milliseconds, however I found that the error appearing as an unexpected ':' was somewhat misleading. Could this be changed to return an error stating that names such as 'ms' are reserved/protected names?
Comments (3)
-
-
- edited description
-
- changed status to resolved
fix issue
#170: give meaningful error when defining an element with already defined variable and add tests→ <<cset 0cdffb3bbbfa>>
- Log in to comment
Many thanks for the reporting. You are absolutely right that this is unclear (it is the default message for when the parser doesn't know what to do with the syntax), and that the message should be improved. I implemented it with the following error message:
I also added this when defining an element with an already defined variable or function.