|
|
@ -21,6 +21,9 @@ |
|
|
|
** - handling of keys/escape-sequences/etc that span input buffers. |
|
|
|
** - handling of keys/escape-sequences/etc that span input buffers. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Need to define _XOPEN_SOURCE before any include to make strptime work. */ |
|
|
|
|
|
|
|
#define _XOPEN_SOURCE 700 |
|
|
|
|
|
|
|
|
|
|
|
#include <ctype.h> |
|
|
|
#include <ctype.h> |
|
|
|
#include <errno.h> |
|
|
|
#include <errno.h> |
|
|
|
#include <float.h> |
|
|
|
#include <float.h> |
|
|
@ -30,10 +33,6 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
|
|
/* Need to define __USE_XOPEN before including time.h to make strptime work. */ |
|
|
|
|
|
|
|
#ifndef __USE_XOPEN |
|
|
|
|
|
|
|
#define __USE_XOPEN |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#include <time.h> |
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "upb/json/parser.h" |
|
|
|
#include "upb/json/parser.h" |
|
|
@ -1537,11 +1536,18 @@ static bool end_timestamp_base(upb_json_parser *p, const char *ptr) { |
|
|
|
memcpy(timestamp_buf + UPB_TIMESTAMP_BASE_SIZE, "GMT", 3); |
|
|
|
memcpy(timestamp_buf + UPB_TIMESTAMP_BASE_SIZE, "GMT", 3); |
|
|
|
timestamp_buf[UPB_TIMESTAMP_BASE_SIZE + 3] = 0; |
|
|
|
timestamp_buf[UPB_TIMESTAMP_BASE_SIZE + 3] = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined __MINGW32__ || defined __MINGW64__ |
|
|
|
|
|
|
|
upb_status_seterrf( |
|
|
|
|
|
|
|
&p->status, "error parsing timestamp: mingw doesn't support strptime"); |
|
|
|
|
|
|
|
upb_env_reporterror(p->env, &p->status); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
#else |
|
|
|
/* Parse seconds */ |
|
|
|
/* Parse seconds */ |
|
|
|
if (strptime(timestamp_buf, "%FT%H:%M:%S%Z", &p->tm) == NULL) { |
|
|
|
if (strptime(timestamp_buf, "%FT%H:%M:%S%Z", &p->tm) == NULL) { |
|
|
|
upb_status_seterrf(p->status, "error parsing timestamp: %s", buf); |
|
|
|
upb_status_seterrf(p->status, "error parsing timestamp: %s", buf); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/* Clean up buffer */ |
|
|
|
/* Clean up buffer */ |
|
|
|
multipart_end(p); |
|
|
|
multipart_end(p); |
|
|
@ -2508,11 +2514,11 @@ static bool does_fieldmask_end(upb_json_parser *p) { |
|
|
|
* final state once, when the closing '"' is seen. */ |
|
|
|
* final state once, when the closing '"' is seen. */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#line 2690 "upb/json/parser.rl" |
|
|
|
#line 2696 "upb/json/parser.rl" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#line 2516 "upb/json/parser.c" |
|
|
|
#line 2522 "upb/json/parser.c" |
|
|
|
static const char _json_actions[] = { |
|
|
|
static const char _json_actions[] = { |
|
|
|
0, 1, 0, 1, 1, 1, 3, 1,
|
|
|
|
0, 1, 0, 1, 1, 1, 3, 1,
|
|
|
|
4, 1, 6, 1, 7, 1, 8, 1,
|
|
|
|
4, 1, 6, 1, 7, 1, 8, 1,
|
|
|
@ -2764,7 +2770,7 @@ static const int json_en_value_machine = 78; |
|
|
|
static const int json_en_main = 1; |
|
|
|
static const int json_en_main = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#line 2693 "upb/json/parser.rl" |
|
|
|
#line 2699 "upb/json/parser.rl" |
|
|
|
|
|
|
|
|
|
|
|
size_t parse(void *closure, const void *hd, const char *buf, size_t size, |
|
|
|
size_t parse(void *closure, const void *hd, const char *buf, size_t size, |
|
|
|
const upb_bufhandle *handle) { |
|
|
|
const upb_bufhandle *handle) { |
|
|
@ -2787,7 +2793,7 @@ size_t parse(void *closure, const void *hd, const char *buf, size_t size, |
|
|
|
capture_resume(parser, buf); |
|
|
|
capture_resume(parser, buf); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#line 2791 "upb/json/parser.c" |
|
|
|
#line 2797 "upb/json/parser.c" |
|
|
|
{ |
|
|
|
{ |
|
|
|
int _klen; |
|
|
|
int _klen; |
|
|
|
unsigned int _trans; |
|
|
|
unsigned int _trans; |
|
|
@ -2862,103 +2868,103 @@ _match: |
|
|
|
switch ( *_acts++ ) |
|
|
|
switch ( *_acts++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
#line 2521 "upb/json/parser.rl" |
|
|
|
#line 2527 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
#line 2523 "upb/json/parser.rl" |
|
|
|
#line 2529 "upb/json/parser.rl" |
|
|
|
{ p--; {stack[top++] = cs; cs = 23;goto _again;} } |
|
|
|
{ p--; {stack[top++] = cs; cs = 23;goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
#line 2527 "upb/json/parser.rl" |
|
|
|
#line 2533 "upb/json/parser.rl" |
|
|
|
{ start_text(parser, p); } |
|
|
|
{ start_text(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
#line 2528 "upb/json/parser.rl" |
|
|
|
#line 2534 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_text(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_text(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
case 5: |
|
|
|
#line 2534 "upb/json/parser.rl" |
|
|
|
#line 2540 "upb/json/parser.rl" |
|
|
|
{ start_hex(parser); } |
|
|
|
{ start_hex(parser); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
case 6: |
|
|
|
#line 2535 "upb/json/parser.rl" |
|
|
|
#line 2541 "upb/json/parser.rl" |
|
|
|
{ hexdigit(parser, p); } |
|
|
|
{ hexdigit(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 7: |
|
|
|
case 7: |
|
|
|
#line 2536 "upb/json/parser.rl" |
|
|
|
#line 2542 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_hex(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(end_hex(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 8: |
|
|
|
case 8: |
|
|
|
#line 2542 "upb/json/parser.rl" |
|
|
|
#line 2548 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(escape(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(escape(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
case 9: |
|
|
|
#line 2548 "upb/json/parser.rl" |
|
|
|
#line 2554 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 10: |
|
|
|
case 10: |
|
|
|
#line 2560 "upb/json/parser.rl" |
|
|
|
#line 2566 "upb/json/parser.rl" |
|
|
|
{ start_duration_base(parser, p); } |
|
|
|
{ start_duration_base(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 11: |
|
|
|
case 11: |
|
|
|
#line 2561 "upb/json/parser.rl" |
|
|
|
#line 2567 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_duration_base(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_duration_base(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 12: |
|
|
|
case 12: |
|
|
|
#line 2563 "upb/json/parser.rl" |
|
|
|
#line 2569 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 13: |
|
|
|
case 13: |
|
|
|
#line 2568 "upb/json/parser.rl" |
|
|
|
#line 2574 "upb/json/parser.rl" |
|
|
|
{ start_timestamp_base(parser, p); } |
|
|
|
{ start_timestamp_base(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 14: |
|
|
|
case 14: |
|
|
|
#line 2569 "upb/json/parser.rl" |
|
|
|
#line 2575 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_timestamp_base(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_timestamp_base(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 15: |
|
|
|
case 15: |
|
|
|
#line 2571 "upb/json/parser.rl" |
|
|
|
#line 2577 "upb/json/parser.rl" |
|
|
|
{ start_timestamp_fraction(parser, p); } |
|
|
|
{ start_timestamp_fraction(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 16: |
|
|
|
case 16: |
|
|
|
#line 2572 "upb/json/parser.rl" |
|
|
|
#line 2578 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_timestamp_fraction(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_timestamp_fraction(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 17: |
|
|
|
case 17: |
|
|
|
#line 2574 "upb/json/parser.rl" |
|
|
|
#line 2580 "upb/json/parser.rl" |
|
|
|
{ start_timestamp_zone(parser, p); } |
|
|
|
{ start_timestamp_zone(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 18: |
|
|
|
case 18: |
|
|
|
#line 2575 "upb/json/parser.rl" |
|
|
|
#line 2581 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_timestamp_zone(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_timestamp_zone(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 19: |
|
|
|
case 19: |
|
|
|
#line 2577 "upb/json/parser.rl" |
|
|
|
#line 2583 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 20: |
|
|
|
case 20: |
|
|
|
#line 2582 "upb/json/parser.rl" |
|
|
|
#line 2588 "upb/json/parser.rl" |
|
|
|
{ start_fieldmask_path_text(parser, p); } |
|
|
|
{ start_fieldmask_path_text(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 21: |
|
|
|
case 21: |
|
|
|
#line 2583 "upb/json/parser.rl" |
|
|
|
#line 2589 "upb/json/parser.rl" |
|
|
|
{ end_fieldmask_path_text(parser, p); } |
|
|
|
{ end_fieldmask_path_text(parser, p); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 22: |
|
|
|
case 22: |
|
|
|
#line 2588 "upb/json/parser.rl" |
|
|
|
#line 2594 "upb/json/parser.rl" |
|
|
|
{ start_fieldmask_path(parser); } |
|
|
|
{ start_fieldmask_path(parser); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 23: |
|
|
|
case 23: |
|
|
|
#line 2589 "upb/json/parser.rl" |
|
|
|
#line 2595 "upb/json/parser.rl" |
|
|
|
{ end_fieldmask_path(parser); } |
|
|
|
{ end_fieldmask_path(parser); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 24: |
|
|
|
case 24: |
|
|
|
#line 2595 "upb/json/parser.rl" |
|
|
|
#line 2601 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 25: |
|
|
|
case 25: |
|
|
|
#line 2600 "upb/json/parser.rl" |
|
|
|
#line 2606 "upb/json/parser.rl" |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_TIMESTAMP)) { |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_TIMESTAMP)) { |
|
|
|
{stack[top++] = cs; cs = 47;goto _again;} |
|
|
|
{stack[top++] = cs; cs = 47;goto _again;} |
|
|
@ -2972,11 +2978,11 @@ _match: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 26: |
|
|
|
case 26: |
|
|
|
#line 2613 "upb/json/parser.rl" |
|
|
|
#line 2619 "upb/json/parser.rl" |
|
|
|
{ p--; {stack[top++] = cs; cs = 78;goto _again;} } |
|
|
|
{ p--; {stack[top++] = cs; cs = 78;goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 27: |
|
|
|
case 27: |
|
|
|
#line 2618 "upb/json/parser.rl" |
|
|
|
#line 2624 "upb/json/parser.rl" |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
start_any_member(parser, p); |
|
|
|
start_any_member(parser, p); |
|
|
@ -2986,11 +2992,11 @@ _match: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 28: |
|
|
|
case 28: |
|
|
|
#line 2625 "upb/json/parser.rl" |
|
|
|
#line 2631 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_membername(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(end_membername(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 29: |
|
|
|
case 29: |
|
|
|
#line 2628 "upb/json/parser.rl" |
|
|
|
#line 2634 "upb/json/parser.rl" |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
end_any_member(parser, p); |
|
|
|
end_any_member(parser, p); |
|
|
@ -3000,7 +3006,7 @@ _match: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 30: |
|
|
|
case 30: |
|
|
|
#line 2639 "upb/json/parser.rl" |
|
|
|
#line 2645 "upb/json/parser.rl" |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
start_any_object(parser, p); |
|
|
|
start_any_object(parser, p); |
|
|
@ -3010,7 +3016,7 @@ _match: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 31: |
|
|
|
case 31: |
|
|
|
#line 2648 "upb/json/parser.rl" |
|
|
|
#line 2654 "upb/json/parser.rl" |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
if (is_wellknown_msg(parser, UPB_WELLKNOWN_ANY)) { |
|
|
|
CHECK_RETURN_TOP(end_any_object(parser, p)); |
|
|
|
CHECK_RETURN_TOP(end_any_object(parser, p)); |
|
|
@ -3020,54 +3026,54 @@ _match: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 32: |
|
|
|
case 32: |
|
|
|
#line 2660 "upb/json/parser.rl" |
|
|
|
#line 2666 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(start_array(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(start_array(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 33: |
|
|
|
case 33: |
|
|
|
#line 2664 "upb/json/parser.rl" |
|
|
|
#line 2670 "upb/json/parser.rl" |
|
|
|
{ end_array(parser); } |
|
|
|
{ end_array(parser); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 34: |
|
|
|
case 34: |
|
|
|
#line 2669 "upb/json/parser.rl" |
|
|
|
#line 2675 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(start_number(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(start_number(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 35: |
|
|
|
case 35: |
|
|
|
#line 2670 "upb/json/parser.rl" |
|
|
|
#line 2676 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_number(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_number(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 36: |
|
|
|
case 36: |
|
|
|
#line 2672 "upb/json/parser.rl" |
|
|
|
#line 2678 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(start_stringval(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(start_stringval(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 37: |
|
|
|
case 37: |
|
|
|
#line 2673 "upb/json/parser.rl" |
|
|
|
#line 2679 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_stringval(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(end_stringval(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 38: |
|
|
|
case 38: |
|
|
|
#line 2675 "upb/json/parser.rl" |
|
|
|
#line 2681 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, true)); } |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, true)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 39: |
|
|
|
case 39: |
|
|
|
#line 2677 "upb/json/parser.rl" |
|
|
|
#line 2683 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, false)); } |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, false)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 40: |
|
|
|
case 40: |
|
|
|
#line 2679 "upb/json/parser.rl" |
|
|
|
#line 2685 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_null(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(end_null(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 41: |
|
|
|
case 41: |
|
|
|
#line 2681 "upb/json/parser.rl" |
|
|
|
#line 2687 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(start_subobject_full(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(start_subobject_full(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 42: |
|
|
|
case 42: |
|
|
|
#line 2682 "upb/json/parser.rl" |
|
|
|
#line 2688 "upb/json/parser.rl" |
|
|
|
{ end_subobject_full(parser); } |
|
|
|
{ end_subobject_full(parser); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 43: |
|
|
|
case 43: |
|
|
|
#line 2687 "upb/json/parser.rl" |
|
|
|
#line 2693 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
{ p--; {cs = stack[--top]; goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
#line 3071 "upb/json/parser.c" |
|
|
|
#line 3077 "upb/json/parser.c" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3084,32 +3090,32 @@ _again: |
|
|
|
while ( __nacts-- > 0 ) { |
|
|
|
while ( __nacts-- > 0 ) { |
|
|
|
switch ( *__acts++ ) { |
|
|
|
switch ( *__acts++ ) { |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
#line 2519 "upb/json/parser.rl" |
|
|
|
#line 2525 "upb/json/parser.rl" |
|
|
|
{ p--; {cs = stack[--top]; if ( p == pe ) |
|
|
|
{ p--; {cs = stack[--top]; if ( p == pe ) |
|
|
|
goto _test_eof; |
|
|
|
goto _test_eof; |
|
|
|
goto _again;} } |
|
|
|
goto _again;} } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 35: |
|
|
|
case 35: |
|
|
|
#line 2670 "upb/json/parser.rl" |
|
|
|
#line 2676 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_number(parser, p)); } |
|
|
|
{ CHECK_RETURN_TOP(end_number(parser, p)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 38: |
|
|
|
case 38: |
|
|
|
#line 2675 "upb/json/parser.rl" |
|
|
|
#line 2681 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, true)); } |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, true)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 39: |
|
|
|
case 39: |
|
|
|
#line 2677 "upb/json/parser.rl" |
|
|
|
#line 2683 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, false)); } |
|
|
|
{ CHECK_RETURN_TOP(end_bool(parser, false)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 40: |
|
|
|
case 40: |
|
|
|
#line 2679 "upb/json/parser.rl" |
|
|
|
#line 2685 "upb/json/parser.rl" |
|
|
|
{ CHECK_RETURN_TOP(end_null(parser)); } |
|
|
|
{ CHECK_RETURN_TOP(end_null(parser)); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 42: |
|
|
|
case 42: |
|
|
|
#line 2682 "upb/json/parser.rl" |
|
|
|
#line 2688 "upb/json/parser.rl" |
|
|
|
{ end_subobject_full(parser); } |
|
|
|
{ end_subobject_full(parser); } |
|
|
|
break; |
|
|
|
break; |
|
|
|
#line 3113 "upb/json/parser.c" |
|
|
|
#line 3119 "upb/json/parser.c" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -3117,7 +3123,7 @@ goto _again;} } |
|
|
|
_out: {} |
|
|
|
_out: {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#line 2715 "upb/json/parser.rl" |
|
|
|
#line 2721 "upb/json/parser.rl" |
|
|
|
|
|
|
|
|
|
|
|
if (p != pe) { |
|
|
|
if (p != pe) { |
|
|
|
upb_status_seterrf(parser->status, "Parse error at '%.*s'\n", pe - p, p); |
|
|
|
upb_status_seterrf(parser->status, "Parse error at '%.*s'\n", pe - p, p); |
|
|
@ -3165,13 +3171,13 @@ static void json_parser_reset(upb_json_parser *p) { |
|
|
|
|
|
|
|
|
|
|
|
/* Emit Ragel initialization of the parser. */ |
|
|
|
/* Emit Ragel initialization of the parser. */ |
|
|
|
|
|
|
|
|
|
|
|
#line 3169 "upb/json/parser.c" |
|
|
|
#line 3175 "upb/json/parser.c" |
|
|
|
{ |
|
|
|
{ |
|
|
|
cs = json_start; |
|
|
|
cs = json_start; |
|
|
|
top = 0; |
|
|
|
top = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#line 2762 "upb/json/parser.rl" |
|
|
|
#line 2768 "upb/json/parser.rl" |
|
|
|
p->current_state = cs; |
|
|
|
p->current_state = cs; |
|
|
|
p->parser_top = top; |
|
|
|
p->parser_top = top; |
|
|
|
accumulate_clear(p); |
|
|
|
accumulate_clear(p); |
|
|
|