json 2.8.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,19 +28,6 @@ static const char deprecated_create_additions_warning[] =
28
28
  "and will be removed in 3.0, use JSON.unsafe_load or explicitly "
29
29
  "pass `create_additions: true`";
30
30
 
31
- #ifndef HAVE_RB_GC_MARK_LOCATIONS
32
- // For TruffleRuby
33
- void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
34
- {
35
- VALUE *value = start;
36
-
37
- while (value < end) {
38
- rb_gc_mark(*value);
39
- value++;
40
- }
41
- }
42
- #endif
43
-
44
31
  #ifndef HAVE_RB_HASH_BULK_INSERT
45
32
  // For TruffleRuby
46
33
  void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
@@ -266,7 +253,10 @@ static inline void rvalue_stack_pop(rvalue_stack *stack, long count)
266
253
  static void rvalue_stack_mark(void *ptr)
267
254
  {
268
255
  rvalue_stack *stack = (rvalue_stack *)ptr;
269
- rb_gc_mark_locations(stack->ptr, stack->ptr + stack->head);
256
+ long index;
257
+ for (index = 0; index < stack->head; index++) {
258
+ rb_gc_mark(stack->ptr[index]);
259
+ }
270
260
  }
271
261
 
272
262
  static void rvalue_stack_free(void *ptr)
@@ -394,6 +384,7 @@ typedef struct JSON_ParserStruct {
394
384
  VALUE decimal_class;
395
385
  VALUE match_string;
396
386
  FBuffer fbuffer;
387
+ int in_array;
397
388
  int max_nesting;
398
389
  bool allow_nan;
399
390
  bool allow_trailing_comma;
@@ -422,8 +413,7 @@ static const rb_data_type_t JSON_Parser_type;
422
413
  static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result);
423
414
  static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
424
415
  static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
425
- static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result);
426
- static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result);
416
+ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *result);
427
417
  static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
428
418
 
429
419
 
@@ -449,11 +439,11 @@ static void raise_parse_error(const char *format, const char *start)
449
439
 
450
440
 
451
441
 
452
- #line 475 "parser.rl"
442
+ #line 465 "parser.rl"
453
443
 
454
444
 
455
445
 
456
- #line 457 "parser.c"
446
+ #line 447 "parser.c"
457
447
  enum {JSON_object_start = 1};
458
448
  enum {JSON_object_first_final = 32};
459
449
  enum {JSON_object_error = 0};
@@ -461,7 +451,7 @@ enum {JSON_object_error = 0};
461
451
  enum {JSON_object_en_main = 1};
462
452
 
463
453
 
464
- #line 515 "parser.rl"
454
+ #line 505 "parser.rl"
465
455
 
466
456
 
467
457
  #define PUSH(result) rvalue_stack_push(json->stack, result, &json->stack_handle, &json->stack)
@@ -477,14 +467,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
477
467
  long stack_head = json->stack->head;
478
468
 
479
469
 
480
- #line 481 "parser.c"
470
+ #line 471 "parser.c"
481
471
  {
482
472
  cs = JSON_object_start;
483
473
  }
484
474
 
485
- #line 530 "parser.rl"
475
+ #line 520 "parser.rl"
486
476
 
487
- #line 488 "parser.c"
477
+ #line 478 "parser.c"
488
478
  {
489
479
  short _widec;
490
480
  if ( p == pe )
@@ -513,7 +503,7 @@ case 2:
513
503
  goto st2;
514
504
  goto st0;
515
505
  tr2:
516
- #line 494 "parser.rl"
506
+ #line 484 "parser.rl"
517
507
  {
518
508
  char *np;
519
509
  json->parsing_name = true;
@@ -529,7 +519,7 @@ st3:
529
519
  if ( ++p == pe )
530
520
  goto _test_eof3;
531
521
  case 3:
532
- #line 533 "parser.c"
522
+ #line 523 "parser.c"
533
523
  switch( (*p) ) {
534
524
  case 13: goto st3;
535
525
  case 32: goto st3;
@@ -596,7 +586,7 @@ case 8:
596
586
  goto st8;
597
587
  goto st0;
598
588
  tr11:
599
- #line 483 "parser.rl"
589
+ #line 473 "parser.rl"
600
590
  {
601
591
  char *np = JSON_parse_value(json, p, pe, result, current_nesting);
602
592
  if (np == NULL) {
@@ -610,20 +600,20 @@ st9:
610
600
  if ( ++p == pe )
611
601
  goto _test_eof9;
612
602
  case 9:
613
- #line 614 "parser.c"
603
+ #line 604 "parser.c"
614
604
  _widec = (*p);
615
605
  if ( (*p) < 13 ) {
616
606
  if ( (*p) > 9 ) {
617
607
  if ( 10 <= (*p) && (*p) <= 10 ) {
618
608
  _widec = (short)(128 + ((*p) - -128));
619
609
  if (
620
- #line 492 "parser.rl"
610
+ #line 482 "parser.rl"
621
611
  json->allow_trailing_comma ) _widec += 256;
622
612
  }
623
613
  } else if ( (*p) >= 9 ) {
624
614
  _widec = (short)(128 + ((*p) - -128));
625
615
  if (
626
- #line 492 "parser.rl"
616
+ #line 482 "parser.rl"
627
617
  json->allow_trailing_comma ) _widec += 256;
628
618
  }
629
619
  } else if ( (*p) > 13 ) {
@@ -631,26 +621,26 @@ case 9:
631
621
  if ( 32 <= (*p) && (*p) <= 32 ) {
632
622
  _widec = (short)(128 + ((*p) - -128));
633
623
  if (
634
- #line 492 "parser.rl"
624
+ #line 482 "parser.rl"
635
625
  json->allow_trailing_comma ) _widec += 256;
636
626
  }
637
627
  } else if ( (*p) > 44 ) {
638
628
  if ( 47 <= (*p) && (*p) <= 47 ) {
639
629
  _widec = (short)(128 + ((*p) - -128));
640
630
  if (
641
- #line 492 "parser.rl"
631
+ #line 482 "parser.rl"
642
632
  json->allow_trailing_comma ) _widec += 256;
643
633
  }
644
634
  } else {
645
635
  _widec = (short)(128 + ((*p) - -128));
646
636
  if (
647
- #line 492 "parser.rl"
637
+ #line 482 "parser.rl"
648
638
  json->allow_trailing_comma ) _widec += 256;
649
639
  }
650
640
  } else {
651
641
  _widec = (short)(128 + ((*p) - -128));
652
642
  if (
653
- #line 492 "parser.rl"
643
+ #line 482 "parser.rl"
654
644
  json->allow_trailing_comma ) _widec += 256;
655
645
  }
656
646
  switch( _widec ) {
@@ -671,14 +661,14 @@ case 9:
671
661
  goto st10;
672
662
  goto st0;
673
663
  tr4:
674
- #line 505 "parser.rl"
664
+ #line 495 "parser.rl"
675
665
  { p--; {p++; cs = 32; goto _out;} }
676
666
  goto st32;
677
667
  st32:
678
668
  if ( ++p == pe )
679
669
  goto _test_eof32;
680
670
  case 32:
681
- #line 682 "parser.c"
671
+ #line 672 "parser.c"
682
672
  goto st0;
683
673
  st10:
684
674
  if ( ++p == pe )
@@ -780,13 +770,13 @@ case 20:
780
770
  if ( 47 <= (*p) && (*p) <= 47 ) {
781
771
  _widec = (short)(128 + ((*p) - -128));
782
772
  if (
783
- #line 492 "parser.rl"
773
+ #line 482 "parser.rl"
784
774
  json->allow_trailing_comma ) _widec += 256;
785
775
  }
786
776
  } else if ( (*p) >= 42 ) {
787
777
  _widec = (short)(128 + ((*p) - -128));
788
778
  if (
789
- #line 492 "parser.rl"
779
+ #line 482 "parser.rl"
790
780
  json->allow_trailing_comma ) _widec += 256;
791
781
  }
792
782
  switch( _widec ) {
@@ -805,20 +795,20 @@ case 21:
805
795
  if ( (*p) <= 41 ) {
806
796
  _widec = (short)(128 + ((*p) - -128));
807
797
  if (
808
- #line 492 "parser.rl"
798
+ #line 482 "parser.rl"
809
799
  json->allow_trailing_comma ) _widec += 256;
810
800
  }
811
801
  } else if ( (*p) > 42 ) {
812
802
  if ( 43 <= (*p) )
813
803
  { _widec = (short)(128 + ((*p) - -128));
814
804
  if (
815
- #line 492 "parser.rl"
805
+ #line 482 "parser.rl"
816
806
  json->allow_trailing_comma ) _widec += 256;
817
807
  }
818
808
  } else {
819
809
  _widec = (short)(128 + ((*p) - -128));
820
810
  if (
821
- #line 492 "parser.rl"
811
+ #line 482 "parser.rl"
822
812
  json->allow_trailing_comma ) _widec += 256;
823
813
  }
824
814
  switch( _widec ) {
@@ -841,13 +831,13 @@ case 22:
841
831
  if ( 42 <= (*p) && (*p) <= 42 ) {
842
832
  _widec = (short)(128 + ((*p) - -128));
843
833
  if (
844
- #line 492 "parser.rl"
834
+ #line 482 "parser.rl"
845
835
  json->allow_trailing_comma ) _widec += 256;
846
836
  }
847
837
  } else {
848
838
  _widec = (short)(128 + ((*p) - -128));
849
839
  if (
850
- #line 492 "parser.rl"
840
+ #line 482 "parser.rl"
851
841
  json->allow_trailing_comma ) _widec += 256;
852
842
  }
853
843
  } else if ( (*p) > 46 ) {
@@ -855,19 +845,19 @@ case 22:
855
845
  if ( 48 <= (*p) )
856
846
  { _widec = (short)(128 + ((*p) - -128));
857
847
  if (
858
- #line 492 "parser.rl"
848
+ #line 482 "parser.rl"
859
849
  json->allow_trailing_comma ) _widec += 256;
860
850
  }
861
851
  } else if ( (*p) >= 47 ) {
862
852
  _widec = (short)(128 + ((*p) - -128));
863
853
  if (
864
- #line 492 "parser.rl"
854
+ #line 482 "parser.rl"
865
855
  json->allow_trailing_comma ) _widec += 256;
866
856
  }
867
857
  } else {
868
858
  _widec = (short)(128 + ((*p) - -128));
869
859
  if (
870
- #line 492 "parser.rl"
860
+ #line 482 "parser.rl"
871
861
  json->allow_trailing_comma ) _widec += 256;
872
862
  }
873
863
  switch( _widec ) {
@@ -891,20 +881,20 @@ case 23:
891
881
  if ( (*p) <= 9 ) {
892
882
  _widec = (short)(128 + ((*p) - -128));
893
883
  if (
894
- #line 492 "parser.rl"
884
+ #line 482 "parser.rl"
895
885
  json->allow_trailing_comma ) _widec += 256;
896
886
  }
897
887
  } else if ( (*p) > 10 ) {
898
888
  if ( 11 <= (*p) )
899
889
  { _widec = (short)(128 + ((*p) - -128));
900
890
  if (
901
- #line 492 "parser.rl"
891
+ #line 482 "parser.rl"
902
892
  json->allow_trailing_comma ) _widec += 256;
903
893
  }
904
894
  } else {
905
895
  _widec = (short)(128 + ((*p) - -128));
906
896
  if (
907
- #line 492 "parser.rl"
897
+ #line 482 "parser.rl"
908
898
  json->allow_trailing_comma ) _widec += 256;
909
899
  }
910
900
  switch( _widec ) {
@@ -1018,7 +1008,7 @@ case 31:
1018
1008
  _out: {}
1019
1009
  }
1020
1010
 
1021
- #line 531 "parser.rl"
1011
+ #line 521 "parser.rl"
1022
1012
 
1023
1013
  if (cs >= JSON_object_first_final) {
1024
1014
  long count = json->stack->head - stack_head;
@@ -1069,7 +1059,7 @@ case 31:
1069
1059
  }
1070
1060
 
1071
1061
 
1072
- #line 1073 "parser.c"
1062
+ #line 1063 "parser.c"
1073
1063
  enum {JSON_value_start = 1};
1074
1064
  enum {JSON_value_first_final = 29};
1075
1065
  enum {JSON_value_error = 0};
@@ -1077,7 +1067,7 @@ enum {JSON_value_error = 0};
1077
1067
  enum {JSON_value_en_main = 1};
1078
1068
 
1079
1069
 
1080
- #line 666 "parser.rl"
1070
+ #line 654 "parser.rl"
1081
1071
 
1082
1072
 
1083
1073
  static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
@@ -1085,14 +1075,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
1085
1075
  int cs = EVIL;
1086
1076
 
1087
1077
 
1088
- #line 1089 "parser.c"
1078
+ #line 1079 "parser.c"
1089
1079
  {
1090
1080
  cs = JSON_value_start;
1091
1081
  }
1092
1082
 
1093
- #line 673 "parser.rl"
1083
+ #line 661 "parser.rl"
1094
1084
 
1095
- #line 1096 "parser.c"
1085
+ #line 1086 "parser.c"
1096
1086
  {
1097
1087
  if ( p == pe )
1098
1088
  goto _test_eof;
@@ -1126,7 +1116,7 @@ st0:
1126
1116
  cs = 0;
1127
1117
  goto _out;
1128
1118
  tr2:
1129
- #line 609 "parser.rl"
1119
+ #line 599 "parser.rl"
1130
1120
  {
1131
1121
  char *np = JSON_parse_string(json, p, pe, result);
1132
1122
  if (np == NULL) {
@@ -1138,7 +1128,7 @@ tr2:
1138
1128
  }
1139
1129
  goto st29;
1140
1130
  tr3:
1141
- #line 619 "parser.rl"
1131
+ #line 609 "parser.rl"
1142
1132
  {
1143
1133
  char *np;
1144
1134
  if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) {
@@ -1150,11 +1140,7 @@ tr3:
1150
1140
  raise_parse_error("unexpected token at '%s'", p);
1151
1141
  }
1152
1142
  }
1153
- np = JSON_parse_float(json, p, pe, result);
1154
- if (np != NULL) {
1155
- {p = (( np))-1;}
1156
- }
1157
- np = JSON_parse_integer(json, p, pe, result);
1143
+ np = JSON_parse_number(json, p, pe, result);
1158
1144
  if (np != NULL) {
1159
1145
  {p = (( np))-1;}
1160
1146
  }
@@ -1162,15 +1148,17 @@ tr3:
1162
1148
  }
1163
1149
  goto st29;
1164
1150
  tr7:
1165
- #line 641 "parser.rl"
1151
+ #line 627 "parser.rl"
1166
1152
  {
1167
1153
  char *np;
1154
+ json->in_array++;
1168
1155
  np = JSON_parse_array(json, p, pe, result, current_nesting + 1);
1156
+ json->in_array--;
1169
1157
  if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;}
1170
1158
  }
1171
1159
  goto st29;
1172
1160
  tr11:
1173
- #line 647 "parser.rl"
1161
+ #line 635 "parser.rl"
1174
1162
  {
1175
1163
  char *np;
1176
1164
  np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
@@ -1178,7 +1166,7 @@ tr11:
1178
1166
  }
1179
1167
  goto st29;
1180
1168
  tr25:
1181
- #line 602 "parser.rl"
1169
+ #line 592 "parser.rl"
1182
1170
  {
1183
1171
  if (json->allow_nan) {
1184
1172
  *result = CInfinity;
@@ -1188,7 +1176,7 @@ tr25:
1188
1176
  }
1189
1177
  goto st29;
1190
1178
  tr27:
1191
- #line 595 "parser.rl"
1179
+ #line 585 "parser.rl"
1192
1180
  {
1193
1181
  if (json->allow_nan) {
1194
1182
  *result = CNaN;
@@ -1198,19 +1186,19 @@ tr27:
1198
1186
  }
1199
1187
  goto st29;
1200
1188
  tr31:
1201
- #line 589 "parser.rl"
1189
+ #line 579 "parser.rl"
1202
1190
  {
1203
1191
  *result = Qfalse;
1204
1192
  }
1205
1193
  goto st29;
1206
1194
  tr34:
1207
- #line 586 "parser.rl"
1195
+ #line 576 "parser.rl"
1208
1196
  {
1209
1197
  *result = Qnil;
1210
1198
  }
1211
1199
  goto st29;
1212
1200
  tr37:
1213
- #line 592 "parser.rl"
1201
+ #line 582 "parser.rl"
1214
1202
  {
1215
1203
  *result = Qtrue;
1216
1204
  }
@@ -1219,9 +1207,9 @@ st29:
1219
1207
  if ( ++p == pe )
1220
1208
  goto _test_eof29;
1221
1209
  case 29:
1222
- #line 653 "parser.rl"
1210
+ #line 641 "parser.rl"
1223
1211
  { p--; {p++; cs = 29; goto _out;} }
1224
- #line 1225 "parser.c"
1212
+ #line 1213 "parser.c"
1225
1213
  switch( (*p) ) {
1226
1214
  case 13: goto st29;
1227
1215
  case 32: goto st29;
@@ -1462,7 +1450,7 @@ case 28:
1462
1450
  _out: {}
1463
1451
  }
1464
1452
 
1465
- #line 674 "parser.rl"
1453
+ #line 662 "parser.rl"
1466
1454
 
1467
1455
  if (json->freeze) {
1468
1456
  OBJ_FREEZE(*result);
@@ -1477,7 +1465,7 @@ case 28:
1477
1465
  }
1478
1466
 
1479
1467
 
1480
- #line 1481 "parser.c"
1468
+ #line 1469 "parser.c"
1481
1469
  enum {JSON_integer_start = 1};
1482
1470
  enum {JSON_integer_first_final = 3};
1483
1471
  enum {JSON_integer_error = 0};
@@ -1485,7 +1473,7 @@ enum {JSON_integer_error = 0};
1485
1473
  enum {JSON_integer_en_main = 1};
1486
1474
 
1487
1475
 
1488
- #line 695 "parser.rl"
1476
+ #line 683 "parser.rl"
1489
1477
 
1490
1478
 
1491
1479
  #define MAX_FAST_INTEGER_SIZE 18
@@ -1510,82 +1498,8 @@ static inline VALUE fast_parse_integer(char *p, char *pe)
1510
1498
  return LL2NUM(memo);
1511
1499
  }
1512
1500
 
1513
- static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
1501
+ static char *JSON_decode_integer(JSON_Parser *json, char *p, VALUE *result)
1514
1502
  {
1515
- int cs = EVIL;
1516
-
1517
-
1518
- #line 1519 "parser.c"
1519
- {
1520
- cs = JSON_integer_start;
1521
- }
1522
-
1523
- #line 724 "parser.rl"
1524
- json->memo = p;
1525
-
1526
- #line 1527 "parser.c"
1527
- {
1528
- if ( p == pe )
1529
- goto _test_eof;
1530
- switch ( cs )
1531
- {
1532
- case 1:
1533
- switch( (*p) ) {
1534
- case 45: goto st2;
1535
- case 48: goto st3;
1536
- }
1537
- if ( 49 <= (*p) && (*p) <= 57 )
1538
- goto st5;
1539
- goto st0;
1540
- st0:
1541
- cs = 0;
1542
- goto _out;
1543
- st2:
1544
- if ( ++p == pe )
1545
- goto _test_eof2;
1546
- case 2:
1547
- if ( (*p) == 48 )
1548
- goto st3;
1549
- if ( 49 <= (*p) && (*p) <= 57 )
1550
- goto st5;
1551
- goto st0;
1552
- st3:
1553
- if ( ++p == pe )
1554
- goto _test_eof3;
1555
- case 3:
1556
- if ( 48 <= (*p) && (*p) <= 57 )
1557
- goto st0;
1558
- goto tr4;
1559
- tr4:
1560
- #line 692 "parser.rl"
1561
- { p--; {p++; cs = 4; goto _out;} }
1562
- goto st4;
1563
- st4:
1564
- if ( ++p == pe )
1565
- goto _test_eof4;
1566
- case 4:
1567
- #line 1568 "parser.c"
1568
- goto st0;
1569
- st5:
1570
- if ( ++p == pe )
1571
- goto _test_eof5;
1572
- case 5:
1573
- if ( 48 <= (*p) && (*p) <= 57 )
1574
- goto st5;
1575
- goto tr4;
1576
- }
1577
- _test_eof2: cs = 2; goto _test_eof;
1578
- _test_eof3: cs = 3; goto _test_eof;
1579
- _test_eof4: cs = 4; goto _test_eof;
1580
- _test_eof5: cs = 5; goto _test_eof;
1581
-
1582
- _test_eof: {}
1583
- _out: {}
1584
- }
1585
-
1586
- #line 726 "parser.rl"
1587
-
1588
- if (cs >= JSON_integer_first_final) {
1589
1503
  long len = p - json->memo;
1590
1504
  if (RB_LIKELY(len < MAX_FAST_INTEGER_SIZE)) {
1591
1505
  *result = fast_parse_integer(json->memo, p);
@@ -1596,37 +1510,35 @@ case 5:
1596
1510
  *result = rb_cstr2inum(FBUFFER_PTR(&json->fbuffer), 10);
1597
1511
  }
1598
1512
  return p + 1;
1599
- } else {
1600
- return NULL;
1601
- }
1602
1513
  }
1603
1514
 
1604
1515
 
1605
- #line 1606 "parser.c"
1516
+ #line 1517 "parser.c"
1606
1517
  enum {JSON_float_start = 1};
1607
- enum {JSON_float_first_final = 8};
1518
+ enum {JSON_float_first_final = 6};
1608
1519
  enum {JSON_float_error = 0};
1609
1520
 
1610
1521
  enum {JSON_float_en_main = 1};
1611
1522
 
1612
1523
 
1613
- #line 755 "parser.rl"
1524
+ #line 735 "parser.rl"
1614
1525
 
1615
1526
 
1616
- static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
1527
+ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *result)
1617
1528
  {
1618
1529
  int cs = EVIL;
1530
+ bool is_float = false;
1619
1531
 
1620
1532
 
1621
- #line 1622 "parser.c"
1533
+ #line 1534 "parser.c"
1622
1534
  {
1623
1535
  cs = JSON_float_start;
1624
1536
  }
1625
1537
 
1626
- #line 762 "parser.rl"
1538
+ #line 743 "parser.rl"
1627
1539
  json->memo = p;
1628
1540
 
1629
- #line 1630 "parser.c"
1541
+ #line 1542 "parser.c"
1630
1542
  {
1631
1543
  if ( p == pe )
1632
1544
  goto _test_eof;
@@ -1635,10 +1547,10 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
1635
1547
  case 1:
1636
1548
  switch( (*p) ) {
1637
1549
  case 45: goto st2;
1638
- case 48: goto st3;
1550
+ case 48: goto st6;
1639
1551
  }
1640
1552
  if ( 49 <= (*p) && (*p) <= 57 )
1641
- goto st7;
1553
+ goto st10;
1642
1554
  goto st0;
1643
1555
  st0:
1644
1556
  cs = 0;
@@ -1648,24 +1560,42 @@ st2:
1648
1560
  goto _test_eof2;
1649
1561
  case 2:
1650
1562
  if ( (*p) == 48 )
1651
- goto st3;
1563
+ goto st6;
1652
1564
  if ( 49 <= (*p) && (*p) <= 57 )
1653
- goto st7;
1565
+ goto st10;
1654
1566
  goto st0;
1655
- st3:
1567
+ st6:
1656
1568
  if ( ++p == pe )
1657
- goto _test_eof3;
1658
- case 3:
1569
+ goto _test_eof6;
1570
+ case 6:
1659
1571
  switch( (*p) ) {
1660
- case 46: goto st4;
1661
- case 69: goto st5;
1662
- case 101: goto st5;
1572
+ case 45: goto st0;
1573
+ case 46: goto tr8;
1574
+ case 69: goto tr9;
1575
+ case 101: goto tr9;
1663
1576
  }
1577
+ if ( 48 <= (*p) && (*p) <= 57 )
1578
+ goto st0;
1579
+ goto tr7;
1580
+ tr7:
1581
+ #line 727 "parser.rl"
1582
+ { p--; {p++; cs = 7; goto _out;} }
1583
+ goto st7;
1584
+ st7:
1585
+ if ( ++p == pe )
1586
+ goto _test_eof7;
1587
+ case 7:
1588
+ #line 1589 "parser.c"
1664
1589
  goto st0;
1665
- st4:
1590
+ tr8:
1591
+ #line 728 "parser.rl"
1592
+ { is_float = true; }
1593
+ goto st3;
1594
+ st3:
1666
1595
  if ( ++p == pe )
1667
- goto _test_eof4;
1668
- case 4:
1596
+ goto _test_eof3;
1597
+ case 3:
1598
+ #line 1599 "parser.c"
1669
1599
  if ( 48 <= (*p) && (*p) <= 57 )
1670
1600
  goto st8;
1671
1601
  goto st0;
@@ -1674,87 +1604,86 @@ st8:
1674
1604
  goto _test_eof8;
1675
1605
  case 8:
1676
1606
  switch( (*p) ) {
1677
- case 69: goto st5;
1678
- case 101: goto st5;
1607
+ case 69: goto st4;
1608
+ case 101: goto st4;
1679
1609
  }
1680
1610
  if ( (*p) > 46 ) {
1681
1611
  if ( 48 <= (*p) && (*p) <= 57 )
1682
1612
  goto st8;
1683
1613
  } else if ( (*p) >= 45 )
1684
1614
  goto st0;
1685
- goto tr9;
1615
+ goto tr7;
1686
1616
  tr9:
1687
- #line 749 "parser.rl"
1688
- { p--; {p++; cs = 9; goto _out;} }
1689
- goto st9;
1690
- st9:
1691
- if ( ++p == pe )
1692
- goto _test_eof9;
1693
- case 9:
1694
- #line 1695 "parser.c"
1695
- goto st0;
1696
- st5:
1617
+ #line 728 "parser.rl"
1618
+ { is_float = true; }
1619
+ goto st4;
1620
+ st4:
1697
1621
  if ( ++p == pe )
1698
- goto _test_eof5;
1699
- case 5:
1622
+ goto _test_eof4;
1623
+ case 4:
1624
+ #line 1625 "parser.c"
1700
1625
  switch( (*p) ) {
1701
- case 43: goto st6;
1702
- case 45: goto st6;
1626
+ case 43: goto st5;
1627
+ case 45: goto st5;
1703
1628
  }
1704
1629
  if ( 48 <= (*p) && (*p) <= 57 )
1705
- goto st10;
1630
+ goto st9;
1706
1631
  goto st0;
1707
- st6:
1632
+ st5:
1708
1633
  if ( ++p == pe )
1709
- goto _test_eof6;
1710
- case 6:
1634
+ goto _test_eof5;
1635
+ case 5:
1711
1636
  if ( 48 <= (*p) && (*p) <= 57 )
1712
- goto st10;
1637
+ goto st9;
1713
1638
  goto st0;
1714
- st10:
1639
+ st9:
1715
1640
  if ( ++p == pe )
1716
- goto _test_eof10;
1717
- case 10:
1641
+ goto _test_eof9;
1642
+ case 9:
1718
1643
  switch( (*p) ) {
1719
1644
  case 69: goto st0;
1720
1645
  case 101: goto st0;
1721
1646
  }
1722
1647
  if ( (*p) > 46 ) {
1723
1648
  if ( 48 <= (*p) && (*p) <= 57 )
1724
- goto st10;
1649
+ goto st9;
1725
1650
  } else if ( (*p) >= 45 )
1726
1651
  goto st0;
1727
- goto tr9;
1728
- st7:
1652
+ goto tr7;
1653
+ st10:
1729
1654
  if ( ++p == pe )
1730
- goto _test_eof7;
1731
- case 7:
1655
+ goto _test_eof10;
1656
+ case 10:
1732
1657
  switch( (*p) ) {
1733
- case 46: goto st4;
1734
- case 69: goto st5;
1735
- case 101: goto st5;
1658
+ case 45: goto st0;
1659
+ case 46: goto tr8;
1660
+ case 69: goto tr9;
1661
+ case 101: goto tr9;
1736
1662
  }
1737
1663
  if ( 48 <= (*p) && (*p) <= 57 )
1738
- goto st7;
1739
- goto st0;
1664
+ goto st10;
1665
+ goto tr7;
1740
1666
  }
1741
1667
  _test_eof2: cs = 2; goto _test_eof;
1668
+ _test_eof6: cs = 6; goto _test_eof;
1669
+ _test_eof7: cs = 7; goto _test_eof;
1742
1670
  _test_eof3: cs = 3; goto _test_eof;
1743
- _test_eof4: cs = 4; goto _test_eof;
1744
1671
  _test_eof8: cs = 8; goto _test_eof;
1745
- _test_eof9: cs = 9; goto _test_eof;
1672
+ _test_eof4: cs = 4; goto _test_eof;
1746
1673
  _test_eof5: cs = 5; goto _test_eof;
1747
- _test_eof6: cs = 6; goto _test_eof;
1674
+ _test_eof9: cs = 9; goto _test_eof;
1748
1675
  _test_eof10: cs = 10; goto _test_eof;
1749
- _test_eof7: cs = 7; goto _test_eof;
1750
1676
 
1751
1677
  _test_eof: {}
1752
1678
  _out: {}
1753
1679
  }
1754
1680
 
1755
- #line 764 "parser.rl"
1681
+ #line 745 "parser.rl"
1756
1682
 
1757
1683
  if (cs >= JSON_float_first_final) {
1684
+ if (!is_float) {
1685
+ return JSON_decode_integer(json, p, result);
1686
+ }
1758
1687
  VALUE mod = Qnil;
1759
1688
  ID method_id = 0;
1760
1689
  if (json->decimal_class) {
@@ -1805,7 +1734,7 @@ case 7:
1805
1734
 
1806
1735
 
1807
1736
 
1808
- #line 1809 "parser.c"
1737
+ #line 1738 "parser.c"
1809
1738
  enum {JSON_array_start = 1};
1810
1739
  enum {JSON_array_first_final = 22};
1811
1740
  enum {JSON_array_error = 0};
@@ -1813,7 +1742,7 @@ enum {JSON_array_error = 0};
1813
1742
  enum {JSON_array_en_main = 1};
1814
1743
 
1815
1744
 
1816
- #line 841 "parser.rl"
1745
+ #line 825 "parser.rl"
1817
1746
 
1818
1747
 
1819
1748
  static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
@@ -1826,14 +1755,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
1826
1755
  long stack_head = json->stack->head;
1827
1756
 
1828
1757
 
1829
- #line 1830 "parser.c"
1758
+ #line 1759 "parser.c"
1830
1759
  {
1831
1760
  cs = JSON_array_start;
1832
1761
  }
1833
1762
 
1834
- #line 853 "parser.rl"
1763
+ #line 837 "parser.rl"
1835
1764
 
1836
- #line 1837 "parser.c"
1765
+ #line 1766 "parser.c"
1837
1766
  {
1838
1767
  short _widec;
1839
1768
  if ( p == pe )
@@ -1873,7 +1802,7 @@ case 2:
1873
1802
  goto st2;
1874
1803
  goto st0;
1875
1804
  tr2:
1876
- #line 821 "parser.rl"
1805
+ #line 805 "parser.rl"
1877
1806
  {
1878
1807
  VALUE v = Qnil;
1879
1808
  char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
@@ -1888,12 +1817,12 @@ st3:
1888
1817
  if ( ++p == pe )
1889
1818
  goto _test_eof3;
1890
1819
  case 3:
1891
- #line 1892 "parser.c"
1820
+ #line 1821 "parser.c"
1892
1821
  _widec = (*p);
1893
1822
  if ( 44 <= (*p) && (*p) <= 44 ) {
1894
1823
  _widec = (short)(128 + ((*p) - -128));
1895
1824
  if (
1896
- #line 831 "parser.rl"
1825
+ #line 815 "parser.rl"
1897
1826
  json->allow_trailing_comma ) _widec += 256;
1898
1827
  }
1899
1828
  switch( _widec ) {
@@ -1940,14 +1869,14 @@ case 7:
1940
1869
  goto st3;
1941
1870
  goto st7;
1942
1871
  tr4:
1943
- #line 833 "parser.rl"
1872
+ #line 817 "parser.rl"
1944
1873
  { p--; {p++; cs = 22; goto _out;} }
1945
1874
  goto st22;
1946
1875
  st22:
1947
1876
  if ( ++p == pe )
1948
1877
  goto _test_eof22;
1949
1878
  case 22:
1950
- #line 1951 "parser.c"
1879
+ #line 1880 "parser.c"
1951
1880
  goto st0;
1952
1881
  st8:
1953
1882
  if ( ++p == pe )
@@ -2015,13 +1944,13 @@ case 13:
2015
1944
  if ( 10 <= (*p) && (*p) <= 10 ) {
2016
1945
  _widec = (short)(128 + ((*p) - -128));
2017
1946
  if (
2018
- #line 831 "parser.rl"
1947
+ #line 815 "parser.rl"
2019
1948
  json->allow_trailing_comma ) _widec += 256;
2020
1949
  }
2021
1950
  } else if ( (*p) >= 9 ) {
2022
1951
  _widec = (short)(128 + ((*p) - -128));
2023
1952
  if (
2024
- #line 831 "parser.rl"
1953
+ #line 815 "parser.rl"
2025
1954
  json->allow_trailing_comma ) _widec += 256;
2026
1955
  }
2027
1956
  } else if ( (*p) > 13 ) {
@@ -2029,19 +1958,19 @@ case 13:
2029
1958
  if ( 47 <= (*p) && (*p) <= 47 ) {
2030
1959
  _widec = (short)(128 + ((*p) - -128));
2031
1960
  if (
2032
- #line 831 "parser.rl"
1961
+ #line 815 "parser.rl"
2033
1962
  json->allow_trailing_comma ) _widec += 256;
2034
1963
  }
2035
1964
  } else if ( (*p) >= 32 ) {
2036
1965
  _widec = (short)(128 + ((*p) - -128));
2037
1966
  if (
2038
- #line 831 "parser.rl"
1967
+ #line 815 "parser.rl"
2039
1968
  json->allow_trailing_comma ) _widec += 256;
2040
1969
  }
2041
1970
  } else {
2042
1971
  _widec = (short)(128 + ((*p) - -128));
2043
1972
  if (
2044
- #line 831 "parser.rl"
1973
+ #line 815 "parser.rl"
2045
1974
  json->allow_trailing_comma ) _widec += 256;
2046
1975
  }
2047
1976
  switch( _widec ) {
@@ -2080,13 +2009,13 @@ case 14:
2080
2009
  if ( 47 <= (*p) && (*p) <= 47 ) {
2081
2010
  _widec = (short)(128 + ((*p) - -128));
2082
2011
  if (
2083
- #line 831 "parser.rl"
2012
+ #line 815 "parser.rl"
2084
2013
  json->allow_trailing_comma ) _widec += 256;
2085
2014
  }
2086
2015
  } else if ( (*p) >= 42 ) {
2087
2016
  _widec = (short)(128 + ((*p) - -128));
2088
2017
  if (
2089
- #line 831 "parser.rl"
2018
+ #line 815 "parser.rl"
2090
2019
  json->allow_trailing_comma ) _widec += 256;
2091
2020
  }
2092
2021
  switch( _widec ) {
@@ -2105,20 +2034,20 @@ case 15:
2105
2034
  if ( (*p) <= 41 ) {
2106
2035
  _widec = (short)(128 + ((*p) - -128));
2107
2036
  if (
2108
- #line 831 "parser.rl"
2037
+ #line 815 "parser.rl"
2109
2038
  json->allow_trailing_comma ) _widec += 256;
2110
2039
  }
2111
2040
  } else if ( (*p) > 42 ) {
2112
2041
  if ( 43 <= (*p) )
2113
2042
  { _widec = (short)(128 + ((*p) - -128));
2114
2043
  if (
2115
- #line 831 "parser.rl"
2044
+ #line 815 "parser.rl"
2116
2045
  json->allow_trailing_comma ) _widec += 256;
2117
2046
  }
2118
2047
  } else {
2119
2048
  _widec = (short)(128 + ((*p) - -128));
2120
2049
  if (
2121
- #line 831 "parser.rl"
2050
+ #line 815 "parser.rl"
2122
2051
  json->allow_trailing_comma ) _widec += 256;
2123
2052
  }
2124
2053
  switch( _widec ) {
@@ -2141,13 +2070,13 @@ case 16:
2141
2070
  if ( 42 <= (*p) && (*p) <= 42 ) {
2142
2071
  _widec = (short)(128 + ((*p) - -128));
2143
2072
  if (
2144
- #line 831 "parser.rl"
2073
+ #line 815 "parser.rl"
2145
2074
  json->allow_trailing_comma ) _widec += 256;
2146
2075
  }
2147
2076
  } else {
2148
2077
  _widec = (short)(128 + ((*p) - -128));
2149
2078
  if (
2150
- #line 831 "parser.rl"
2079
+ #line 815 "parser.rl"
2151
2080
  json->allow_trailing_comma ) _widec += 256;
2152
2081
  }
2153
2082
  } else if ( (*p) > 46 ) {
@@ -2155,19 +2084,19 @@ case 16:
2155
2084
  if ( 48 <= (*p) )
2156
2085
  { _widec = (short)(128 + ((*p) - -128));
2157
2086
  if (
2158
- #line 831 "parser.rl"
2087
+ #line 815 "parser.rl"
2159
2088
  json->allow_trailing_comma ) _widec += 256;
2160
2089
  }
2161
2090
  } else if ( (*p) >= 47 ) {
2162
2091
  _widec = (short)(128 + ((*p) - -128));
2163
2092
  if (
2164
- #line 831 "parser.rl"
2093
+ #line 815 "parser.rl"
2165
2094
  json->allow_trailing_comma ) _widec += 256;
2166
2095
  }
2167
2096
  } else {
2168
2097
  _widec = (short)(128 + ((*p) - -128));
2169
2098
  if (
2170
- #line 831 "parser.rl"
2099
+ #line 815 "parser.rl"
2171
2100
  json->allow_trailing_comma ) _widec += 256;
2172
2101
  }
2173
2102
  switch( _widec ) {
@@ -2191,20 +2120,20 @@ case 17:
2191
2120
  if ( (*p) <= 9 ) {
2192
2121
  _widec = (short)(128 + ((*p) - -128));
2193
2122
  if (
2194
- #line 831 "parser.rl"
2123
+ #line 815 "parser.rl"
2195
2124
  json->allow_trailing_comma ) _widec += 256;
2196
2125
  }
2197
2126
  } else if ( (*p) > 10 ) {
2198
2127
  if ( 11 <= (*p) )
2199
2128
  { _widec = (short)(128 + ((*p) - -128));
2200
2129
  if (
2201
- #line 831 "parser.rl"
2130
+ #line 815 "parser.rl"
2202
2131
  json->allow_trailing_comma ) _widec += 256;
2203
2132
  }
2204
2133
  } else {
2205
2134
  _widec = (short)(128 + ((*p) - -128));
2206
2135
  if (
2207
- #line 831 "parser.rl"
2136
+ #line 815 "parser.rl"
2208
2137
  json->allow_trailing_comma ) _widec += 256;
2209
2138
  }
2210
2139
  switch( _widec ) {
@@ -2276,7 +2205,7 @@ case 21:
2276
2205
  _out: {}
2277
2206
  }
2278
2207
 
2279
- #line 854 "parser.rl"
2208
+ #line 838 "parser.rl"
2280
2209
 
2281
2210
  if(cs >= JSON_array_first_final) {
2282
2211
  long count = json->stack->head - stack_head;
@@ -2332,7 +2261,7 @@ static VALUE json_string_fastpath(JSON_Parser *json, char *string, char *stringE
2332
2261
  {
2333
2262
  size_t bufferSize = stringEnd - string;
2334
2263
 
2335
- if (is_name) {
2264
+ if (is_name && json->in_array) {
2336
2265
  VALUE cached_key;
2337
2266
  if (RB_UNLIKELY(symbolize)) {
2338
2267
  cached_key = rsymbol_cache_fetch(&json->name_cache, string, bufferSize);
@@ -2355,7 +2284,7 @@ static VALUE json_string_unescape(JSON_Parser *json, char *string, char *stringE
2355
2284
  int unescape_len;
2356
2285
  char buf[4];
2357
2286
 
2358
- if (is_name) {
2287
+ if (is_name && json->in_array) {
2359
2288
  VALUE cached_key;
2360
2289
  if (RB_UNLIKELY(symbolize)) {
2361
2290
  cached_key = rsymbol_cache_fetch(&json->name_cache, string, bufferSize);
@@ -2470,7 +2399,7 @@ static VALUE json_string_unescape(JSON_Parser *json, char *string, char *stringE
2470
2399
  }
2471
2400
 
2472
2401
 
2473
- #line 2474 "parser.c"
2402
+ #line 2403 "parser.c"
2474
2403
  enum {JSON_string_start = 1};
2475
2404
  enum {JSON_string_first_final = 9};
2476
2405
  enum {JSON_string_error = 0};
@@ -2478,7 +2407,7 @@ enum {JSON_string_error = 0};
2478
2407
  enum {JSON_string_en_main = 1};
2479
2408
 
2480
2409
 
2481
- #line 1077 "parser.rl"
2410
+ #line 1061 "parser.rl"
2482
2411
 
2483
2412
 
2484
2413
  static int
@@ -2499,15 +2428,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
2499
2428
  VALUE match_string;
2500
2429
 
2501
2430
 
2502
- #line 2503 "parser.c"
2431
+ #line 2432 "parser.c"
2503
2432
  {
2504
2433
  cs = JSON_string_start;
2505
2434
  }
2506
2435
 
2507
- #line 1097 "parser.rl"
2436
+ #line 1081 "parser.rl"
2508
2437
  json->memo = p;
2509
2438
 
2510
- #line 2511 "parser.c"
2439
+ #line 2440 "parser.c"
2511
2440
  {
2512
2441
  if ( p == pe )
2513
2442
  goto _test_eof;
@@ -2532,14 +2461,14 @@ case 2:
2532
2461
  goto st0;
2533
2462
  goto st2;
2534
2463
  tr2:
2535
- #line 1059 "parser.rl"
2464
+ #line 1043 "parser.rl"
2536
2465
  {
2537
2466
  *result = json_string_fastpath(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2538
2467
  {p = (( p + 1))-1;}
2539
2468
  p--;
2540
2469
  {p++; cs = 9; goto _out;}
2541
2470
  }
2542
- #line 1052 "parser.rl"
2471
+ #line 1036 "parser.rl"
2543
2472
  {
2544
2473
  *result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2545
2474
  {p = (( p + 1))-1;}
@@ -2548,7 +2477,7 @@ tr2:
2548
2477
  }
2549
2478
  goto st9;
2550
2479
  tr6:
2551
- #line 1052 "parser.rl"
2480
+ #line 1036 "parser.rl"
2552
2481
  {
2553
2482
  *result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2554
2483
  {p = (( p + 1))-1;}
@@ -2560,7 +2489,7 @@ st9:
2560
2489
  if ( ++p == pe )
2561
2490
  goto _test_eof9;
2562
2491
  case 9:
2563
- #line 2564 "parser.c"
2492
+ #line 2493 "parser.c"
2564
2493
  goto st0;
2565
2494
  st3:
2566
2495
  if ( ++p == pe )
@@ -2648,7 +2577,7 @@ case 8:
2648
2577
  _out: {}
2649
2578
  }
2650
2579
 
2651
- #line 1099 "parser.rl"
2580
+ #line 1083 "parser.rl"
2652
2581
 
2653
2582
  if (json->create_additions && RTEST(match_string = json->match_string)) {
2654
2583
  VALUE klass;
@@ -2801,7 +2730,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
2801
2730
  }
2802
2731
 
2803
2732
 
2804
- #line 2805 "parser.c"
2733
+ #line 2734 "parser.c"
2805
2734
  enum {JSON_start = 1};
2806
2735
  enum {JSON_first_final = 10};
2807
2736
  enum {JSON_error = 0};
@@ -2809,7 +2738,7 @@ enum {JSON_error = 0};
2809
2738
  enum {JSON_en_main = 1};
2810
2739
 
2811
2740
 
2812
- #line 1265 "parser.rl"
2741
+ #line 1249 "parser.rl"
2813
2742
 
2814
2743
 
2815
2744
  /*
@@ -2838,16 +2767,16 @@ static VALUE cParser_parse(VALUE self)
2838
2767
  json->stack = &stack;
2839
2768
 
2840
2769
 
2841
- #line 2842 "parser.c"
2770
+ #line 2771 "parser.c"
2842
2771
  {
2843
2772
  cs = JSON_start;
2844
2773
  }
2845
2774
 
2846
- #line 1293 "parser.rl"
2775
+ #line 1277 "parser.rl"
2847
2776
  p = json->source;
2848
2777
  pe = p + json->len;
2849
2778
 
2850
- #line 2851 "parser.c"
2779
+ #line 2780 "parser.c"
2851
2780
  {
2852
2781
  if ( p == pe )
2853
2782
  goto _test_eof;
@@ -2881,7 +2810,7 @@ st0:
2881
2810
  cs = 0;
2882
2811
  goto _out;
2883
2812
  tr2:
2884
- #line 1257 "parser.rl"
2813
+ #line 1241 "parser.rl"
2885
2814
  {
2886
2815
  char *np = JSON_parse_value(json, p, pe, &result, 0);
2887
2816
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -2891,7 +2820,7 @@ st10:
2891
2820
  if ( ++p == pe )
2892
2821
  goto _test_eof10;
2893
2822
  case 10:
2894
- #line 2895 "parser.c"
2823
+ #line 2824 "parser.c"
2895
2824
  switch( (*p) ) {
2896
2825
  case 13: goto st10;
2897
2826
  case 32: goto st10;
@@ -2980,7 +2909,7 @@ case 9:
2980
2909
  _out: {}
2981
2910
  }
2982
2911
 
2983
- #line 1296 "parser.rl"
2912
+ #line 1280 "parser.rl"
2984
2913
 
2985
2914
  if (json->stack_handle) {
2986
2915
  rvalue_stack_eagerly_release(json->stack_handle);
@@ -3016,16 +2945,16 @@ static VALUE cParser_m_parse(VALUE klass, VALUE source, VALUE opts)
3016
2945
  json->stack = &stack;
3017
2946
 
3018
2947
 
3019
- #line 3020 "parser.c"
2948
+ #line 2949 "parser.c"
3020
2949
  {
3021
2950
  cs = JSON_start;
3022
2951
  }
3023
2952
 
3024
- #line 1331 "parser.rl"
2953
+ #line 1315 "parser.rl"
3025
2954
  p = json->source;
3026
2955
  pe = p + json->len;
3027
2956
 
3028
- #line 3029 "parser.c"
2957
+ #line 2958 "parser.c"
3029
2958
  {
3030
2959
  if ( p == pe )
3031
2960
  goto _test_eof;
@@ -3059,7 +2988,7 @@ st0:
3059
2988
  cs = 0;
3060
2989
  goto _out;
3061
2990
  tr2:
3062
- #line 1257 "parser.rl"
2991
+ #line 1241 "parser.rl"
3063
2992
  {
3064
2993
  char *np = JSON_parse_value(json, p, pe, &result, 0);
3065
2994
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -3069,7 +2998,7 @@ st10:
3069
2998
  if ( ++p == pe )
3070
2999
  goto _test_eof10;
3071
3000
  case 10:
3072
- #line 3073 "parser.c"
3001
+ #line 3002 "parser.c"
3073
3002
  switch( (*p) ) {
3074
3003
  case 13: goto st10;
3075
3004
  case 32: goto st10;
@@ -3158,7 +3087,7 @@ case 9:
3158
3087
  _out: {}
3159
3088
  }
3160
3089
 
3161
- #line 1334 "parser.rl"
3090
+ #line 1318 "parser.rl"
3162
3091
 
3163
3092
  if (json->stack_handle) {
3164
3093
  rvalue_stack_eagerly_release(json->stack_handle);
@@ -3183,8 +3112,10 @@ static void JSON_mark(void *ptr)
3183
3112
  rb_gc_mark(json->match_string);
3184
3113
  rb_gc_mark(json->stack_handle);
3185
3114
 
3186
- const VALUE *name_cache_entries = &json->name_cache.entries[0];
3187
- rb_gc_mark_locations(name_cache_entries, name_cache_entries + json->name_cache.length);
3115
+ long index;
3116
+ for (index = 0; index < json->name_cache.length; index++) {
3117
+ rb_gc_mark(json->name_cache.entries[index]);
3118
+ }
3188
3119
  }
3189
3120
 
3190
3121
  static void JSON_free(void *ptr)