Fix warnings and fatal parsing errors
This MR improves upon !272 (merged)
- More errors are marked as non-fatal.
- The last fatal error is no longer discarded when there are non-fatal errors. The problem was that the callers did not append the fatal error to accumulated non-fatal errors.
In the test case, I now check for correct handling of warnings, warnings under -Werror=
, non-fatal errors, and fatal errors.
To achieve this, I changed the PFailed
constructor of P
to return PState
. It is a nice simplification, as now P
is clearly isomorphic to StateT PState Maybe
, making it easier to reason about it.
I also did some renaming, making it clear which parse errors are fatal and which ones are not.