Remove redundant json decode_comment "while true"
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index eaaae5f..effe222 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -34094,106 +34094,102 @@
v_length = 2;
label__comment_block__continue:;
while (true) {
- while (true) {
- if (((uint64_t)(io2_a_src - iop_a_src)) <= 1) {
- if (v_length > 0) {
- *iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(2)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
- (((uint64_t)(1)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
- (((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
- }
- if (a_src && a_src->meta.closed) {
- status = wuffs_base__make_status(wuffs_json__error__bad_input);
- goto exit;
- }
- status = wuffs_base__make_status(wuffs_base__suspension__short_read);
- 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;
- }
- v_c2 = wuffs_base__peek_u16le__no_bounds_check(iop_a_src);
- if (v_c2 == 12074) {
- iop_a_src += 2;
- *iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(2)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
- (((uint64_t)((v_length + 2))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
- self->private_impl.f_comment_type = 1;
- status = wuffs_base__make_status(NULL);
- goto ok;
- }
- iop_a_src += 1;
- if (v_length >= 65533) {
+ if (((uint64_t)(io2_a_src - iop_a_src)) <= 1) {
+ if (v_length > 0) {
*iop_a_dst++ = wuffs_base__make_token(
(((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;
+ (((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
}
- v_length += 1;
+ if (a_src && a_src->meta.closed) {
+ status = wuffs_base__make_status(wuffs_json__error__bad_input);
+ goto exit;
+ }
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ 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;
}
+ v_c2 = wuffs_base__peek_u16le__no_bounds_check(iop_a_src);
+ if (v_c2 == 12074) {
+ iop_a_src += 2;
+ *iop_a_dst++ = wuffs_base__make_token(
+ (((uint64_t)(2)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
+ (((uint64_t)((v_length + 2))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
+ self->private_impl.f_comment_type = 1;
+ status = wuffs_base__make_status(NULL);
+ goto ok;
+ }
+ iop_a_src += 1;
+ if (v_length >= 65533) {
+ *iop_a_dst++ = wuffs_base__make_token(
+ (((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;
+ }
+ v_length += 1;
}
} else if ((v_c2 == 12079) && self->private_impl.f_quirks[12]) {
iop_a_src += 2;
v_length = 2;
label__comment_line__continue:;
while (true) {
- while (true) {
- if (((uint64_t)(io2_a_src - iop_a_src)) <= 0) {
- if (a_src && a_src->meta.closed) {
- *iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(4)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
- (((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
- self->private_impl.f_comment_type = 2;
- status = wuffs_base__make_status(NULL);
- goto ok;
- } else if (v_length > 0) {
- *iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(4)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
- (((uint64_t)(1)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
- (((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
- }
- 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;
- }
- v_c = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
- if (v_c == 10) {
+ if (((uint64_t)(io2_a_src - iop_a_src)) <= 0) {
+ if (a_src && a_src->meta.closed) {
*iop_a_dst++ = wuffs_base__make_token(
(((uint64_t)(4)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
self->private_impl.f_comment_type = 2;
status = wuffs_base__make_status(NULL);
goto ok;
- }
- iop_a_src += 1;
- if (v_length >= 65533) {
+ } else if (v_length > 0) {
*iop_a_dst++ = wuffs_base__make_token(
(((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;
+ (((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
}
- v_length += 1;
+ 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;
}
+ v_c = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
+ if (v_c == 10) {
+ *iop_a_dst++ = wuffs_base__make_token(
+ (((uint64_t)(4)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
+ (((uint64_t)(v_length)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
+ self->private_impl.f_comment_type = 2;
+ status = wuffs_base__make_status(NULL);
+ goto ok;
+ }
+ iop_a_src += 1;
+ if (v_length >= 65533) {
+ *iop_a_dst++ = wuffs_base__make_token(
+ (((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;
+ }
+ v_length += 1;
}
}
diff --git a/std/json/decode_json.wuffs b/std/json/decode_json.wuffs
index f7b3891..05ffa47 100644
--- a/std/json/decode_json.wuffs
+++ b/std/json/decode_json.wuffs
@@ -1444,62 +1444,58 @@
while.comment_block true,
pre args.dst.length() > 0,
{
- while true,
- pre args.dst.length() > 0,
- {
- if args.src.length() <= 1 {
- if length > 0 {
- args.dst.write_simple_token_fast!(
- value_major: 0,
- value_minor: (base.TOKEN__VBC__FILLER << 21) |
- base.TOKEN__VBD__FILLER__COMMENT_BLOCK,
- continued: 1,
- length: length)
- }
- if args.src.is_closed() {
- 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
- }
-
- c2 = args.src.peek_u16le()
- if c2 == '*/'le {
- args.src.skip_u32_fast!(actual: 2, worst_case: 2)
- args.dst.write_simple_token_fast!(
- value_major: 0,
- value_minor: (base.TOKEN__VBC__FILLER << 21) |
- base.TOKEN__VBD__FILLER__COMMENT_BLOCK,
- continued: 0,
- length: length + 2)
- this.comment_type = 1
- return ok
- }
-
- args.src.skip_u32_fast!(actual: 1, worst_case: 1)
- if length >= 0xFFFD {
+ if args.src.length() <= 1 {
+ if length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__FILLER << 21) |
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
+ length: length)
}
- length += 1
- } endwhile
+ if args.src.is_closed() {
+ 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
+ }
+
+ c2 = args.src.peek_u16le()
+ if c2 == '*/'le {
+ args.src.skip_u32_fast!(actual: 2, worst_case: 2)
+ args.dst.write_simple_token_fast!(
+ value_major: 0,
+ value_minor: (base.TOKEN__VBC__FILLER << 21) |
+ base.TOKEN__VBD__FILLER__COMMENT_BLOCK,
+ continued: 0,
+ length: length + 2)
+ this.comment_type = 1
+ return ok
+ }
+
+ args.src.skip_u32_fast!(actual: 1, worst_case: 1)
+ if length >= 0xFFFD {
+ args.dst.write_simple_token_fast!(
+ value_major: 0,
+ value_minor: (base.TOKEN__VBC__FILLER << 21) |
+ 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
+ }
+ length += 1
} endwhile.comment_block
} else if (c2 == '//'le) and this.quirks[QUIRK_ALLOW_COMMENT_LINE - QUIRKS_BASE] {
@@ -1509,39 +1505,8 @@
while.comment_line true,
pre args.dst.length() > 0,
{
- while true,
- pre args.dst.length() > 0,
- {
- if args.src.length() <= 0 {
- if args.src.is_closed() {
- args.dst.write_simple_token_fast!(
- value_major: 0,
- value_minor: (base.TOKEN__VBC__FILLER << 21) |
- base.TOKEN__VBD__FILLER__COMMENT_LINE,
- continued: 0,
- length: length)
- this.comment_type = 2
- return ok
- } else if length > 0 {
- args.dst.write_simple_token_fast!(
- value_major: 0,
- value_minor: (base.TOKEN__VBC__FILLER << 21) |
- base.TOKEN__VBD__FILLER__COMMENT_LINE,
- continued: 1,
- 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
- }
-
- c = args.src.peek_u8()
- if c == '\n' {
+ if args.src.length() <= 0 {
+ if args.src.is_closed() {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__FILLER << 21) |
@@ -1550,26 +1515,53 @@
length: length)
this.comment_type = 2
return ok
- }
-
- args.src.skip_u32_fast!(actual: 1, worst_case: 1)
- if length >= 0xFFFD {
+ } else if length > 0 {
args.dst.write_simple_token_fast!(
value_major: 0,
value_minor: (base.TOKEN__VBC__FILLER << 21) |
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
+ length: length)
}
- length += 1
- } endwhile
+ yield? base."$short read"
+ while args.dst.length() <= 0,
+ post args.dst.length() > 0,
+ {
+ yield? base."$short write"
+ } endwhile
+ length = 0
+ continue.comment_line
+ }
+
+ c = args.src.peek_u8()
+ if c == '\n' {
+ args.dst.write_simple_token_fast!(
+ value_major: 0,
+ value_minor: (base.TOKEN__VBC__FILLER << 21) |
+ base.TOKEN__VBD__FILLER__COMMENT_LINE,
+ continued: 0,
+ length: length)
+ this.comment_type = 2
+ return ok
+ }
+
+ args.src.skip_u32_fast!(actual: 1, worst_case: 1)
+ if length >= 0xFFFD {
+ args.dst.write_simple_token_fast!(
+ value_major: 0,
+ value_minor: (base.TOKEN__VBC__FILLER << 21) |
+ 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
+ }
+ length += 1
} endwhile.comment_line
}
}