Tweak json.decoder.decode_comment

This commit is contained in:
Nigel Tao committed 2022-01-25 21:24:54 +11:00
1 parent 656c0bdf92
commit 5a93c63f0a
2 files changed
+43 -27

No files matched your search

+17 -13
View File
@@ -34094,12 +34094,6 @@ wuffs_json__decoder__decode_comment(
v_length = 2;
label__comment_block__continue:;
while (true) {
if (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(3);
v_length = 0;
goto label__comment_block__continue;
}
while (true) {
if (((uint64_t)(io2_a_src - iop_a_src)) <= 1) {
if (v_length > 0) {
@@ -34113,7 +34107,11 @@ wuffs_json__decoder__decode_comment(
goto exit;
}
status = wuffs_base__make_status(wuffs_base__suspension__short_read);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(4);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(3);
while (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(4);
}
v_length = 0;
goto label__comment_block__continue;
}
@@ -34133,6 +34131,10 @@ wuffs_json__decoder__decode_comment(
(((uint64_t)(2)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(1)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
(((uint64_t)((v_length + 1))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
while (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(5);
}
v_length = 0;
goto label__comment_block__continue;
}
@@ -34144,12 +34146,6 @@ wuffs_json__decoder__decode_comment(
v_length = 2;
label__comment_line__continue:;
while (true) {
if (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(5);
v_length = 0;
goto label__comment_line__continue;
}
while (true) {
if (((uint64_t)(io2_a_src - iop_a_src)) <= 0) {
if (a_src && a_src->meta.closed) {
@@ -34167,6 +34163,10 @@ wuffs_json__decoder__decode_comment(
}
status = wuffs_base__make_status(wuffs_base__suspension__short_read);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(6);
while (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(7);
}
v_length = 0;
goto label__comment_line__continue;
}
@@ -34185,6 +34185,10 @@ wuffs_json__decoder__decode_comment(
(((uint64_t)(4)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(1)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
(((uint64_t)((v_length + 1))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
while (((uint64_t)(io2_a_dst - iop_a_dst)) <= 0) {
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(8);
}
v_length = 0;
goto label__comment_line__continue;
}
+26 -14
View File
@@ -1441,13 +1441,9 @@ pri func decoder.decode_comment?(dst: base.token_writer, src: base.io_reader) {
args.src.skip_u32_fast!(actual: 2, worst_case: 2)
length = 2
while.comment_block true {
if args.dst.length() <= 0 {
yield? base."$short write"
length = 0
continue.comment_block
}
while.comment_block true,
pre args.dst.length() > 0,
{
while true,
pre args.dst.length() > 0,
{
@@ -1464,6 +1460,11 @@ pri func decoder.decode_comment?(dst: base.token_writer, src: base.io_reader) {
return "#bad input"
}
yield? base."$short read"
while args.dst.length() <= 0,
post args.dst.length() > 0,
{
yield? base."$short write"
} endwhile
length = 0
continue.comment_block
}
@@ -1489,6 +1490,11 @@ pri func decoder.decode_comment?(dst: base.token_writer, src: base.io_reader) {
base.TOKEN__VBD__FILLER__COMMENT_BLOCK,
continued: 1,
length: length + 1)
while args.dst.length() <= 0,
post args.dst.length() > 0,
{
yield? base."$short write"
} endwhile
length = 0
continue.comment_block
}
@@ -1500,13 +1506,9 @@ pri func decoder.decode_comment?(dst: base.token_writer, src: base.io_reader) {
args.src.skip_u32_fast!(actual: 2, worst_case: 2)
length = 2
while.comment_line true {
if args.dst.length() <= 0 {
yield? base."$short write"
length = 0
continue.comment_line
}
while.comment_line true,
pre args.dst.length() > 0,
{
while true,
pre args.dst.length() > 0,
{
@@ -1529,6 +1531,11 @@ pri func decoder.decode_comment?(dst: base.token_writer, src: base.io_reader) {
length: length)
}
yield? base."$short read"
while args.dst.length() <= 0,
post args.dst.length() > 0,
{
yield? base."$short write"
} endwhile
length = 0
continue.comment_line
}
@@ -1553,6 +1560,11 @@ pri func decoder.decode_comment?(dst: base.token_writer, src: base.io_reader) {
base.TOKEN__VBD__FILLER__COMMENT_LINE,
continued: 1,
length: length + 1)
while args.dst.length() <= 0,
post args.dst.length() > 0,
{
yield? base."$short write"
} endwhile
length = 0
continue.comment_line
}