json-maglev- 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- 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 +47 -75
- 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;
|
@@ -1733,7 +1738,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
1733
1738
|
}
|
1734
1739
|
|
1735
1740
|
|
1736
|
-
#line
|
1741
|
+
#line 1742 "parser.c"
|
1737
1742
|
static const int JSON_start = 1;
|
1738
1743
|
static const int JSON_first_final = 10;
|
1739
1744
|
static const int JSON_error = 0;
|
@@ -1741,7 +1746,7 @@ static const int JSON_error = 0;
|
|
1741
1746
|
static const int JSON_en_main = 1;
|
1742
1747
|
|
1743
1748
|
|
1744
|
-
#line
|
1749
|
+
#line 749 "parser.rl"
|
1745
1750
|
|
1746
1751
|
|
1747
1752
|
static VALUE cParser_parse_strict(VALUE self)
|
@@ -1752,16 +1757,16 @@ static VALUE cParser_parse_strict(VALUE self)
|
|
1752
1757
|
GET_PARSER;
|
1753
1758
|
|
1754
1759
|
|
1755
|
-
#line
|
1760
|
+
#line 1761 "parser.c"
|
1756
1761
|
{
|
1757
1762
|
cs = JSON_start;
|
1758
1763
|
}
|
1759
1764
|
|
1760
|
-
#line
|
1765
|
+
#line 759 "parser.rl"
|
1761
1766
|
p = json->source;
|
1762
1767
|
pe = p + json->len;
|
1763
1768
|
|
1764
|
-
#line
|
1769
|
+
#line 1770 "parser.c"
|
1765
1770
|
{
|
1766
1771
|
if ( p == pe )
|
1767
1772
|
goto _test_eof;
|
@@ -1817,7 +1822,7 @@ case 5:
|
|
1817
1822
|
goto st1;
|
1818
1823
|
goto st5;
|
1819
1824
|
tr3:
|
1820
|
-
#line
|
1825
|
+
#line 738 "parser.rl"
|
1821
1826
|
{
|
1822
1827
|
char *np;
|
1823
1828
|
json->current_nesting = 1;
|
@@ -1826,7 +1831,7 @@ tr3:
|
|
1826
1831
|
}
|
1827
1832
|
goto st10;
|
1828
1833
|
tr4:
|
1829
|
-
#line
|
1834
|
+
#line 731 "parser.rl"
|
1830
1835
|
{
|
1831
1836
|
char *np;
|
1832
1837
|
json->current_nesting = 1;
|
@@ -1838,7 +1843,7 @@ st10:
|
|
1838
1843
|
if ( ++p == pe )
|
1839
1844
|
goto _test_eof10;
|
1840
1845
|
case 10:
|
1841
|
-
#line
|
1846
|
+
#line 1847 "parser.c"
|
1842
1847
|
switch( (*p) ) {
|
1843
1848
|
case 13: goto st10;
|
1844
1849
|
case 32: goto st10;
|
@@ -1895,7 +1900,7 @@ case 9:
|
|
1895
1900
|
_out: {}
|
1896
1901
|
}
|
1897
1902
|
|
1898
|
-
#line
|
1903
|
+
#line 762 "parser.rl"
|
1899
1904
|
|
1900
1905
|
if (cs >= JSON_first_final && p == pe) {
|
1901
1906
|
return result;
|
@@ -1907,7 +1912,7 @@ case 9:
|
|
1907
1912
|
|
1908
1913
|
|
1909
1914
|
|
1910
|
-
#line
|
1915
|
+
#line 1916 "parser.c"
|
1911
1916
|
static const int JSON_quirks_mode_start = 1;
|
1912
1917
|
static const int JSON_quirks_mode_first_final = 10;
|
1913
1918
|
static const int JSON_quirks_mode_error = 0;
|
@@ -1915,7 +1920,7 @@ static const int JSON_quirks_mode_error = 0;
|
|
1915
1920
|
static const int JSON_quirks_mode_en_main = 1;
|
1916
1921
|
|
1917
1922
|
|
1918
|
-
#line
|
1923
|
+
#line 787 "parser.rl"
|
1919
1924
|
|
1920
1925
|
|
1921
1926
|
static VALUE cParser_parse_quirks_mode(VALUE self)
|
@@ -1926,16 +1931,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self)
|
|
1926
1931
|
GET_PARSER;
|
1927
1932
|
|
1928
1933
|
|
1929
|
-
#line
|
1934
|
+
#line 1935 "parser.c"
|
1930
1935
|
{
|
1931
1936
|
cs = JSON_quirks_mode_start;
|
1932
1937
|
}
|
1933
1938
|
|
1934
|
-
#line
|
1939
|
+
#line 797 "parser.rl"
|
1935
1940
|
p = json->source;
|
1936
1941
|
pe = p + json->len;
|
1937
1942
|
|
1938
|
-
#line
|
1943
|
+
#line 1944 "parser.c"
|
1939
1944
|
{
|
1940
1945
|
if ( p == pe )
|
1941
1946
|
goto _test_eof;
|
@@ -1969,7 +1974,7 @@ st0:
|
|
1969
1974
|
cs = 0;
|
1970
1975
|
goto _out;
|
1971
1976
|
tr2:
|
1972
|
-
#line
|
1977
|
+
#line 779 "parser.rl"
|
1973
1978
|
{
|
1974
1979
|
char *np = JSON_parse_value(json, p, pe, &result);
|
1975
1980
|
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
@@ -1979,7 +1984,7 @@ st10:
|
|
1979
1984
|
if ( ++p == pe )
|
1980
1985
|
goto _test_eof10;
|
1981
1986
|
case 10:
|
1982
|
-
#line
|
1987
|
+
#line 1988 "parser.c"
|
1983
1988
|
switch( (*p) ) {
|
1984
1989
|
case 13: goto st10;
|
1985
1990
|
case 32: goto st10;
|
@@ -2068,7 +2073,7 @@ case 9:
|
|
2068
2073
|
_out: {}
|
2069
2074
|
}
|
2070
2075
|
|
2071
|
-
#line
|
2076
|
+
#line 800 "parser.rl"
|
2072
2077
|
|
2073
2078
|
if (cs >= JSON_quirks_mode_first_final && p == pe) {
|
2074
2079
|
return result;
|
@@ -2189,6 +2194,7 @@ void Init_parser()
|
|
2189
2194
|
i_key_p = rb_intern("key?");
|
2190
2195
|
i_deep_const_get = rb_intern("deep_const_get");
|
2191
2196
|
i_aset = rb_intern("[]=");
|
2197
|
+
i_aref = rb_intern("[]");
|
2192
2198
|
i_leftshift = rb_intern("<<");
|
2193
2199
|
#ifdef HAVE_RUBY_ENCODING_H
|
2194
2200
|
CEncoding_UTF_8 = rb_funcall(rb_path2class("Encoding"), rb_intern("find"), 1, rb_str_new2("utf-8"));
|