@@ -89,11 +89,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
8989
9090
9191#line 92 "parser.c"
92- enum { JSON_object_start = 1 } ;
93- enum { JSON_object_first_final = 27 } ;
94- enum { JSON_object_error = 0 } ;
92+ static const int JSON_object_start = 1 ;
93+ static const int JSON_object_first_final = 27 ;
94+ static const int JSON_object_error = 0 ;
9595
96- enum { JSON_object_en_main = 1 } ;
96+ static const int JSON_object_en_main = 1 ;
9797
9898
9999#line 151 "parser.rl"
@@ -467,11 +467,11 @@ case 26:
467467
468468
469469#line 470 "parser.c"
470- enum { JSON_value_start = 1 } ;
471- enum { JSON_value_first_final = 21 } ;
472- enum { JSON_value_error = 0 } ;
470+ static const int JSON_value_start = 1 ;
471+ static const int JSON_value_first_final = 21 ;
472+ static const int JSON_value_error = 0 ;
473473
474- enum { JSON_value_en_main = 1 } ;
474+ static const int JSON_value_en_main = 1 ;
475475
476476
477477#line 271 "parser.rl"
@@ -776,11 +776,11 @@ case 20:
776776
777777
778778#line 779 "parser.c"
779- enum { JSON_integer_start = 1 } ;
780- enum { JSON_integer_first_final = 3 } ;
781- enum { JSON_integer_error = 0 } ;
779+ static const int JSON_integer_start = 1 ;
780+ static const int JSON_integer_first_final = 3 ;
781+ static const int JSON_integer_error = 0 ;
782782
783- enum { JSON_integer_en_main = 1 } ;
783+ static const int JSON_integer_en_main = 1 ;
784784
785785
786786#line 295 "parser.rl"
@@ -875,11 +875,11 @@ case 5:
875875
876876
877877#line 878 "parser.c"
878- enum { JSON_float_start = 1 } ;
879- enum { JSON_float_first_final = 8 } ;
880- enum { JSON_float_error = 0 } ;
878+ static const int JSON_float_start = 1 ;
879+ static const int JSON_float_first_final = 8 ;
880+ static const int JSON_float_error = 0 ;
881881
882- enum { JSON_float_en_main = 1 } ;
882+ static const int JSON_float_en_main = 1 ;
883883
884884
885885#line 329 "parser.rl"
@@ -1041,11 +1041,11 @@ case 7:
10411041
10421042
10431043#line 1044 "parser.c"
1044- enum { JSON_array_start = 1 } ;
1045- enum { JSON_array_first_final = 17 } ;
1046- enum { JSON_array_error = 0 } ;
1044+ static const int JSON_array_start = 1 ;
1045+ static const int JSON_array_first_final = 17 ;
1046+ static const int JSON_array_error = 0 ;
10471047
1048- enum { JSON_array_en_main = 1 } ;
1048+ static const int JSON_array_en_main = 1 ;
10491049
10501050
10511051#line 381 "parser.rl"
@@ -1373,11 +1373,11 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
13731373
13741374
13751375#line 1376 "parser.c"
1376- enum { JSON_string_start = 1 } ;
1377- enum { JSON_string_first_final = 8 } ;
1378- enum { JSON_string_error = 0 } ;
1376+ static const int JSON_string_start = 1 ;
1377+ static const int JSON_string_first_final = 8 ;
1378+ static const int JSON_string_error = 0 ;
13791379
1380- enum { JSON_string_en_main = 1 } ;
1380+ static const int JSON_string_en_main = 1 ;
13811381
13821382
13831383#line 494 "parser.rl"
@@ -1544,6 +1544,8 @@ case 7:
15441544
15451545 if (json -> symbolize_names && json -> parsing_name ) {
15461546 * result = rb_str_intern (* result );
1547+ } else {
1548+ rb_str_resize (* result , RSTRING_LEN (* result ));
15471549 }
15481550 if (cs >= JSON_string_first_final ) {
15491551 return p + 1 ;
@@ -1729,15 +1731,15 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
17291731}
17301732
17311733
1732- #line 1733 "parser.c"
1733- enum { JSON_start = 1 } ;
1734- enum { JSON_first_final = 10 } ;
1735- enum { JSON_error = 0 } ;
1734+ #line 1735 "parser.c"
1735+ static const int JSON_start = 1 ;
1736+ static const int JSON_first_final = 10 ;
1737+ static const int JSON_error = 0 ;
17361738
1737- enum { JSON_en_main = 1 } ;
1739+ static const int JSON_en_main = 1 ;
17381740
17391741
1740- #line 740 "parser.rl"
1742+ #line 742 "parser.rl"
17411743
17421744
17431745static VALUE cParser_parse_strict (VALUE self )
@@ -1748,16 +1750,16 @@ static VALUE cParser_parse_strict(VALUE self)
17481750 GET_PARSER ;
17491751
17501752
1751- #line 1752 "parser.c"
1753+ #line 1754 "parser.c"
17521754 {
17531755 cs = JSON_start ;
17541756 }
17551757
1756- #line 750 "parser.rl"
1758+ #line 752 "parser.rl"
17571759 p = json -> source ;
17581760 pe = p + json -> len ;
17591761
1760- #line 1761 "parser.c"
1762+ #line 1763 "parser.c"
17611763 {
17621764 if ( p == pe )
17631765 goto _test_eof ;
@@ -1813,7 +1815,7 @@ case 5:
18131815 goto st1 ;
18141816 goto st5 ;
18151817tr3 :
1816- #line 729 "parser.rl"
1818+ #line 731 "parser.rl"
18171819 {
18181820 char * np ;
18191821 json -> current_nesting = 1 ;
@@ -1822,7 +1824,7 @@ case 5:
18221824 }
18231825 goto st10 ;
18241826tr4 :
1825- #line 722 "parser.rl"
1827+ #line 724 "parser.rl"
18261828 {
18271829 char * np ;
18281830 json -> current_nesting = 1 ;
@@ -1834,7 +1836,7 @@ case 5:
18341836 if ( ++ p == pe )
18351837 goto _test_eof10 ;
18361838case 10 :
1837- #line 1838 "parser.c"
1839+ #line 1840 "parser.c"
18381840 switch ( (* p ) ) {
18391841 case 13 : goto st10 ;
18401842 case 32 : goto st10 ;
@@ -1891,7 +1893,7 @@ case 9:
18911893 _out : {}
18921894 }
18931895
1894- #line 753 "parser.rl"
1896+ #line 755 "parser.rl"
18951897
18961898 if (cs >= JSON_first_final && p == pe ) {
18971899 return result ;
@@ -1903,15 +1905,15 @@ case 9:
19031905
19041906
19051907
1906- #line 1907 "parser.c"
1907- enum { JSON_quirks_mode_start = 1 } ;
1908- enum { JSON_quirks_mode_first_final = 10 } ;
1909- enum { JSON_quirks_mode_error = 0 } ;
1908+ #line 1909 "parser.c"
1909+ static const int JSON_quirks_mode_start = 1 ;
1910+ static const int JSON_quirks_mode_first_final = 10 ;
1911+ static const int JSON_quirks_mode_error = 0 ;
19101912
1911- enum { JSON_quirks_mode_en_main = 1 } ;
1913+ static const int JSON_quirks_mode_en_main = 1 ;
19121914
19131915
1914- #line 778 "parser.rl"
1916+ #line 780 "parser.rl"
19151917
19161918
19171919static VALUE cParser_parse_quirks_mode (VALUE self )
@@ -1922,16 +1924,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
19221924 GET_PARSER ;
19231925
19241926
1925- #line 1926 "parser.c"
1927+ #line 1928 "parser.c"
19261928 {
19271929 cs = JSON_quirks_mode_start ;
19281930 }
19291931
1930- #line 788 "parser.rl"
1932+ #line 790 "parser.rl"
19311933 p = json -> source ;
19321934 pe = p + json -> len ;
19331935
1934- #line 1935 "parser.c"
1936+ #line 1937 "parser.c"
19351937 {
19361938 if ( p == pe )
19371939 goto _test_eof ;
@@ -1965,7 +1967,7 @@ case 1:
19651967cs = 0 ;
19661968 goto _out ;
19671969tr2 :
1968- #line 770 "parser.rl"
1970+ #line 772 "parser.rl"
19691971 {
19701972 char * np = JSON_parse_value (json , p , pe , & result );
19711973 if (np == NULL ) { p -- ; {p ++ ; cs = 10 ; goto _out ;} } else {p = (( np ))- 1 ;}
@@ -1975,7 +1977,7 @@ cs = 0;
19751977 if ( ++ p == pe )
19761978 goto _test_eof10 ;
19771979case 10 :
1978- #line 1979 "parser.c"
1980+ #line 1981 "parser.c"
19791981 switch ( (* p ) ) {
19801982 case 13 : goto st10 ;
19811983 case 32 : goto st10 ;
@@ -2064,7 +2066,7 @@ case 9:
20642066 _out : {}
20652067 }
20662068
2067- #line 791 "parser.rl"
2069+ #line 793 "parser.rl"
20682070
20692071 if (cs >= JSON_quirks_mode_first_final && p == pe ) {
20702072 return result ;
0 commit comments