apollo-rs icon indicating copy to clipboard operation
apollo-rs copied to clipboard

create multiple errors when lexing a string value

Open lrlna opened this issue 3 years ago • 1 comments

When lexing a String Value we can have three different error types:

  • unterminated string
  • unexpected escape character
  • unexpected line terminator

If there is a unexpected escape character or unexpected line terminator and also the string value is unterminated, we only get the unterminated string error message, as the errors get overridden.

For example:

let gql = "\"\n hello"
let lexer = Lexer::new(gql);

produces only ERROR@0:7 "unterminated string value" "hello error, where it would be really helpful for users to also have the unexpected line terminator error as well.

lrlna avatar Sep 30 '22 13:09 lrlna

This is also relevant for escape sequences:

"\u123 \u0008 \uZZZZ"

Now you get an error for the whole string, it would be better if we could point to only the incorrect parts.

goto-bus-stop avatar May 02 '23 07:05 goto-bus-stop