@ -977,6 +977,7 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
upb_sink_putint32 ( p - > top - > sink , parser_getsel ( p ) , ( int32_t ) val ) ;
return true ;
}
UPB_UNREACHABLE ( ) ;
}
case UPB_TYPE_UINT32 : {
unsigned long val = strtoul ( buf , & end , 0 ) ;
@ -988,6 +989,7 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
upb_sink_putuint32 ( p - > top - > sink , parser_getsel ( p ) , ( uint32_t ) val ) ;
return true ;
}
UPB_UNREACHABLE ( ) ;
}
/* XXX: We can't handle [u]int64 properly on 32-bit machines because
* strto [ u ] ll isn ' t in C89 . */
@ -999,6 +1001,7 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
upb_sink_putint64 ( p - > top - > sink , parser_getsel ( p ) , val ) ;
return true ;
}
UPB_UNREACHABLE ( ) ;
}
case UPB_TYPE_UINT64 : {
unsigned long val = strtoul ( p - > accumulated , & end , 0 ) ;
@ -1010,6 +1013,7 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
upb_sink_putuint64 ( p - > top - > sink , parser_getsel ( p ) , val ) ;
return true ;
}
UPB_UNREACHABLE ( ) ;
}
default :
break ;
@ -2575,11 +2579,11 @@ static bool does_fieldmask_end(upb_json_parser *p) {
* final state once , when the closing ' " ' is seen . */
# line 2780 "upb / json / parser.rl"
# line 2784 "upb / json / parser.rl"
# line 2583 "upb / json / parser.c"
# line 2587 "upb / json / parser.c"
static const char _json_actions [ ] = {
0 , 1 , 0 , 1 , 1 , 1 , 3 , 1 ,
4 , 1 , 6 , 1 , 7 , 1 , 8 , 1 ,
@ -2834,7 +2838,7 @@ static const int json_en_value_machine = 78;
static const int json_en_main = 1 ;
# line 2783 "upb / json / parser.rl"
# line 2787 "upb / json / parser.rl"
size_t parse ( void * closure , const void * hd , const char * buf , size_t size ,
const upb_bufhandle * handle ) {
@ -2857,7 +2861,7 @@ size_t parse(void *closure, const void *hd, const char *buf, size_t size,
capture_resume ( parser , buf ) ;
# line 2861 "upb / json / parser.c"
# line 2865 "upb / json / parser.c"
{
int _klen ;
unsigned int _trans ;
@ -2932,147 +2936,147 @@ _match:
switch ( * _acts + + )
{
case 1 :
# line 2588 "upb / json / parser.rl"
# line 2592 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; goto _again ; } }
break ;
case 2 :
# line 2590 "upb / json / parser.rl"
# line 2594 "upb / json / parser.rl"
{ p - - ; { stack [ top + + ] = cs ; cs = 23 ; goto _again ; } }
break ;
case 3 :
# line 2594 "upb / json / parser.rl"
# line 2598 "upb / json / parser.rl"
{ start_text ( parser , p ) ; }
break ;
case 4 :
# line 2595 "upb / json / parser.rl"
# line 2599 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_text ( parser , p ) ) ; }
break ;
case 5 :
# line 2601 "upb / json / parser.rl"
# line 2605 "upb / json / parser.rl"
{ start_hex ( parser ) ; }
break ;
case 6 :
# line 2602 "upb / json / parser.rl"
# line 2606 "upb / json / parser.rl"
{ hexdigit ( parser , p ) ; }
break ;
case 7 :
# line 2603 "upb / json / parser.rl"
# line 2607 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_hex ( parser ) ) ; }
break ;
case 8 :
# line 2609 "upb / json / parser.rl"
# line 2613 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( escape ( parser , p ) ) ; }
break ;
case 9 :
# line 2615 "upb / json / parser.rl"
# line 2619 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; goto _again ; } }
break ;
case 10 :
# line 2620 "upb / json / parser.rl"
# line 2624 "upb / json / parser.rl"
{ start_year ( parser , p ) ; }
break ;
case 11 :
# line 2621 "upb / json / parser.rl"
# line 2625 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_year ( parser , p ) ) ; }
break ;
case 12 :
# line 2625 "upb / json / parser.rl"
# line 2629 "upb / json / parser.rl"
{ start_month ( parser , p ) ; }
break ;
case 13 :
# line 2626 "upb / json / parser.rl"
# line 2630 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_month ( parser , p ) ) ; }
break ;
case 14 :
# line 2630 "upb / json / parser.rl"
# line 2634 "upb / json / parser.rl"
{ start_day ( parser , p ) ; }
break ;
case 15 :
# line 2631 "upb / json / parser.rl"
# line 2635 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_day ( parser , p ) ) ; }
break ;
case 16 :
# line 2635 "upb / json / parser.rl"
# line 2639 "upb / json / parser.rl"
{ start_hour ( parser , p ) ; }
break ;
case 17 :
# line 2636 "upb / json / parser.rl"
# line 2640 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_hour ( parser , p ) ) ; }
break ;
case 18 :
# line 2640 "upb / json / parser.rl"
# line 2644 "upb / json / parser.rl"
{ start_minute ( parser , p ) ; }
break ;
case 19 :
# line 2641 "upb / json / parser.rl"
# line 2645 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_minute ( parser , p ) ) ; }
break ;
case 20 :
# line 2645 "upb / json / parser.rl"
# line 2649 "upb / json / parser.rl"
{ start_second ( parser , p ) ; }
break ;
case 21 :
# line 2646 "upb / json / parser.rl"
# line 2650 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_second ( parser , p ) ) ; }
break ;
case 22 :
# line 2651 "upb / json / parser.rl"
# line 2655 "upb / json / parser.rl"
{ start_duration_base ( parser , p ) ; }
break ;
case 23 :
# line 2652 "upb / json / parser.rl"
# line 2656 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_duration_base ( parser , p ) ) ; }
break ;
case 24 :
# line 2654 "upb / json / parser.rl"
# line 2658 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; goto _again ; } }
break ;
case 25 :
# line 2659 "upb / json / parser.rl"
# line 2663 "upb / json / parser.rl"
{ start_timestamp_base ( parser ) ; }
break ;
case 26 :
# line 2661 "upb / json / parser.rl"
# line 2665 "upb / json / parser.rl"
{ start_timestamp_fraction ( parser , p ) ; }
break ;
case 27 :
# line 2662 "upb / json / parser.rl"
# line 2666 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_timestamp_fraction ( parser , p ) ) ; }
break ;
case 28 :
# line 2664 "upb / json / parser.rl"
# line 2668 "upb / json / parser.rl"
{ start_timestamp_zone ( parser , p ) ; }
break ;
case 29 :
# line 2665 "upb / json / parser.rl"
# line 2669 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_timestamp_zone ( parser , p ) ) ; }
break ;
case 30 :
# line 266 7 "upb / json / parser.rl"
# line 2671 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; goto _again ; } }
break ;
case 31 :
# line 2672 "upb / json / parser.rl"
# line 2676 "upb / json / parser.rl"
{ start_fieldmask_path_text ( parser , p ) ; }
break ;
case 32 :
# line 2673 "upb / json / parser.rl"
# line 2677 "upb / json / parser.rl"
{ end_fieldmask_path_text ( parser , p ) ; }
break ;
case 33 :
# line 267 8 "upb / json / parser.rl"
# line 2682 "upb / json / parser.rl"
{ start_fieldmask_path ( parser ) ; }
break ;
case 34 :
# line 2679 "upb / json / parser.rl"
# line 2683 "upb / json / parser.rl"
{ end_fieldmask_path ( parser ) ; }
break ;
case 35 :
# line 2685 "upb / json / parser.rl"
# line 2689 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; goto _again ; } }
break ;
case 36 :
# line 2690 "upb / json / parser.rl"
# line 2694 "upb / json / parser.rl"
{
if ( is_wellknown_msg ( parser , UPB_WELLKNOWN_TIMESTAMP ) ) {
{ stack [ top + + ] = cs ; cs = 47 ; goto _again ; }
@ -3086,11 +3090,11 @@ _match:
}
break ;
case 37 :
# line 2703 "upb / json / parser.rl"
# line 2707 "upb / json / parser.rl"
{ p - - ; { stack [ top + + ] = cs ; cs = 78 ; goto _again ; } }
break ;
case 38 :
# line 2708 "upb / json / parser.rl"
# line 2712 "upb / json / parser.rl"
{
if ( is_wellknown_msg ( parser , UPB_WELLKNOWN_ANY ) ) {
start_any_member ( parser , p ) ;
@ -3100,11 +3104,11 @@ _match:
}
break ;
case 39 :
# line 2715 "upb / json / parser.rl"
# line 2719 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_membername ( parser ) ) ; }
break ;
case 40 :
# line 2718 "upb / json / parser.rl"
# line 2722 "upb / json / parser.rl"
{
if ( is_wellknown_msg ( parser , UPB_WELLKNOWN_ANY ) ) {
end_any_member ( parser , p ) ;
@ -3114,7 +3118,7 @@ _match:
}
break ;
case 41 :
# line 2729 "upb / json / parser.rl"
# line 2733 "upb / json / parser.rl"
{
if ( is_wellknown_msg ( parser , UPB_WELLKNOWN_ANY ) ) {
start_any_object ( parser , p ) ;
@ -3124,7 +3128,7 @@ _match:
}
break ;
case 42 :
# line 2738 "upb / json / parser.rl"
# line 2742 "upb / json / parser.rl"
{
if ( is_wellknown_msg ( parser , UPB_WELLKNOWN_ANY ) ) {
CHECK_RETURN_TOP ( end_any_object ( parser , p ) ) ;
@ -3134,54 +3138,54 @@ _match:
}
break ;
case 43 :
# line 2750 "upb / json / parser.rl"
# line 2754 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( start_array ( parser ) ) ; }
break ;
case 44 :
# line 2754 "upb / json / parser.rl"
# line 2758 "upb / json / parser.rl"
{ end_array ( parser ) ; }
break ;
case 45 :
# line 2759 "upb / json / parser.rl"
# line 2763 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( start_number ( parser , p ) ) ; }
break ;
case 46 :
# line 2760 "upb / json / parser.rl"
# line 2764 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_number ( parser , p ) ) ; }
break ;
case 47 :
# line 2762 "upb / json / parser.rl"
# line 2766 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( start_stringval ( parser ) ) ; }
break ;
case 48 :
# line 2763 "upb / json / parser.rl"
# line 2767 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_stringval ( parser ) ) ; }
break ;
case 49 :
# line 2765 "upb / json / parser.rl"
# line 2769 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_bool ( parser , true ) ) ; }
break ;
case 50 :
# line 276 7 "upb / json / parser.rl"
# line 2771 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_bool ( parser , false ) ) ; }
break ;
case 51 :
# line 2769 "upb / json / parser.rl"
# line 2773 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_null ( parser ) ) ; }
break ;
case 52 :
# line 2771 "upb / json / parser.rl"
# line 2775 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( start_subobject_full ( parser ) ) ; }
break ;
case 53 :
# line 2772 "upb / json / parser.rl"
# line 2776 "upb / json / parser.rl"
{ end_subobject_full ( parser ) ; }
break ;
case 54 :
# line 2777 "upb / json / parser.rl"
# line 2781 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; goto _again ; } }
break ;
# line 3185 "upb / json / parser.c"
# line 3189 "upb / json / parser.c"
}
}
@ -3198,32 +3202,32 @@ _again:
while ( __nacts - - > 0 ) {
switch ( * __acts + + ) {
case 0 :
# line 2586 "upb / json / parser.rl"
# line 2590 "upb / json / parser.rl"
{ p - - ; { cs = stack [ - - top ] ; if ( p = = pe )
goto _test_eof ;
goto _again ; } }
break ;
case 46 :
# line 2760 "upb / json / parser.rl"
# line 2764 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_number ( parser , p ) ) ; }
break ;
case 49 :
# line 2765 "upb / json / parser.rl"
# line 2769 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_bool ( parser , true ) ) ; }
break ;
case 50 :
# line 276 7 "upb / json / parser.rl"
# line 2771 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_bool ( parser , false ) ) ; }
break ;
case 51 :
# line 2769 "upb / json / parser.rl"
# line 2773 "upb / json / parser.rl"
{ CHECK_RETURN_TOP ( end_null ( parser ) ) ; }
break ;
case 53 :
# line 2772 "upb / json / parser.rl"
# line 2776 "upb / json / parser.rl"
{ end_subobject_full ( parser ) ; }
break ;
# line 3227 "upb / json / parser.c"
# line 3231 "upb / json / parser.c"
}
}
}
@ -3231,7 +3235,7 @@ goto _again;} }
_out : { }
}
# line 2805 "upb / json / parser.rl"
# line 2809 "upb / json / parser.rl"
if ( p ! = pe ) {
upb_status_seterrf ( parser - > status , " Parse error at '%.*s' \n " , pe - p , p ) ;
@ -3274,13 +3278,13 @@ static void json_parser_reset(upb_json_parser *p) {
/* Emit Ragel initialization of the parser. */
# line 327 8 "upb / json / parser.c"
# line 3282 "upb / json / parser.c"
{
cs = json_start ;
top = 0 ;
}
# line 2847 "upb / json / parser.rl"
# line 2851 "upb / json / parser.rl"
p - > current_state = cs ;
p - > parser_top = top ;
accumulate_clear ( p ) ;