java.lang.RuntimeException: Unexpected token 'a', Unexpected token 'a', Unexpected token 'a', Error at line: 1 column: 1
It includes the message from every parser which failed, even though the messages are identical, which obscures what is actually going on. At the very least, it should filter the messages so they are distinct, but I think the behavior is questionable, period.
One of the things I've found challenging with moderately complex parsers is getting a clear handle on their failure modes. There are a number of things about Parsatron that make debugging challenging.
Errors include the line and position of the input, but doesn't tell you about the parser in error. When dealing with a complex parser which calls other complex parsers, it is hard to determine which one is causing the error.
The way
(either …)merges errors makes it hard to even see what the cause of the problem was. For example, this simple parser:Produces this awful error:
It includes the message from every parser which failed, even though the messages are identical, which obscures what is actually going on. At the very least, it should filter the messages so they are distinct, but I think the behavior is questionable, period.
It would be terrific if the line of input which parsing failed on was printed on failure. It can be hard to orient yourself without this context. I know Parsatron can parse structured data, but the assumption that lines of text are the source is already baked in (position assumes parsing text from a file #24). May as well make the assumption worthwhile, I think.