-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Include token type in unexpected token error message #265
Comments
I think it would be good to add the token type if you'd like to send a PR. |
Maybe something like |
I had a bit of a dig into this and unfortunately it would not be straightforward to fix this. The human-readable token names are contained in the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sometimes I get an unexpected parsing error like
and I get confused because
group
should be a valid next token in my grammar. However, it turns out thatgroup
is a Keyword token in my lexer, not an Identifier token like I wanted. Upon realizing that the token was of the wrong type, the error makes sense now. However, realizing that the token type was the problem can take a while, especially if the lexer is complicated or contains overlapping rules, because the error message doesn't give any indication of the types of the tokens involved (found OR expected). I think that including the token types in the error message would help people facing this issue solve it much more quickly.The text was updated successfully, but these errors were encountered: