It is getting annoying to have to determine where the code is broken even when writing (the longer) tests. Usually this is because I still naturally forget semicolons, especially where blocks end (see #19).
First, determine how to test errors that come out of Nom. Ideally we integrate them into test files like with the other tests.
Next, develop a system for displaying nice errors nicely. I've been poking around the rust compiler, and I like the way things are handled there. Ideally, we can put the wording of errors in a separate file, and we can emit them with a single line of code wherever they are spotted.
Finally, ensure Nom pretty prints an error whenever it cannot parse. It should give the location where the parse fails. I think it would be nice if we could print and mark the line where a failure occurs.
We already know how to get the "possible next tokens" when a parse fails. I think a brief, heuristic analysis of this should be enough to make a suggestion. In particular, we should be able to suggest things like commas, semicolons, and parentheses/brackets/braces.
It is getting annoying to have to determine where the code is broken even when writing (the longer) tests. Usually this is because I still naturally forget semicolons, especially where blocks end (see #19).
First, determine how to test errors that come out of Nom. Ideally we integrate them into test files like with the other tests.
Next, develop a system for displaying nice errors nicely. I've been poking around the rust compiler, and I like the way things are handled there. Ideally, we can put the wording of errors in a separate file, and we can emit them with a single line of code wherever they are spotted.
Finally, ensure Nom pretty prints an error whenever it cannot parse. It should give the location where the parse fails. I think it would be nice if we could print and mark the line where a failure occurs.
We already know how to get the "possible next tokens" when a parse fails. I think a brief, heuristic analysis of this should be enough to make a suggestion. In particular, we should be able to suggest things like commas, semicolons, and parentheses/brackets/braces.