mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Add std/json quirk_allow_backslash_new_line
This commit is contained in:
1 parent
2db72dabe5
commit
6f67bbc4b2
4 files changed
+22
No files matched your search
@@ -6054,6 +6054,8 @@ extern const char* wuffs_json__error__unsupported_recursion_depth;
|
||||
|
||||
#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_E 1225364483
|
||||
|
||||
#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_NEW_LINE 1225364484
|
||||
|
||||
#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_QUESTION_MARK 1225364485
|
||||
|
||||
#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE 1225364486
|
||||
@@ -21045,6 +21047,8 @@ wuffs_json__decoder__set_quirk_enabled(wuffs_json__decoder* self,
|
||||
self->private_impl.f_quirk_enabled_allow_backslash_capital_u = a_enabled;
|
||||
} else if (a_quirk == 1225364483) {
|
||||
self->private_impl.f_quirk_enabled_allow_backslash_etc[2] = a_enabled;
|
||||
} else if (a_quirk == 1225364484) {
|
||||
self->private_impl.f_quirk_enabled_allow_backslash_etc[3] = a_enabled;
|
||||
} else if (a_quirk == 1225364485) {
|
||||
self->private_impl.f_quirk_enabled_allow_backslash_etc[4] = a_enabled;
|
||||
} else if (a_quirk == 1225364486) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1428,6 +1428,11 @@ test_wuffs_json_decode_quirk_allow_backslash_etc() {
|
||||
.str = "\"\\e\"",
|
||||
.quirk = WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_E,
|
||||
},
|
||||
{
|
||||
.want = 0x0A,
|
||||
.str = "\"\\\n\"",
|
||||
.quirk = WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_NEW_LINE,
|
||||
},
|
||||
{
|
||||
.want = 0x3F,
|
||||
.str = "\"\\?\"",
|
||||
|
||||
Reference in new issue
Block a user