Add std/json quirk_allow_backslash_new_line

This commit is contained in:
Nigel Tao committed 2020-04-07 17:24:31 +10:00
1 parent 2db72dabe5
commit 6f67bbc4b2
4 files changed
+22

No files matched your search

+2
View File
@@ -73,6 +73,8 @@ pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
this.quirk_enabled_allow_backslash_capital_u = args.enabled
} else if args.quirk == quirk_allow_backslash_e {
this.quirk_enabled_allow_backslash_etc[2] = args.enabled
} else if args.quirk == quirk_allow_backslash_new_line {
this.quirk_enabled_allow_backslash_etc[3] = args.enabled
} else if args.quirk == quirk_allow_backslash_question_mark {
this.quirk_enabled_allow_backslash_etc[4] = args.enabled
} else if args.quirk == quirk_allow_backslash_single_quote {
+11
View File
@@ -36,6 +36,17 @@ pub const quirk_allow_backslash_capital_u base.u32 = 0x4909_9400 | 0x02
// equivalent to "abc\u001Bz", containing an ASCII Escape control character.
pub const quirk_allow_backslash_e base.u32 = 0x4909_9400 | 0x03
// When this quirk is enabled, e.g. ("abc\
// z") is accepted as a JSON string, equivalent to "abc\nz".
//
// This allows for multi-line strings, if each new line is preceded by a
// backslash. This doesn't combine per se with quirk_allow_ascii_control_codes,
// but they have similar consequences.
//
// Any indentation following a new line is not stripped, but remains part of
// the decoded string.
pub const quirk_allow_backslash_new_line base.u32 = 0x4909_9400 | 0x04
// When this quirk is enabled, e.g. "abc\?z" is accepted as a JSON string,
// equivalent to "abc?z".
pub const quirk_allow_backslash_question_mark base.u32 = 0x4909_9400 | 0x05