json 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- data/CHANGES +4 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/ext/json/ext/generator/extconf.rb +3 -3
- data/ext/json/ext/parser/extconf.rb +3 -3
- data/ext/json/ext/parser/parser.c +77 -71
- data/ext/json/ext/parser/parser.rl +8 -2
- data/java/src/json/ext/OptionsReader.java +1 -7
- data/java/src/json/ext/Parser.java +207 -156
- data/java/src/json/ext/Parser.rl +127 -76
- data/json.gemspec +4 -4
- data/json_pure.gemspec +4 -4
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +53 -2
- metadata +223 -229
- data/java/lib/bytelist-1.0.6.jar +0 -0
- data/java/lib/jcodings.jar +0 -0
data/CHANGES
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
2011-12-24 (1.6.4)
|
2
|
+
* Patches that improve speed on JRuby contributed by Charles Oliver Nutter
|
3
|
+
<headius@headius.com>.
|
4
|
+
* Support object_class/array_class with duck typed hash/array.
|
1
5
|
2011-12-01 (1.6.3)
|
2
6
|
* Let JSON.load('') return nil as well to make mysql text columns (default to
|
3
7
|
'') work better for serialization.
|
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.4
|
@@ -5,9 +5,9 @@ unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
|
|
5
5
|
end
|
6
6
|
if CONFIG['CC'] =~ /gcc/
|
7
7
|
$CFLAGS << ' -Wall'
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
unless $DEBUG && !$CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
|
9
|
+
$CFLAGS << ' -O0 -ggdb'
|
10
|
+
end
|
11
11
|
end
|
12
12
|
|
13
13
|
create_makefile 'json/ext/generator'
|
@@ -5,9 +5,9 @@ unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
|
|
5
5
|
end
|
6
6
|
if CONFIG['CC'] =~ /gcc/
|
7
7
|
$CFLAGS << ' -Wall'
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if $DEBUG && !$CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
|
9
|
+
$CFLAGS << ' -O0 -ggdb'
|
10
|
+
end
|
11
11
|
end
|
12
12
|
|
13
13
|
create_makefile 'json/ext/parser'
|
@@ -81,7 +81,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity;
|
|
81
81
|
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
82
82
|
i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, i_quirks_mode,
|
83
83
|
i_object_class, i_array_class, i_key_p, i_deep_const_get, i_match,
|
84
|
-
i_match_string, i_aset, i_leftshift;
|
84
|
+
i_match_string, i_aset, i_aref, i_leftshift;
|
85
85
|
|
86
86
|
|
87
87
|
#line 110 "parser.rl"
|
@@ -445,7 +445,12 @@ case 26:
|
|
445
445
|
|
446
446
|
if (cs >= JSON_object_first_final) {
|
447
447
|
if (json->create_additions) {
|
448
|
-
VALUE klassname
|
448
|
+
VALUE klassname;
|
449
|
+
if (NIL_P(json->object_class)) {
|
450
|
+
klassname = rb_hash_aref(*result, json->create_id);
|
451
|
+
} else {
|
452
|
+
klassname = rb_funcall(*result, i_aref, 1, json->create_id);
|
453
|
+
}
|
449
454
|
if (!NIL_P(klassname)) {
|
450
455
|
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
|
451
456
|
if (RTEST(rb_funcall(klass, i_json_creatable_p, 0))) {
|
@@ -461,7 +466,7 @@ case 26:
|
|
461
466
|
|
462
467
|
|
463
468
|
|
464
|
-
#line
|
469
|
+
#line 470 "parser.c"
|
465
470
|
static const int JSON_value_start = 1;
|
466
471
|
static const int JSON_value_first_final = 21;
|
467
472
|
static const int JSON_value_error = 0;
|
@@ -469,7 +474,7 @@ static const int JSON_value_error = 0;
|
|
469
474
|
static const int JSON_value_en_main = 1;
|
470
475
|
|
471
476
|
|
472
|
-
#line
|
477
|
+
#line 271 "parser.rl"
|
473
478
|
|
474
479
|
|
475
480
|
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -477,14 +482,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
477
482
|
int cs = EVIL;
|
478
483
|
|
479
484
|
|
480
|
-
#line
|
485
|
+
#line 486 "parser.c"
|
481
486
|
{
|
482
487
|
cs = JSON_value_start;
|
483
488
|
}
|
484
489
|
|
485
|
-
#line
|
490
|
+
#line 278 "parser.rl"
|
486
491
|
|
487
|
-
#line
|
492
|
+
#line 493 "parser.c"
|
488
493
|
{
|
489
494
|
if ( p == pe )
|
490
495
|
goto _test_eof;
|
@@ -509,14 +514,14 @@ st0:
|
|
509
514
|
cs = 0;
|
510
515
|
goto _out;
|
511
516
|
tr0:
|
512
|
-
#line
|
517
|
+
#line 219 "parser.rl"
|
513
518
|
{
|
514
519
|
char *np = JSON_parse_string(json, p, pe, result);
|
515
520
|
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
516
521
|
}
|
517
522
|
goto st21;
|
518
523
|
tr2:
|
519
|
-
#line
|
524
|
+
#line 224 "parser.rl"
|
520
525
|
{
|
521
526
|
char *np;
|
522
527
|
if(pe > p + 9 - json->quirks_mode && !strncmp(MinusInfinity, p, 9)) {
|
@@ -536,7 +541,7 @@ tr2:
|
|
536
541
|
}
|
537
542
|
goto st21;
|
538
543
|
tr5:
|
539
|
-
#line
|
544
|
+
#line 242 "parser.rl"
|
540
545
|
{
|
541
546
|
char *np;
|
542
547
|
json->current_nesting++;
|
@@ -546,7 +551,7 @@ tr5:
|
|
546
551
|
}
|
547
552
|
goto st21;
|
548
553
|
tr9:
|
549
|
-
#line
|
554
|
+
#line 250 "parser.rl"
|
550
555
|
{
|
551
556
|
char *np;
|
552
557
|
json->current_nesting++;
|
@@ -556,7 +561,7 @@ tr9:
|
|
556
561
|
}
|
557
562
|
goto st21;
|
558
563
|
tr16:
|
559
|
-
#line
|
564
|
+
#line 212 "parser.rl"
|
560
565
|
{
|
561
566
|
if (json->allow_nan) {
|
562
567
|
*result = CInfinity;
|
@@ -566,7 +571,7 @@ tr16:
|
|
566
571
|
}
|
567
572
|
goto st21;
|
568
573
|
tr18:
|
569
|
-
#line
|
574
|
+
#line 205 "parser.rl"
|
570
575
|
{
|
571
576
|
if (json->allow_nan) {
|
572
577
|
*result = CNaN;
|
@@ -576,19 +581,19 @@ tr18:
|
|
576
581
|
}
|
577
582
|
goto st21;
|
578
583
|
tr22:
|
579
|
-
#line
|
584
|
+
#line 199 "parser.rl"
|
580
585
|
{
|
581
586
|
*result = Qfalse;
|
582
587
|
}
|
583
588
|
goto st21;
|
584
589
|
tr25:
|
585
|
-
#line
|
590
|
+
#line 196 "parser.rl"
|
586
591
|
{
|
587
592
|
*result = Qnil;
|
588
593
|
}
|
589
594
|
goto st21;
|
590
595
|
tr28:
|
591
|
-
#line
|
596
|
+
#line 202 "parser.rl"
|
592
597
|
{
|
593
598
|
*result = Qtrue;
|
594
599
|
}
|
@@ -597,9 +602,9 @@ st21:
|
|
597
602
|
if ( ++p == pe )
|
598
603
|
goto _test_eof21;
|
599
604
|
case 21:
|
600
|
-
#line
|
605
|
+
#line 258 "parser.rl"
|
601
606
|
{ p--; {p++; cs = 21; goto _out;} }
|
602
|
-
#line
|
607
|
+
#line 608 "parser.c"
|
603
608
|
goto st0;
|
604
609
|
st2:
|
605
610
|
if ( ++p == pe )
|
@@ -760,7 +765,7 @@ case 20:
|
|
760
765
|
_out: {}
|
761
766
|
}
|
762
767
|
|
763
|
-
#line
|
768
|
+
#line 279 "parser.rl"
|
764
769
|
|
765
770
|
if (cs >= JSON_value_first_final) {
|
766
771
|
return p;
|
@@ -770,7 +775,7 @@ case 20:
|
|
770
775
|
}
|
771
776
|
|
772
777
|
|
773
|
-
#line
|
778
|
+
#line 779 "parser.c"
|
774
779
|
static const int JSON_integer_start = 1;
|
775
780
|
static const int JSON_integer_first_final = 3;
|
776
781
|
static const int JSON_integer_error = 0;
|
@@ -778,7 +783,7 @@ static const int JSON_integer_error = 0;
|
|
778
783
|
static const int JSON_integer_en_main = 1;
|
779
784
|
|
780
785
|
|
781
|
-
#line
|
786
|
+
#line 295 "parser.rl"
|
782
787
|
|
783
788
|
|
784
789
|
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -786,15 +791,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
|
|
786
791
|
int cs = EVIL;
|
787
792
|
|
788
793
|
|
789
|
-
#line
|
794
|
+
#line 795 "parser.c"
|
790
795
|
{
|
791
796
|
cs = JSON_integer_start;
|
792
797
|
}
|
793
798
|
|
794
|
-
#line
|
799
|
+
#line 302 "parser.rl"
|
795
800
|
json->memo = p;
|
796
801
|
|
797
|
-
#line
|
802
|
+
#line 803 "parser.c"
|
798
803
|
{
|
799
804
|
if ( p == pe )
|
800
805
|
goto _test_eof;
|
@@ -828,14 +833,14 @@ case 3:
|
|
828
833
|
goto st0;
|
829
834
|
goto tr4;
|
830
835
|
tr4:
|
831
|
-
#line
|
836
|
+
#line 292 "parser.rl"
|
832
837
|
{ p--; {p++; cs = 4; goto _out;} }
|
833
838
|
goto st4;
|
834
839
|
st4:
|
835
840
|
if ( ++p == pe )
|
836
841
|
goto _test_eof4;
|
837
842
|
case 4:
|
838
|
-
#line
|
843
|
+
#line 844 "parser.c"
|
839
844
|
goto st0;
|
840
845
|
st5:
|
841
846
|
if ( ++p == pe )
|
@@ -854,7 +859,7 @@ case 5:
|
|
854
859
|
_out: {}
|
855
860
|
}
|
856
861
|
|
857
|
-
#line
|
862
|
+
#line 304 "parser.rl"
|
858
863
|
|
859
864
|
if (cs >= JSON_integer_first_final) {
|
860
865
|
long len = p - json->memo;
|
@@ -869,7 +874,7 @@ case 5:
|
|
869
874
|
}
|
870
875
|
|
871
876
|
|
872
|
-
#line
|
877
|
+
#line 878 "parser.c"
|
873
878
|
static const int JSON_float_start = 1;
|
874
879
|
static const int JSON_float_first_final = 8;
|
875
880
|
static const int JSON_float_error = 0;
|
@@ -877,7 +882,7 @@ static const int JSON_float_error = 0;
|
|
877
882
|
static const int JSON_float_en_main = 1;
|
878
883
|
|
879
884
|
|
880
|
-
#line
|
885
|
+
#line 329 "parser.rl"
|
881
886
|
|
882
887
|
|
883
888
|
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -885,15 +890,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
885
890
|
int cs = EVIL;
|
886
891
|
|
887
892
|
|
888
|
-
#line
|
893
|
+
#line 894 "parser.c"
|
889
894
|
{
|
890
895
|
cs = JSON_float_start;
|
891
896
|
}
|
892
897
|
|
893
|
-
#line
|
898
|
+
#line 336 "parser.rl"
|
894
899
|
json->memo = p;
|
895
900
|
|
896
|
-
#line
|
901
|
+
#line 902 "parser.c"
|
897
902
|
{
|
898
903
|
if ( p == pe )
|
899
904
|
goto _test_eof;
|
@@ -951,14 +956,14 @@ case 8:
|
|
951
956
|
goto st0;
|
952
957
|
goto tr9;
|
953
958
|
tr9:
|
954
|
-
#line
|
959
|
+
#line 323 "parser.rl"
|
955
960
|
{ p--; {p++; cs = 9; goto _out;} }
|
956
961
|
goto st9;
|
957
962
|
st9:
|
958
963
|
if ( ++p == pe )
|
959
964
|
goto _test_eof9;
|
960
965
|
case 9:
|
961
|
-
#line
|
966
|
+
#line 967 "parser.c"
|
962
967
|
goto st0;
|
963
968
|
st5:
|
964
969
|
if ( ++p == pe )
|
@@ -1019,7 +1024,7 @@ case 7:
|
|
1019
1024
|
_out: {}
|
1020
1025
|
}
|
1021
1026
|
|
1022
|
-
#line
|
1027
|
+
#line 338 "parser.rl"
|
1023
1028
|
|
1024
1029
|
if (cs >= JSON_float_first_final) {
|
1025
1030
|
long len = p - json->memo;
|
@@ -1035,7 +1040,7 @@ case 7:
|
|
1035
1040
|
|
1036
1041
|
|
1037
1042
|
|
1038
|
-
#line
|
1043
|
+
#line 1044 "parser.c"
|
1039
1044
|
static const int JSON_array_start = 1;
|
1040
1045
|
static const int JSON_array_first_final = 17;
|
1041
1046
|
static const int JSON_array_error = 0;
|
@@ -1043,7 +1048,7 @@ static const int JSON_array_error = 0;
|
|
1043
1048
|
static const int JSON_array_en_main = 1;
|
1044
1049
|
|
1045
1050
|
|
1046
|
-
#line
|
1051
|
+
#line 381 "parser.rl"
|
1047
1052
|
|
1048
1053
|
|
1049
1054
|
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -1057,14 +1062,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
1057
1062
|
*result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
|
1058
1063
|
|
1059
1064
|
|
1060
|
-
#line
|
1065
|
+
#line 1066 "parser.c"
|
1061
1066
|
{
|
1062
1067
|
cs = JSON_array_start;
|
1063
1068
|
}
|
1064
1069
|
|
1065
|
-
#line
|
1070
|
+
#line 394 "parser.rl"
|
1066
1071
|
|
1067
|
-
#line
|
1072
|
+
#line 1073 "parser.c"
|
1068
1073
|
{
|
1069
1074
|
if ( p == pe )
|
1070
1075
|
goto _test_eof;
|
@@ -1103,7 +1108,7 @@ case 2:
|
|
1103
1108
|
goto st2;
|
1104
1109
|
goto st0;
|
1105
1110
|
tr2:
|
1106
|
-
#line
|
1111
|
+
#line 358 "parser.rl"
|
1107
1112
|
{
|
1108
1113
|
VALUE v = Qnil;
|
1109
1114
|
char *np = JSON_parse_value(json, p, pe, &v);
|
@@ -1123,7 +1128,7 @@ st3:
|
|
1123
1128
|
if ( ++p == pe )
|
1124
1129
|
goto _test_eof3;
|
1125
1130
|
case 3:
|
1126
|
-
#line
|
1131
|
+
#line 1132 "parser.c"
|
1127
1132
|
switch( (*p) ) {
|
1128
1133
|
case 13: goto st3;
|
1129
1134
|
case 32: goto st3;
|
@@ -1223,14 +1228,14 @@ case 12:
|
|
1223
1228
|
goto st3;
|
1224
1229
|
goto st12;
|
1225
1230
|
tr4:
|
1226
|
-
#line
|
1231
|
+
#line 373 "parser.rl"
|
1227
1232
|
{ p--; {p++; cs = 17; goto _out;} }
|
1228
1233
|
goto st17;
|
1229
1234
|
st17:
|
1230
1235
|
if ( ++p == pe )
|
1231
1236
|
goto _test_eof17;
|
1232
1237
|
case 17:
|
1233
|
-
#line
|
1238
|
+
#line 1239 "parser.c"
|
1234
1239
|
goto st0;
|
1235
1240
|
st13:
|
1236
1241
|
if ( ++p == pe )
|
@@ -1286,7 +1291,7 @@ case 16:
|
|
1286
1291
|
_out: {}
|
1287
1292
|
}
|
1288
1293
|
|
1289
|
-
#line
|
1294
|
+
#line 395 "parser.rl"
|
1290
1295
|
|
1291
1296
|
if(cs >= JSON_array_first_final) {
|
1292
1297
|
return p + 1;
|
@@ -1367,7 +1372,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
|
|
1367
1372
|
}
|
1368
1373
|
|
1369
1374
|
|
1370
|
-
#line
|
1375
|
+
#line 1376 "parser.c"
|
1371
1376
|
static const int JSON_string_start = 1;
|
1372
1377
|
static const int JSON_string_first_final = 8;
|
1373
1378
|
static const int JSON_string_error = 0;
|
@@ -1375,7 +1380,7 @@ static const int JSON_string_error = 0;
|
|
1375
1380
|
static const int JSON_string_en_main = 1;
|
1376
1381
|
|
1377
1382
|
|
1378
|
-
#line
|
1383
|
+
#line 494 "parser.rl"
|
1379
1384
|
|
1380
1385
|
|
1381
1386
|
static int
|
@@ -1397,15 +1402,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
1397
1402
|
|
1398
1403
|
*result = rb_str_buf_new(0);
|
1399
1404
|
|
1400
|
-
#line
|
1405
|
+
#line 1406 "parser.c"
|
1401
1406
|
{
|
1402
1407
|
cs = JSON_string_start;
|
1403
1408
|
}
|
1404
1409
|
|
1405
|
-
#line
|
1410
|
+
#line 515 "parser.rl"
|
1406
1411
|
json->memo = p;
|
1407
1412
|
|
1408
|
-
#line
|
1413
|
+
#line 1414 "parser.c"
|
1409
1414
|
{
|
1410
1415
|
if ( p == pe )
|
1411
1416
|
goto _test_eof;
|
@@ -1430,7 +1435,7 @@ case 2:
|
|
1430
1435
|
goto st0;
|
1431
1436
|
goto st2;
|
1432
1437
|
tr2:
|
1433
|
-
#line
|
1438
|
+
#line 480 "parser.rl"
|
1434
1439
|
{
|
1435
1440
|
*result = json_string_unescape(*result, json->memo + 1, p);
|
1436
1441
|
if (NIL_P(*result)) {
|
@@ -1441,14 +1446,14 @@ tr2:
|
|
1441
1446
|
{p = (( p + 1))-1;}
|
1442
1447
|
}
|
1443
1448
|
}
|
1444
|
-
#line
|
1449
|
+
#line 491 "parser.rl"
|
1445
1450
|
{ p--; {p++; cs = 8; goto _out;} }
|
1446
1451
|
goto st8;
|
1447
1452
|
st8:
|
1448
1453
|
if ( ++p == pe )
|
1449
1454
|
goto _test_eof8;
|
1450
1455
|
case 8:
|
1451
|
-
#line
|
1456
|
+
#line 1457 "parser.c"
|
1452
1457
|
goto st0;
|
1453
1458
|
st3:
|
1454
1459
|
if ( ++p == pe )
|
@@ -1524,7 +1529,7 @@ case 7:
|
|
1524
1529
|
_out: {}
|
1525
1530
|
}
|
1526
1531
|
|
1527
|
-
#line
|
1532
|
+
#line 517 "parser.rl"
|
1528
1533
|
|
1529
1534
|
if (json->create_additions && RTEST(match_string = json->match_string)) {
|
1530
1535
|
VALUE klass;
|
@@ -1723,7 +1728,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
1723
1728
|
}
|
1724
1729
|
|
1725
1730
|
|
1726
|
-
#line
|
1731
|
+
#line 1732 "parser.c"
|
1727
1732
|
static const int JSON_start = 1;
|
1728
1733
|
static const int JSON_first_final = 10;
|
1729
1734
|
static const int JSON_error = 0;
|
@@ -1731,7 +1736,7 @@ static const int JSON_error = 0;
|
|
1731
1736
|
static const int JSON_en_main = 1;
|
1732
1737
|
|
1733
1738
|
|
1734
|
-
#line
|
1739
|
+
#line 739 "parser.rl"
|
1735
1740
|
|
1736
1741
|
|
1737
1742
|
static VALUE cParser_parse_strict(VALUE self)
|
@@ -1742,16 +1747,16 @@ static VALUE cParser_parse_strict(VALUE self)
|
|
1742
1747
|
GET_PARSER;
|
1743
1748
|
|
1744
1749
|
|
1745
|
-
#line
|
1750
|
+
#line 1751 "parser.c"
|
1746
1751
|
{
|
1747
1752
|
cs = JSON_start;
|
1748
1753
|
}
|
1749
1754
|
|
1750
|
-
#line
|
1755
|
+
#line 749 "parser.rl"
|
1751
1756
|
p = json->source;
|
1752
1757
|
pe = p + json->len;
|
1753
1758
|
|
1754
|
-
#line
|
1759
|
+
#line 1760 "parser.c"
|
1755
1760
|
{
|
1756
1761
|
if ( p == pe )
|
1757
1762
|
goto _test_eof;
|
@@ -1807,7 +1812,7 @@ case 5:
|
|
1807
1812
|
goto st1;
|
1808
1813
|
goto st5;
|
1809
1814
|
tr3:
|
1810
|
-
#line
|
1815
|
+
#line 728 "parser.rl"
|
1811
1816
|
{
|
1812
1817
|
char *np;
|
1813
1818
|
json->current_nesting = 1;
|
@@ -1816,7 +1821,7 @@ tr3:
|
|
1816
1821
|
}
|
1817
1822
|
goto st10;
|
1818
1823
|
tr4:
|
1819
|
-
#line
|
1824
|
+
#line 721 "parser.rl"
|
1820
1825
|
{
|
1821
1826
|
char *np;
|
1822
1827
|
json->current_nesting = 1;
|
@@ -1828,7 +1833,7 @@ st10:
|
|
1828
1833
|
if ( ++p == pe )
|
1829
1834
|
goto _test_eof10;
|
1830
1835
|
case 10:
|
1831
|
-
#line
|
1836
|
+
#line 1837 "parser.c"
|
1832
1837
|
switch( (*p) ) {
|
1833
1838
|
case 13: goto st10;
|
1834
1839
|
case 32: goto st10;
|
@@ -1885,7 +1890,7 @@ case 9:
|
|
1885
1890
|
_out: {}
|
1886
1891
|
}
|
1887
1892
|
|
1888
|
-
#line
|
1893
|
+
#line 752 "parser.rl"
|
1889
1894
|
|
1890
1895
|
if (cs >= JSON_first_final && p == pe) {
|
1891
1896
|
return result;
|
@@ -1897,7 +1902,7 @@ case 9:
|
|
1897
1902
|
|
1898
1903
|
|
1899
1904
|
|
1900
|
-
#line
|
1905
|
+
#line 1906 "parser.c"
|
1901
1906
|
static const int JSON_quirks_mode_start = 1;
|
1902
1907
|
static const int JSON_quirks_mode_first_final = 10;
|
1903
1908
|
static const int JSON_quirks_mode_error = 0;
|
@@ -1905,7 +1910,7 @@ static const int JSON_quirks_mode_error = 0;
|
|
1905
1910
|
static const int JSON_quirks_mode_en_main = 1;
|
1906
1911
|
|
1907
1912
|
|
1908
|
-
#line
|
1913
|
+
#line 777 "parser.rl"
|
1909
1914
|
|
1910
1915
|
|
1911
1916
|
static VALUE cParser_parse_quirks_mode(VALUE self)
|
@@ -1916,16 +1921,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
|
|
1916
1921
|
GET_PARSER;
|
1917
1922
|
|
1918
1923
|
|
1919
|
-
#line
|
1924
|
+
#line 1925 "parser.c"
|
1920
1925
|
{
|
1921
1926
|
cs = JSON_quirks_mode_start;
|
1922
1927
|
}
|
1923
1928
|
|
1924
|
-
#line
|
1929
|
+
#line 787 "parser.rl"
|
1925
1930
|
p = json->source;
|
1926
1931
|
pe = p + json->len;
|
1927
1932
|
|
1928
|
-
#line
|
1933
|
+
#line 1934 "parser.c"
|
1929
1934
|
{
|
1930
1935
|
if ( p == pe )
|
1931
1936
|
goto _test_eof;
|
@@ -1959,7 +1964,7 @@ st0:
|
|
1959
1964
|
cs = 0;
|
1960
1965
|
goto _out;
|
1961
1966
|
tr2:
|
1962
|
-
#line
|
1967
|
+
#line 769 "parser.rl"
|
1963
1968
|
{
|
1964
1969
|
char *np = JSON_parse_value(json, p, pe, &result);
|
1965
1970
|
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
@@ -1969,7 +1974,7 @@ st10:
|
|
1969
1974
|
if ( ++p == pe )
|
1970
1975
|
goto _test_eof10;
|
1971
1976
|
case 10:
|
1972
|
-
#line
|
1977
|
+
#line 1978 "parser.c"
|
1973
1978
|
switch( (*p) ) {
|
1974
1979
|
case 13: goto st10;
|
1975
1980
|
case 32: goto st10;
|
@@ -2058,7 +2063,7 @@ case 9:
|
|
2058
2063
|
_out: {}
|
2059
2064
|
}
|
2060
2065
|
|
2061
|
-
#line
|
2066
|
+
#line 790 "parser.rl"
|
2062
2067
|
|
2063
2068
|
if (cs >= JSON_quirks_mode_first_final && p == pe) {
|
2064
2069
|
return result;
|
@@ -2173,6 +2178,7 @@ void Init_parser()
|
|
2173
2178
|
i_key_p = rb_intern("key?");
|
2174
2179
|
i_deep_const_get = rb_intern("deep_const_get");
|
2175
2180
|
i_aset = rb_intern("[]=");
|
2181
|
+
i_aref = rb_intern("[]");
|
2176
2182
|
i_leftshift = rb_intern("<<");
|
2177
2183
|
#ifdef HAVE_RUBY_ENCODING_H
|
2178
2184
|
CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
|