Split std/json's QUIRK_ALLOW_BACKSLASH_X in two

This commit is contained in:
Nigel Tao committed 2020-08-06 23:28:07 +10:00
1 parent d7e0133c0b
commit 1adbc9547f
7 files changed
+397 -276

No files matched your search

+3 -2
View File
@@ -16,6 +16,7 @@ pub status "#bad C0 control code"
pub status "#bad UTF-8"
pub status "#bad backslash-escape"
pub status "#bad input"
pub status "#bad quirk combination"
pub status "#unsupported number length"
pub status "#unsupported recursion depth"
@@ -123,7 +124,7 @@ pri const LUT_BACKSLASHES : array[256] base.u8 = [
// LUT_QUIRKY_BACKSLASHES_QUIRKS is discussed in the LUT_BACKSLASHES comment.
// The first element (index 0) is not used, but 8 is a round power of 2, so
// enforcing index-in-bounds is a simple "&7" operation.
pri const LUT_QUIRKY_BACKSLASHES_QUIRKS : array[8] base.u8[..= 0x09] = [
pri const LUT_QUIRKY_BACKSLASHES_QUIRKS : array[8] base.u8[..= 0x0A] = [
0,
// Uncommenting the following lines requires being able to define consts in
// terms of other consts, which could be non-trivial to specify and
@@ -134,7 +135,7 @@ pri const LUT_QUIRKY_BACKSLASHES_QUIRKS : array[8] base.u8[..= 0x09] = [
0x05, // (QUIRK_ALLOW_BACKSLASH_QUESTION_MARK - QUIRKS_BASE) as base.u8,
0x06, // (QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE - QUIRKS_BASE) as base.u8,
0x07, // (QUIRK_ALLOW_BACKSLASH_V - QUIRKS_BASE) as base.u8,
0x09, // (QUIRK_ALLOW_BACKSLASH_ZERO - QUIRKS_BASE) as base.u8,
0x0A, // (QUIRK_ALLOW_BACKSLASH_ZERO - QUIRKS_BASE) as base.u8,
]
// LUT_QUIRKY_BACKSLASHES_CHARS is discussed in the LUT_BACKSLASHES comment.
+90 -56
View File
@@ -20,6 +20,8 @@ pub struct decoder? implements base.token_decoder(
end_of_data : base.bool,
string_value_minor : base.u32[..= 0x1FF_FFFF],
util : base.utility,
)(
// stack is conceptually an array of bits, implemented as an array of u32.
@@ -92,6 +94,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
var backslash_x_length : base.u32[..= 0xFFFF]
var backslash_x_ok : base.u8
var backslash_x_value : base.u8
var backslash_x_string : base.u32
var uni4_ok : base.u8
@@ -121,6 +124,16 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
this.decode_leading?(dst: args.dst, src: args.src)
}
if this.quirks[QUIRK_ALLOW_BACKSLASH_X_AS_BYTES - QUIRKS_BASE] {
if this.quirks[QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS - QUIRKS_BASE] {
return "#bad quirk combination"
}
this.string_value_minor = (base.TOKEN__VBC__STRING << 21)
} else {
this.string_value_minor = (base.TOKEN__VBC__STRING << 21) |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8
}
expect = EXPECT_VALUE
while.outer true {
@@ -204,9 +217,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
// Emit the leading '"'.
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__DEFINITELY_ASCII |
base.TOKEN__VBD__STRING__CONVERT_0_DST_1_SRC_DROP,
continued: 1,
@@ -227,9 +239,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -260,9 +271,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > (0xFFFB - 4) {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length + 4)
@@ -280,9 +290,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length >= 0xFFFB {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: 0xFFFC)
@@ -296,9 +305,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length <> 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -310,9 +318,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -559,53 +566,88 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
}
// -------- END backslash-capital-u.
} else if (c == 'x') and
this.quirks[QUIRK_ALLOW_BACKSLASH_X - QUIRKS_BASE] {
} else if (c == 'x') {
// -------- BEGIN backslash-x
if args.src.available() < 4 {
if args.src.is_closed() {
return "#bad backslash-escape"
if this.quirks[QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS - QUIRKS_BASE] {
if args.src.available() < 4 {
if args.src.is_closed() {
return "#bad backslash-escape"
}
yield? base."$short read"
string_length = 0
char = 0
continue.string_loop_outer
}
yield? base."$short read"
string_length = 0
char = 0
continue.string_loop_outer
}
backslash_x_length = 0
while (backslash_x_length <= 0xFFFB) and (args.src.available() >= 4),
inv args.dst.available() > 0,
{
backslash_x_string = args.src.peek_u32le()
backslash_x_ok = 0x80
c = LUT_HEXADECIMAL_DIGITS[0xFF & (backslash_x_string >> 16)]
backslash_x_ok &= c
backslash_x_value = (c & 0x0F) << 4
c = LUT_HEXADECIMAL_DIGITS[0xFF & (backslash_x_string >> 24)]
backslash_x_ok &= c
backslash_x_value |= (c & 0x0F)
if (backslash_x_ok == 0) or
((backslash_x_string & 0xFFFF) <> 0x785C) {
// It wasn't "\\x34", for some hexadecimal
// digits "34".
break
return "#bad backslash-escape"
}
args.src.skip_u32_fast!(actual: 4, worst_case: 4)
backslash_x_length += 4
} endwhile
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__UNICODE_CODE_POINT << 21) |
(backslash_x_value as base.u32),
continued: 1,
length: 4)
continue.string_loop_outer
} else if this.quirks[QUIRK_ALLOW_BACKSLASH_X_AS_BYTES - QUIRKS_BASE] {
if args.src.available() < 4 {
if args.src.is_closed() {
return "#bad backslash-escape"
}
yield? base."$short read"
string_length = 0
char = 0
continue.string_loop_outer
}
if backslash_x_length == 0 {
return "#bad backslash-escape"
backslash_x_length = 0
while (backslash_x_length <= 0xFFFB) and (args.src.available() >= 4),
inv args.dst.available() > 0,
{
backslash_x_string = args.src.peek_u32le()
backslash_x_ok = 0x80
c = LUT_HEXADECIMAL_DIGITS[0xFF & (backslash_x_string >> 16)]
backslash_x_ok &= c
c = LUT_HEXADECIMAL_DIGITS[0xFF & (backslash_x_string >> 24)]
backslash_x_ok &= c
if (backslash_x_ok == 0) or
((backslash_x_string & 0xFFFF) <> 0x785C) {
// It wasn't "\\x34", for some hexadecimal
// digits "34".
break
}
args.src.skip_u32_fast!(actual: 4, worst_case: 4)
backslash_x_length += 4
} endwhile
if backslash_x_length == 0 {
return "#bad backslash-escape"
}
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_4_SRC_BACKSLASH_X,
continued: 1,
length: backslash_x_length)
continue.string_loop_outer
}
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_4_SRC_BACKSLASH_X,
continued: 1,
length: backslash_x_length)
continue.string_loop_outer
// -------- END backslash-x
}
@@ -616,9 +658,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -653,9 +694,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length >= 0xFFF8 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length + 2)
@@ -671,9 +711,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -712,9 +751,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length >= 0xFFF8 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length + 3)
@@ -731,9 +769,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -771,9 +808,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length >= 0xFFF8 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length + 4)
@@ -789,9 +825,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
if string_length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__CONVERT_1_DST_1_SRC_COPY,
continued: 1,
length: string_length)
@@ -843,9 +878,8 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, wor
args.src.skip_u32_fast!(actual: 1, worst_case: 1)
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__STRING << 21) |
value_minor: this.string_value_minor |
base.TOKEN__VBD__STRING__DEFINITELY_UTF_8 |
base.TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8 |
base.TOKEN__VBD__STRING__DEFINITELY_ASCII |
base.TOKEN__VBD__STRING__CONVERT_0_DST_1_SRC_DROP,
continued: 0,
+30 -30
View File
@@ -75,35 +75,35 @@ pub const QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE : base.u32 = 0x4909_9400 | 0x06
// character.
pub const QUIRK_ALLOW_BACKSLASH_V : base.u32 = 0x4909_9400 | 0x07
// When this quirk is enabled, e.g. "abc\xeFz" is accepted as a JSON string,
// There are exactly 2 encoded bytes after each "\x".
// When this quirk is enabled, e.g. "abc\xeFz" is accepted as a JSON string. It
// decodes to 5 bytes: 0x61, 0x62, 0x63, 0xEF and 0x7A. Decoded strings are
// byte strings, no longer guaranteed to be valid UTF-8 and even if the overall
// byte string is valid UTF-8, tokens are also no longer guaranteed to split on
// UTF-8 boundaries.
//
// "\x", "\x9", "\x9$" and "\X99" are all still rejected.
// It is up to the caller whether and how to run UTF-8 validation.
//
// It is up to the caller how to interpret the two hexadecimal digits. There
// are two sensible choices: as-a-byte or as-a-Unicode-code-point.
// There are exactly 2 encoded bytes after each "\x". "\x", "\x9", "\x9$" and
// "\X99" are all still rejected.
//
// As-a-byte means decoding to 5 bytes: 0x61, 0x62, 0x63, 0xEF and 0x7A.
// Decoded strings are byte strings, no longer guaranteed to be valid UTF-8 and
// even if the overall byte string is valid UTF-8, tokens are also no longer
// guaranteed to split on UTF-8 boundaries.
// This quirk cannot be combined with QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS.
pub const QUIRK_ALLOW_BACKSLASH_X_AS_BYTES : base.u32 = 0x4909_9400 | 0x08
// When this quirk is enabled, e.g. "abc\xeFz" is accepted as a JSON string. It
// decodes to 6 bytes: 0x61, 0x62, 0x63, 0xC3, 0xAF and 0x7A. The UTF-8
// encoding of U+00EF LATIN SMALL LETTER I WITH DIAERESIS is the two byte
// sequence (0xC3, 0xAF). Decoded strings are still valid UTF-8 and tokens
// still split on UTF-8 boundaries.
//
// As-a-Unicode-code-point means decoding to 6 bytes: 0x61, 0x62, 0x63, 0xC3,
// 0xAF and 0x7A. The UTF-8 encoding of U+00EF LATIN SMALL LETTER I WITH
// DIAERESIS is the two byte sequence (0xC3, 0xAF). Decoded strings are still
// valid UTF-8 and tokens still split on UTF-8 boundaries.
// There are exactly 2 encoded bytes after each "\x". "\x", "\x9", "\x9$" and
// "\X99" are all still rejected.
//
// The parser cannot know which interpretation the caller will choose, so it
// will still mark its string tokens with TOKEN__VBD__STRING__DEFINITELY_UTF_8
// and TOKEN__VBD__STRING__CHAIN_MUST_BE_UTF_8, like all other JSON string
// tokens, even though the as-a-byte interpretation can result in invalid
// UTF-8. If the caller chooses as-a-byte, it is up to the caller whether and
// how to run UTF-8 validation.
pub const QUIRK_ALLOW_BACKSLASH_X : base.u32 = 0x4909_9400 | 0x08
// This quirk cannot be combined with QUIRK_ALLOW_BACKSLASH_X_AS_BYTES.
pub const QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS : base.u32 = 0x4909_9400 | 0x09
// When this quirk is enabled, e.g. "abc\0z" is accepted as a JSON string,
// equivalent to "abc\u0000z", containing an ASCII NUL control character.
pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4909_9400 | 0x09
pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4909_9400 | 0x0A
// When this quirk is enabled, "/* C/C++ style block comments */" are accepted
// anywhere whitespace would be, although see the QUIRK_ALLOW_TRAILING_NEW_LINE
@@ -111,7 +111,7 @@ pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4909_9400 | 0x09
//
// They produce WUFFS_BASE__TOKEN__VBD__FILLER__COMMENT_BLOCK tokens. The token
// chain's source bytes includes the starting "/*" and the ending "*/".
pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4909_9400 | 0x0A
pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4909_9400 | 0x0B
// When this quirk is enabled, "// C/C++ style line comments\n" are accepted
// anywhere whitespace would be, although see the QUIRK_ALLOW_TRAILING_NEW_LINE
@@ -126,7 +126,7 @@ pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4909_9400 | 0x0A
// Even if the line comments are on consecutive lines, each line comment is a
// separate token chain. There may be whitespace tokens between one line
// comment's ending "\n" and the next one's starting "//".
pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4909_9400 | 0x0B
pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4909_9400 | 0x0C
// When this quirk is enabled, there may be a comma after the final array
// element or object key-value pair and before the closing "]" or "}". A comma
@@ -135,12 +135,12 @@ pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4909_9400 | 0x0B
//
// For example, `[1,]`, `[1,2,3,]` and `{"k":"v",}` all become acceptable, but
// `[,]`, `{,}` and `{"k",:"v"}` are still rejected.
pub const QUIRK_ALLOW_EXTRA_COMMA : base.u32 = 0x4909_9400 | 0x0C
pub const QUIRK_ALLOW_EXTRA_COMMA : base.u32 = 0x4909_9400 | 0x0D
// When this quirk is enabled, "inf", "Infinity", "NAN" and their
// case-insensitive variants, optionally preceded immediately by "-" or "+",
// are accepted anywhere a JSON number would be.
pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4909_9400 | 0x0D
pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4909_9400 | 0x0E
// When this quirk is enabled, the input byte stream may optionally start with
// "\x1E" (the ASCII Record Separator control character). That byte is skipped
@@ -151,7 +151,7 @@ pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4909_9400 | 0x0D
//
// When combined with QUIRK_ALLOW_TRAILING_NEW_LINE, this format is also known
// as RFC 7464, Json Text Sequences and MIME type "application/json-seq".
pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4909_9400 | 0x0E
pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4909_9400 | 0x0F
// When this quirk is enabled, the input byte stream may optionally start with
// "\xEF\xBB\xBF", the UTF-8 encoding of the Unicode BOM (Byte Order Mark).
@@ -159,7 +159,7 @@ pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4909_9400 |
//
// When combined with QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR, either mark
// may come first in the byte stream.
pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4909_9400 | 0x0F
pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4909_9400 | 0x10
// When this quirk is enabled, following a successful decoding of a top-level
// JSON value, any trailing whitespace (ASCII characters 0x09, 0x0A, 0x0D or
@@ -195,7 +195,7 @@ pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4909_9400 |
// end-of-file or '\n' is encountered. Treating this as an error avoids any
// ambiguity in accounting for new lines within a block comment or ending a
// line comment.
pub const QUIRK_ALLOW_TRAILING_NEW_LINE : base.u32 = 0x4909_9400 | 0x10
pub const QUIRK_ALLOW_TRAILING_NEW_LINE : base.u32 = 0x4909_9400 | 0x11
// When this quirk is enabled, invalid UTF-8 inside a JSON string is accepted.
// Each byte of invalid UTF-8 is equivalent to "\uFFFD", the Unicode
@@ -211,6 +211,6 @@ pub const QUIRK_ALLOW_TRAILING_NEW_LINE : base.u32 = 0x4909_9400 | 0x10
// When combined with QUIRK_ALLOW_BACKSLASH_CAPITAL_U, a "\U12345678" 10-byte
// unit that is an invalid Unicode code point (i.e. in the range U+D800 ..=
// U+DFFF or above U+10FFFF) is similarly replaced with U+FFFD.
pub const QUIRK_REPLACE_INVALID_UNICODE : base.u32 = 0x4909_9400 | 0x11
pub const QUIRK_REPLACE_INVALID_UNICODE : base.u32 = 0x4909_9400 | 0x12
pri const QUIRKS_COUNT : base.u32 = 0x12
pri const QUIRKS_COUNT : base.u32 = 0x13