MiSawa / xq

Pure rust implementation of jq
MIT License
318 stars 18 forks source link

Handle surrogate pairs in lexer #123

Closed MiSawa closed 2 years ago

MiSawa commented 2 years ago
$ xq -rn '"\uD83E\uDD14"'
Error: compile query

Caused by:
    ParseError(LexerError("LexerError { location: Loc { line: 0, col: 7, byte_idx: 7 }, kind: Custom(InvalidUnicodeScalar(55358)) }"))
[1]    2023830 exit 1     xq -rn '"\uD83E\uDD14"'

Maybe we need an owned string for ("\\u" $hex_digit $hex_digit $hex_digit $hex_digit)+ Or have a lexer rule for "\\u" 'D' ['8'-'9' 'a'-'d' 'A'-'D'] $hex_digit $hex_digit "\\u" 'D' ['8'-'9' 'a'-'d' 'A'-'D'] $hex_digit $hex_digit