Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report multiple lexical errors. Fixes #144 #145

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Report multiple lexical errors. Fixes #144 #145

wants to merge 4 commits into from

Conversation

gustavoaca1997
Copy link

@gustavoaca1997 gustavoaca1997 commented Oct 3, 2019

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 gustavoaca1997 changed the title Fixes #144 Report multiple lexical errors. Fixes #144 Oct 3, 2019
Comment on lines +302 to +308
#if defined(ALEX_BASIC)
alexSetInput (p, x, tail s)
#elif !defined(ALEX_MONAD_BYTESTRING)
alexSetInput (p, x, y, tail s)
#else
alexSetInput (p, x, ByteString.tail s, y)
#endif
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @simonmar would prefer another approach for shifting instead of using tail function. I'd be glad hearing any suggestion ;)

@simonmar
Copy link
Member

simonmar commented Oct 7, 2019

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.

@gustavoaca1997
Copy link
Author

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 🙂

@simonmar
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants