@@ -954,34 +954,15 @@ where
954
954
955
955
match ch {
956
956
b'"' | b'\\' | b'/' | b'b' | b'f' | b'n' | b'r' | b't' => { }
957
- b'u' => match tri ! ( read. decode_hex_escape( ) ) {
958
- 0xDC00 ..=0xDFFF => {
959
- return error ( read, ErrorCode :: LoneLeadingSurrogateInHexEscape ) ;
960
- }
961
-
962
- // Non-BMP characters are encoded as a sequence of
963
- // two hex escapes, representing UTF-16 surrogates.
964
- n1 @ 0xD800 ..=0xDBFF => {
965
- if tri ! ( next_or_eof( read) ) != b'\\' {
966
- return error ( read, ErrorCode :: UnexpectedEndOfHexEscape ) ;
967
- }
968
- if tri ! ( next_or_eof( read) ) != b'u' {
969
- return error ( read, ErrorCode :: UnexpectedEndOfHexEscape ) ;
970
- }
971
-
972
- let n2 = tri ! ( read. decode_hex_escape( ) ) ;
973
- if n2 < 0xDC00 || n2 > 0xDFFF {
974
- return error ( read, ErrorCode :: LoneLeadingSurrogateInHexEscape ) ;
975
- }
976
-
977
- let n = ( ( ( n1 - 0xD800 ) as u32 ) << 10 | ( n2 - 0xDC00 ) as u32 ) + 0x1_0000 ;
978
- if char:: from_u32 ( n) . is_none ( ) {
979
- return error ( read, ErrorCode :: InvalidUnicodeCodePoint ) ;
980
- }
981
- }
957
+ b'u' => {
958
+ // At this point we don't care if the codepoint is valid. We just
959
+ // want to consume it. We don't actually know what is valid or not
960
+ // at this point, because that depends on if this string will
961
+ // ultimately be parsed into a string or a byte buffer in the "real"
962
+ // parse.
982
963
983
- _ => { }
984
- } ,
964
+ tri ! ( read . decode_hex_escape ( ) ) ;
965
+ }
985
966
_ => {
986
967
return error ( read, ErrorCode :: InvalidEscape ) ;
987
968
}
0 commit comments