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

fix(parser): fix lexing escape sequences in block strings #638

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

goto-bus-stop
Copy link
Member

@goto-bus-stop goto-bus-stop commented Aug 28, 2023

This is the most basic fix for #632, but there are other parse bugs left that may be we should address with a bunch more tests. This fixes a regression in apollo-parser 0.6.0.

Block strings are not meant to support escape sequences in general. But the lexer handled strings and block strings the same way, so an invalid escape sequence in a block string
would cause a lex error. This rips out all the escape sequence handling from block strings except for \""".

I'm running it through the corpus of Apollo schemas right now, about 75% done without problems, so it looks good.

@goto-bus-stop goto-bus-stop changed the title Fix lexing escape sequences in block strings fix(parser): fix lexing escape sequences in block strings Aug 28, 2023
@goto-bus-stop goto-bus-stop self-assigned this Aug 28, 2023
// sequence.
if self.eatc('"') {
self.eatc('"');
}
Copy link
Member Author

@goto-bus-stop goto-bus-stop Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a test below to make sure """\"""""" is correctly lexed as a block string containing only \""". Previously it would eat too many ".

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

Successfully merging this pull request may close these issues.

2 participants