Vlek/roll-cli

Pretty error messages for input parsing issues

Vlek opened this issue · 1 comments

Vlek commented

It would be nice if the error handler can output nicely formatted messages to point directly to the operation that caused the parser not to be able to work.

Example:

An exception occurred attempting to parse the input:
1 +
  ^
The addition operator expects a left and a right number.
Vlek commented

I think this is the way to do it: https://pyparsing-docs.readthedocs.io/en/latest/pyparsing.html#pyparsing.ParserElement.setFailAction

Already added a stub to the parser for an overall fail catch.