alex icon indicating copy to clipboard operation
alex copied to clipboard

Report multiple lexical errors. Fixes #144

Open gustavoaca1997 opened this issue 6 years ago • 3 comments
trafficstars

I have this idea for #144. What do you think, @simonmar ? A problem I don't know how to solve is that it is only reporting one lexical error per line.

gustavoaca1997 avatar Oct 03 '19 08:10 gustavoaca1997

It's not clear to me that this is a good idea in general. We don't know if continuing after an error is a sensible thing to do at all, so it would only be a heuristic, which makes me concerned about adding this behavoiur to the core of Alex.

simonmar avatar Oct 07 '19 07:10 simonmar

Could you explain to me more what do you mean by "sensible thing"? And thanks for the reply. I'd be glad helping in any other good first issue 🙂

gustavoaca1997 avatar Oct 07 '19 11:10 gustavoaca1997

Take an example like this: ... "\xfffffff" ... with a Haskell lexer. The character constant in the string is a lexical error because it's out of range, but if we report the error and continue, the lexer doesn't know we're inside a string, so it will be out of step and will probably report a ton more errors for the rest of the input.

simonmar avatar Oct 11 '19 10:10 simonmar