Improve error reporting APIs for full-fidelity parser.
Summary:
The FFP uses a two-pass approach to producing errors. In the initial parsing pass, errors are reported in situations where the parser encounters something unexpected and must attempt to recover back to a known state. The first pass accepts many syntactically illegal programs, in the interests of (1) keeping the parser simpler, and (2) putting error detection code into one place. The second pass then looks for additional errors in the parse tree.
The APIs to get at the error information were confusing and weak. I've created three entrypoints to the full_fidelity_parser_errors module.
The first gives minimal error information. If there are first-pass errors, it gives them, suppressing what it thinks might be "cascading" errors. (Like "missing expression" immediately followed by "missing semicolon" at the same location. If there are no first-pass errors then it gives second pass errors.
The second gives typical error information; it gives first and second pass errors, suppressing cascading errors.
The third gives all the errors deduced by both passes.
Note that this change also has the nice property that errors are now always reported sorted by source-code order.
Reviewed By: oulgen
Differential Revision:
D5797899
fbshipit-source-id:
6d29cd94a58de69277541ad8664ea4f389288b8e