uwol / proleap-cobol-parser

ProLeap ANTLR4-based parser for COBOL
MIT License
136 stars 74 forks source link

Parser errors should throw an exception #43

Closed albertolovato closed 6 years ago

albertolovato commented 6 years ago

Parser errors that compromise subsequent parsing should throw an exception.

For example, when the parser logs the error line 8:17 no viable alternative at input 'x <>' for a condition with unrecognized operator x <> 5, the visitor finds non-existent sections at 8:15 and 8:20.

uwol commented 6 years ago

Added in 71846aa4250d3abe487fd860f6b8b324d9c4d503. Now the parser throws a RuntimeException in case on any syntax error.

So from now on the syntax/grammar has to be 100% correct, or the parser will throw an exception. If you encounter such an exception with your COBOL code, please let me know so I can fix the grammar!