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

create multiple errors when lexing a string value #319

Open
lrlna opened this issue Sep 30, 2022 · 1 comment
Open

create multiple errors when lexing a string value #319

lrlna opened this issue Sep 30, 2022 · 1 comment
Assignees

Comments

@lrlna
Copy link
Member

lrlna commented Sep 30, 2022

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.

@goto-bus-stop goto-bus-stop self-assigned this Nov 2, 2022
@goto-bus-stop
Copy link
Member

goto-bus-stop commented May 2, 2023

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.

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

No branches or pull requests

2 participants