apollo-rs
apollo-rs copied to clipboard
Incorrect spans after a lexer error
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.