mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Tweak example/jsonfindptrs -input-etc flags
This commit is contained in:
1 parent
9132dd6e2e
commit
0a5940d399
2 files changed
+26
-5
No files matched your search
@@ -105,7 +105,12 @@ static const char* g_usage =
|
|||||||
"comma after the final element of a JSON list or dictionary.\n"
|
"comma after the final element of a JSON list or dictionary.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The -input-allow-inf-nan-numbers flag allows non-finite floating point\n"
|
"The -input-allow-inf-nan-numbers flag allows non-finite floating point\n"
|
||||||
"numbers (infinities and not-a-numbers) within JSON input.";
|
"numbers (infinities and not-a-numbers) within JSON input.\n"
|
||||||
|
"\n"
|
||||||
|
"----\n"
|
||||||
|
"\n"
|
||||||
|
"The JSON specification permits implementations to set their own maximum\n"
|
||||||
|
"input depth. This JSON implementation sets it to 1024.";
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ static const char* g_usage =
|
|||||||
"\n"
|
"\n"
|
||||||
"Flags:\n"
|
"Flags:\n"
|
||||||
" -d=NUM -max-output-depth=NUM\n"
|
" -d=NUM -max-output-depth=NUM\n"
|
||||||
" -input-json-extra-comma\n"
|
" -input-allow-comments\n"
|
||||||
|
" -input-allow-extra-comma\n"
|
||||||
|
" -input-allow-inf-nan-numbers\n"
|
||||||
" -strict-json-pointer-syntax\n"
|
" -strict-json-pointer-syntax\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The input.json filename is optional. If absent, it reads from stdin.\n"
|
"The input.json filename is optional. If absent, it reads from stdin.\n"
|
||||||
@@ -151,9 +153,15 @@ static const char* g_usage =
|
|||||||
"This JSON implementation also rejects integer values outside ±M, where\n"
|
"This JSON implementation also rejects integer values outside ±M, where\n"
|
||||||
"M is ((1<<53)-1), also known as JavaScript's Number.MAX_SAFE_INTEGER.\n"
|
"M is ((1<<53)-1), also known as JavaScript's Number.MAX_SAFE_INTEGER.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The -input-json-extra-comma flag allows input like \"[1,2,]\", with a\n"
|
"The -input-allow-comments flag allows \"/*slash-star*/\" and\n"
|
||||||
|
"\"//slash-slash\" C-style comments within JSON input.\n"
|
||||||
|
"\n"
|
||||||
|
"The -input-allow-extra-comma flag allows input like \"[1,2,]\", with a\n"
|
||||||
"comma after the final element of a JSON list or dictionary.\n"
|
"comma after the final element of a JSON list or dictionary.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
"The -input-allow-inf-nan-numbers flag allows non-finite floating point\n"
|
||||||
|
"numbers (infinities and not-a-numbers) within JSON input.\n"
|
||||||
|
"\n"
|
||||||
"----\n"
|
"----\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The -strict-json-pointer-syntax flag restricts the output lines to\n"
|
"The -strict-json-pointer-syntax flag restricts the output lines to\n"
|
||||||
@@ -184,7 +192,6 @@ struct {
|
|||||||
int remaining_argc;
|
int remaining_argc;
|
||||||
char** remaining_argv;
|
char** remaining_argv;
|
||||||
|
|
||||||
bool input_json_extra_comma;
|
|
||||||
uint32_t max_output_depth;
|
uint32_t max_output_depth;
|
||||||
bool strict_json_pointer_syntax;
|
bool strict_json_pointer_syntax;
|
||||||
} g_flags = {0};
|
} g_flags = {0};
|
||||||
@@ -229,10 +236,19 @@ parse_flags(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
return g_usage;
|
return g_usage;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "input-json-extra-comma")) {
|
if (!strcmp(arg, "input-allow-comments")) {
|
||||||
|
g_quirks.push_back(WUFFS_JSON__QUIRK_ALLOW_COMMENT_BLOCK);
|
||||||
|
g_quirks.push_back(WUFFS_JSON__QUIRK_ALLOW_COMMENT_LINE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strcmp(arg, "input-allow-extra-comma")) {
|
||||||
g_quirks.push_back(WUFFS_JSON__QUIRK_ALLOW_EXTRA_COMMA);
|
g_quirks.push_back(WUFFS_JSON__QUIRK_ALLOW_EXTRA_COMMA);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "input-allow-inf-nan-numbers")) {
|
||||||
|
g_quirks.push_back(WUFFS_JSON__QUIRK_ALLOW_INF_NAN_NUMBERS);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(arg, "strict-json-pointer-syntax")) {
|
if (!strcmp(arg, "strict-json-pointer-syntax")) {
|
||||||
g_flags.strict_json_pointer_syntax = true;
|
g_flags.strict_json_pointer_syntax = true;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in new issue
Block a user