-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(parser): emit lexer error on escaped surrogate to avoid panic (#658)
* fix(parser): emit lexer error on escaped surrogate to avoid panic Fixes #608 * Changelog
- Loading branch information
1 parent
a922484
commit 7719507
Showing
8 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
crates/apollo-parser/test_data/lexer/err/0030_escaped_surrogate.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# TODO: move these cases back to ok/0004_string_value.graphql when | ||
# https://github.com/apollographql/apollo-rs/issues/657 is implemented | ||
"string with unicode surrogate pair escape \uD83D\uDE00" | ||
"string with minimal surrogate pair escape \uD800\uDC00" | ||
"string with maximal surrogate pair escape \uDBFF\uDFFF" | ||
|
||
# TODO: emit two errors: https://github.com/apollographql/apollo-rs/issues/319 | ||
"split pair \uD83D \uDE00" | ||
|
||
"Backwards pair \uDE00\uD83D" | ||
"Lone lead surrogate \uD83E" | ||
"Lone trail surrogate \uDD80" |
21 changes: 21 additions & 0 deletions
21
crates/apollo-parser/test_data/lexer/err/0030_escaped_surrogate.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
COMMENT@0:66 "# TODO: move these cases back to ok/0004_string_value.graphql when" | ||
WHITESPACE@66:67 "\n" | ||
COMMENT@67:137 "# https://github.com/apollographql/apollo-rs/issues/657 is implemented" | ||
WHITESPACE@137:138 "\n" | ||
ERROR@138:194 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "string with unicode surrogate pair escape \uD83D\uDE00" | ||
WHITESPACE@194:195 "\n" | ||
ERROR@195:251 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "string with minimal surrogate pair escape \uD800\uDC00" | ||
WHITESPACE@251:252 "\n" | ||
ERROR@252:308 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "string with maximal surrogate pair escape \uDBFF\uDFFF" | ||
WHITESPACE@308:310 "\n\n" | ||
COMMENT@310:388 "# TODO: emit two errors: https://github.com/apollographql/apollo-rs/issues/319" | ||
WHITESPACE@388:389 "\n" | ||
ERROR@389:415 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "split pair \uD83D \uDE00" | ||
WHITESPACE@415:417 "\n\n" | ||
ERROR@417:446 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "Backwards pair \uDE00\uD83D" | ||
WHITESPACE@446:447 "\n" | ||
ERROR@447:475 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "Lone lead surrogate \uD83E" | ||
WHITESPACE@475:476 "\n" | ||
ERROR@476:505 "surrogate code point is invalid in unicode escape sequence (paired surrogate not supported yet: https://github.com/apollographql/apollo-rs/issues/657)" "Lone trail surrogate \uDD80" | ||
WHITESPACE@505:506 "\n" | ||
EOF@506:506 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters