jsonparse: Add basic JSON parser
Some TODO's left and this needs benchmarking.
This commit is contained in:
parent
aebe5a93dc
commit
7cdc02e399
8 changed files with 508 additions and 21 deletions
|
|
@ -81,7 +81,6 @@ static void fujson_fmt_str(pTHX_ fujson_fmt_ctx *ctx, const char *stri, size_t l
|
|||
fustr_write(&ctx->out, "\"", 1);
|
||||
}
|
||||
|
||||
/* All digits between 0 and 100, a trick I borrowed from the Zig stdlib. */
|
||||
static const char fujson_digits[] =
|
||||
"00010203040506070809"
|
||||
"10111213141516171819"
|
||||
|
|
@ -306,7 +305,7 @@ static SV *fujson_fmt_xs(pTHX_ I32 ax, I32 argc, SV *val) {
|
|||
if (ctx.out.maxlen == 0) ctx.out.maxlen = 1<<30;
|
||||
if (ctx.depth == 0) ctx.depth = 512;
|
||||
|
||||
fustr_init(&ctx.out, 128, ctx.out.maxlen);
|
||||
fustr_init(&ctx.out, sv_2mortal(newSV(128)), ctx.out.maxlen);
|
||||
fujson_fmt(aTHX_ &ctx, val);
|
||||
if (ctx.pretty >= 0) fustr_write(&ctx.out, "\n", 1);
|
||||
r = fustr_done(&ctx.out);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue