summaryrefslogtreecommitdiff
path: root/upb/json/parser.c
diff options
context:
space:
mode:
authorBo Yang <teboring@google.com>2018-12-12 06:34:11 +0000
committerBo Yang <teboring@google.com>2018-12-12 06:34:11 +0000
commitb39dbb9d4010f6b6e11a5100a73e03b601cf72b9 (patch)
treef94970fb0f0db5b1a456290de59b9a60ca3a0a6a /upb/json/parser.c
parent13c59cb051c4deee5367f9c5fc7b5d07363496a0 (diff)
Add support for encoding Any in json
Diffstat (limited to 'upb/json/parser.c')
-rw-r--r--upb/json/parser.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/upb/json/parser.c b/upb/json/parser.c
index 83590a1..28d7d88 100644
--- a/upb/json/parser.c
+++ b/upb/json/parser.c
@@ -1301,15 +1301,15 @@ static bool end_stringval_nontop(upb_json_parser *p) {
return true;
}
- if (p->top->is_any) {
- return end_any_stringval(p);
- }
-
if (p->top->f == NULL) {
multipart_end(p);
return true;
}
+ if (p->top->is_any) {
+ return end_any_stringval(p);
+ }
+
switch (upb_fielddef_type(p->top->f)) {
case UPB_TYPE_BYTES:
if (!base64_push(p, getsel_for_handlertype(p, UPB_HANDLER_STRING),
@@ -2768,7 +2768,7 @@ _match:
break;
case 2:
#line 2429 "upb/json/parser.rl"
- { p--; {stack[top++] = cs; cs = 23;goto _again;} }
+ { p--; {stack[top++] = cs; cs = 23; goto _again;} }
break;
case 3:
#line 2433 "upb/json/parser.rl"
@@ -2842,17 +2842,17 @@ _match:
#line 2488 "upb/json/parser.rl"
{
if (is_wellknown_msg(parser, UPB_WELLKNOWN_TIMESTAMP)) {
- {stack[top++] = cs; cs = 47;goto _again;}
+ {stack[top++] = cs; cs = 47; goto _again;}
} else if (is_wellknown_msg(parser, UPB_WELLKNOWN_DURATION)) {
- {stack[top++] = cs; cs = 40;goto _again;}
+ {stack[top++] = cs; cs = 40; goto _again;}
} else {
- {stack[top++] = cs; cs = 32;goto _again;}
+ {stack[top++] = cs; cs = 32; goto _again;}
}
}
break;
case 21:
#line 2499 "upb/json/parser.rl"
- { p--; {stack[top++] = cs; cs = 75;goto _again;} }
+ { p--; {stack[top++] = cs; cs = 75; goto _again;} }
break;
case 22:
#line 2504 "upb/json/parser.rl"
@@ -2964,9 +2964,7 @@ _again:
switch ( *__acts++ ) {
case 0:
#line 2425 "upb/json/parser.rl"
- { p--; {cs = stack[--top]; if ( p == pe )
- goto _test_eof;
-goto _again;} }
+ { p--; {cs = stack[--top]; goto _again;} }
break;
case 30:
#line 2556 "upb/json/parser.rl"
@@ -2988,7 +2986,7 @@ goto _again;} }
#line 2568 "upb/json/parser.rl"
{ end_subobject_full(parser); }
break;
-#line 2992 "upb/json/parser.c"
+#line 2990 "upb/json/parser.c"
}
}
}
@@ -3027,7 +3025,11 @@ static bool end(void *closure, const void *hd) {
parse(parser, hd, &eof_ch, 0, NULL);
- return parser->current_state >= 103;
+ return parser->current_state >=
+#line 3030 "upb/json/parser.c"
+103
+#line 2631 "upb/json/parser.rl"
+;
}
static void json_parser_reset(upb_json_parser *p) {
@@ -3044,7 +3046,7 @@ static void json_parser_reset(upb_json_parser *p) {
/* Emit Ragel initialization of the parser. */
-#line 3048 "upb/json/parser.c"
+#line 3050 "upb/json/parser.c"
{
cs = json_start;
top = 0;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback