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

Incorrect spans after a lexer error #450

Open
goto-bus-stop opened this issue Feb 8, 2023 · 0 comments
Open

Incorrect spans after a lexer error #450

goto-bus-stop opened this issue Feb 8, 2023 · 0 comments
Assignees
Labels
apollo-parser bug Something isn't working

Comments

@goto-bus-stop
Copy link
Member

Related to #325 and #446

If we have some input with completely invalid characters, for example:

type A {
<<<<<<
  field(arg1: Int): String
======
  field(arg1: Boolean): String
>>>>>>
}

< is not a token in any circumstance, so the lexer emits an error. The parser picks up this error and re-emits it, but it does not account for the error token in the parse tree. So, like in #446, lexer errors cause misaligned spans for any nodes that come after.

This could probably be addressed similarly to #446, by propagating lexer errors into the tree with the ERROR syntax node kind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-parser bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant