json 2.0.4 → 2.1.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGES.md +3 -0
- data/Gemfile +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/ext/json/ext/parser/parser.c +93 -76
- data/ext/json/ext/parser/parser.h +1 -0
- data/ext/json/ext/parser/parser.rl +20 -3
- data/java/src/json/ext/Parser.java +92 -77
- data/java/src/json/ext/Parser.rl +24 -9
- data/json.gemspec +0 -0
- data/json_pure.gemspec +3 -3
- data/lib/json/pure/parser.rb +5 -1
- data/lib/json/version.rb +1 -1
- data/tests/json_encoding_test.rb +2 -2
- data/tests/json_parser_test.rb +5 -0
- metadata +2 -2
@@ -92,8 +92,9 @@ static VALUE CNaN, CInfinity, CMinusInfinity;
|
|
92
92
|
|
93
93
|
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
94
94
|
i_chr, i_max_nesting, i_allow_nan, i_symbolize_names,
|
95
|
-
i_object_class, i_array_class,
|
96
|
-
i_match_string, i_aset, i_aref,
|
95
|
+
i_object_class, i_array_class, i_decimal_class, i_key_p,
|
96
|
+
i_deep_const_get, i_match, i_match_string, i_aset, i_aref,
|
97
|
+
i_leftshift, i_new;
|
97
98
|
|
98
99
|
%%{
|
99
100
|
machine JSON_common;
|
@@ -351,7 +352,13 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
351
352
|
fbuffer_clear(json->fbuffer);
|
352
353
|
fbuffer_append(json->fbuffer, json->memo, len);
|
353
354
|
fbuffer_append_char(json->fbuffer, '\0');
|
354
|
-
|
355
|
+
if (NIL_P(json->decimal_class)) {
|
356
|
+
*result = rb_float_new(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1));
|
357
|
+
} else {
|
358
|
+
VALUE text;
|
359
|
+
text = rb_str_new2(FBUFFER_PTR(json->fbuffer));
|
360
|
+
*result = rb_funcall(json->decimal_class, i_new, 1, text);
|
361
|
+
}
|
355
362
|
return p + 1;
|
356
363
|
} else {
|
357
364
|
return NULL;
|
@@ -684,6 +691,12 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
684
691
|
} else {
|
685
692
|
json->array_class = Qnil;
|
686
693
|
}
|
694
|
+
tmp = ID2SYM(i_decimal_class);
|
695
|
+
if (option_given_p(opts, tmp)) {
|
696
|
+
json->decimal_class = rb_hash_aref(opts, tmp);
|
697
|
+
} else {
|
698
|
+
json->decimal_class = Qnil;
|
699
|
+
}
|
687
700
|
tmp = ID2SYM(i_match_string);
|
688
701
|
if (option_given_p(opts, tmp)) {
|
689
702
|
VALUE match_string = rb_hash_aref(opts, tmp);
|
@@ -701,6 +714,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
701
714
|
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
702
715
|
json->object_class = Qnil;
|
703
716
|
json->array_class = Qnil;
|
717
|
+
json->decimal_class = Qnil;
|
704
718
|
}
|
705
719
|
source = convert_encoding(StringValue(source));
|
706
720
|
StringValue(source);
|
@@ -760,6 +774,7 @@ static void JSON_mark(void *ptr)
|
|
760
774
|
rb_gc_mark_maybe(json->create_id);
|
761
775
|
rb_gc_mark_maybe(json->object_class);
|
762
776
|
rb_gc_mark_maybe(json->array_class);
|
777
|
+
rb_gc_mark_maybe(json->decimal_class);
|
763
778
|
rb_gc_mark_maybe(json->match_string);
|
764
779
|
}
|
765
780
|
|
@@ -834,6 +849,7 @@ void Init_parser(void)
|
|
834
849
|
i_symbolize_names = rb_intern("symbolize_names");
|
835
850
|
i_object_class = rb_intern("object_class");
|
836
851
|
i_array_class = rb_intern("array_class");
|
852
|
+
i_decimal_class = rb_intern("decimal_class");
|
837
853
|
i_match = rb_intern("match");
|
838
854
|
i_match_string = rb_intern("match_string");
|
839
855
|
i_key_p = rb_intern("key?");
|
@@ -841,6 +857,7 @@ void Init_parser(void)
|
|
841
857
|
i_aset = rb_intern("[]=");
|
842
858
|
i_aref = rb_intern("[]");
|
843
859
|
i_leftshift = rb_intern("<<");
|
860
|
+
i_new = rb_intern("new");
|
844
861
|
}
|
845
862
|
|
846
863
|
/*
|
@@ -54,6 +54,7 @@ public class Parser extends RubyObject {
|
|
54
54
|
private boolean symbolizeNames;
|
55
55
|
private RubyClass objectClass;
|
56
56
|
private RubyClass arrayClass;
|
57
|
+
private RubyClass decimalClass;
|
57
58
|
private RubyHash matchString;
|
58
59
|
|
59
60
|
private static final int DEFAULT_MAX_NESTING = 100;
|
@@ -133,6 +134,10 @@ public class Parser extends RubyObject {
|
|
133
134
|
* <dt><code>:array_class</code>
|
134
135
|
* <dd>Defaults to Array.
|
135
136
|
*
|
137
|
+
* <dt><code>:decimal_class</code>
|
138
|
+
* <dd>Specifies which class to use instead of the default (Float) when
|
139
|
+
* parsing decimal numbers. This class must accept a single string argument
|
140
|
+
* in its constructor.
|
136
141
|
* </dl>
|
137
142
|
*/
|
138
143
|
@JRubyMethod(name = "new", required = 1, optional = 1, meta = true)
|
@@ -159,6 +164,7 @@ public class Parser extends RubyObject {
|
|
159
164
|
this.createAdditions = opts.getBool("create_additions", false);
|
160
165
|
this.objectClass = opts.getClass("object_class", runtime.getHash());
|
161
166
|
this.arrayClass = opts.getClass("array_class", runtime.getArray());
|
167
|
+
this.decimalClass = opts.getClass("decimal_class", null);
|
162
168
|
this.matchString = opts.getHash("match_string");
|
163
169
|
|
164
170
|
if(symbolizeNames && createAdditions) {
|
@@ -307,11 +313,11 @@ public class Parser extends RubyObject {
|
|
307
313
|
}
|
308
314
|
|
309
315
|
|
310
|
-
// line
|
316
|
+
// line 339 "Parser.rl"
|
311
317
|
|
312
318
|
|
313
319
|
|
314
|
-
// line
|
320
|
+
// line 321 "Parser.java"
|
315
321
|
private static byte[] init__JSON_value_actions_0()
|
316
322
|
{
|
317
323
|
return new byte [] {
|
@@ -425,7 +431,7 @@ static final int JSON_value_error = 0;
|
|
425
431
|
static final int JSON_value_en_main = 1;
|
426
432
|
|
427
433
|
|
428
|
-
// line
|
434
|
+
// line 445 "Parser.rl"
|
429
435
|
|
430
436
|
|
431
437
|
void parseValue(ParserResult res, int p, int pe) {
|
@@ -433,14 +439,14 @@ static final int JSON_value_en_main = 1;
|
|
433
439
|
IRubyObject result = null;
|
434
440
|
|
435
441
|
|
436
|
-
// line
|
442
|
+
// line 443 "Parser.java"
|
437
443
|
{
|
438
444
|
cs = JSON_value_start;
|
439
445
|
}
|
440
446
|
|
441
|
-
// line
|
447
|
+
// line 452 "Parser.rl"
|
442
448
|
|
443
|
-
// line
|
449
|
+
// line 450 "Parser.java"
|
444
450
|
{
|
445
451
|
int _klen;
|
446
452
|
int _trans = 0;
|
@@ -466,13 +472,13 @@ case 1:
|
|
466
472
|
while ( _nacts-- > 0 ) {
|
467
473
|
switch ( _JSON_value_actions[_acts++] ) {
|
468
474
|
case 9:
|
469
|
-
// line
|
475
|
+
// line 430 "Parser.rl"
|
470
476
|
{
|
471
477
|
p--;
|
472
478
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
473
479
|
}
|
474
480
|
break;
|
475
|
-
// line
|
481
|
+
// line 482 "Parser.java"
|
476
482
|
}
|
477
483
|
}
|
478
484
|
|
@@ -535,25 +541,25 @@ case 1:
|
|
535
541
|
switch ( _JSON_value_actions[_acts++] )
|
536
542
|
{
|
537
543
|
case 0:
|
538
|
-
// line
|
544
|
+
// line 347 "Parser.rl"
|
539
545
|
{
|
540
546
|
result = getRuntime().getNil();
|
541
547
|
}
|
542
548
|
break;
|
543
549
|
case 1:
|
544
|
-
// line
|
550
|
+
// line 350 "Parser.rl"
|
545
551
|
{
|
546
552
|
result = getRuntime().getFalse();
|
547
553
|
}
|
548
554
|
break;
|
549
555
|
case 2:
|
550
|
-
// line
|
556
|
+
// line 353 "Parser.rl"
|
551
557
|
{
|
552
558
|
result = getRuntime().getTrue();
|
553
559
|
}
|
554
560
|
break;
|
555
561
|
case 3:
|
556
|
-
// line
|
562
|
+
// line 356 "Parser.rl"
|
557
563
|
{
|
558
564
|
if (parser.allowNaN) {
|
559
565
|
result = getConstant(CONST_NAN);
|
@@ -563,7 +569,7 @@ case 1:
|
|
563
569
|
}
|
564
570
|
break;
|
565
571
|
case 4:
|
566
|
-
// line
|
572
|
+
// line 363 "Parser.rl"
|
567
573
|
{
|
568
574
|
if (parser.allowNaN) {
|
569
575
|
result = getConstant(CONST_INFINITY);
|
@@ -573,7 +579,7 @@ case 1:
|
|
573
579
|
}
|
574
580
|
break;
|
575
581
|
case 5:
|
576
|
-
// line
|
582
|
+
// line 370 "Parser.rl"
|
577
583
|
{
|
578
584
|
if (pe > p + 8 &&
|
579
585
|
absSubSequence(p, p + 9).equals(JSON_MINUS_INFINITY)) {
|
@@ -602,7 +608,7 @@ case 1:
|
|
602
608
|
}
|
603
609
|
break;
|
604
610
|
case 6:
|
605
|
-
// line
|
611
|
+
// line 396 "Parser.rl"
|
606
612
|
{
|
607
613
|
parseString(res, p, pe);
|
608
614
|
if (res.result == null) {
|
@@ -615,7 +621,7 @@ case 1:
|
|
615
621
|
}
|
616
622
|
break;
|
617
623
|
case 7:
|
618
|
-
// line
|
624
|
+
// line 406 "Parser.rl"
|
619
625
|
{
|
620
626
|
currentNesting++;
|
621
627
|
parseArray(res, p, pe);
|
@@ -630,7 +636,7 @@ case 1:
|
|
630
636
|
}
|
631
637
|
break;
|
632
638
|
case 8:
|
633
|
-
// line
|
639
|
+
// line 418 "Parser.rl"
|
634
640
|
{
|
635
641
|
currentNesting++;
|
636
642
|
parseObject(res, p, pe);
|
@@ -644,7 +650,7 @@ case 1:
|
|
644
650
|
}
|
645
651
|
}
|
646
652
|
break;
|
647
|
-
// line
|
653
|
+
// line 654 "Parser.java"
|
648
654
|
}
|
649
655
|
}
|
650
656
|
}
|
@@ -664,7 +670,7 @@ case 5:
|
|
664
670
|
break; }
|
665
671
|
}
|
666
672
|
|
667
|
-
// line
|
673
|
+
// line 453 "Parser.rl"
|
668
674
|
|
669
675
|
if (cs >= JSON_value_first_final && result != null) {
|
670
676
|
res.update(result, p);
|
@@ -674,7 +680,7 @@ case 5:
|
|
674
680
|
}
|
675
681
|
|
676
682
|
|
677
|
-
// line
|
683
|
+
// line 684 "Parser.java"
|
678
684
|
private static byte[] init__JSON_integer_actions_0()
|
679
685
|
{
|
680
686
|
return new byte [] {
|
@@ -773,7 +779,7 @@ static final int JSON_integer_error = 0;
|
|
773
779
|
static final int JSON_integer_en_main = 1;
|
774
780
|
|
775
781
|
|
776
|
-
// line
|
782
|
+
// line 472 "Parser.rl"
|
777
783
|
|
778
784
|
|
779
785
|
void parseInteger(ParserResult res, int p, int pe) {
|
@@ -791,15 +797,15 @@ static final int JSON_integer_en_main = 1;
|
|
791
797
|
int cs = EVIL;
|
792
798
|
|
793
799
|
|
794
|
-
// line
|
800
|
+
// line 801 "Parser.java"
|
795
801
|
{
|
796
802
|
cs = JSON_integer_start;
|
797
803
|
}
|
798
804
|
|
799
|
-
// line
|
805
|
+
// line 489 "Parser.rl"
|
800
806
|
int memo = p;
|
801
807
|
|
802
|
-
// line
|
808
|
+
// line 809 "Parser.java"
|
803
809
|
{
|
804
810
|
int _klen;
|
805
811
|
int _trans = 0;
|
@@ -880,13 +886,13 @@ case 1:
|
|
880
886
|
switch ( _JSON_integer_actions[_acts++] )
|
881
887
|
{
|
882
888
|
case 0:
|
883
|
-
// line
|
889
|
+
// line 466 "Parser.rl"
|
884
890
|
{
|
885
891
|
p--;
|
886
892
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
887
893
|
}
|
888
894
|
break;
|
889
|
-
// line
|
895
|
+
// line 896 "Parser.java"
|
890
896
|
}
|
891
897
|
}
|
892
898
|
}
|
@@ -906,7 +912,7 @@ case 5:
|
|
906
912
|
break; }
|
907
913
|
}
|
908
914
|
|
909
|
-
// line
|
915
|
+
// line 491 "Parser.rl"
|
910
916
|
|
911
917
|
if (cs < JSON_integer_first_final) {
|
912
918
|
return -1;
|
@@ -914,13 +920,13 @@ case 5:
|
|
914
920
|
|
915
921
|
return p;
|
916
922
|
}
|
917
|
-
|
923
|
+
|
918
924
|
RubyInteger createInteger(int p, int new_p) {
|
919
925
|
Ruby runtime = getRuntime();
|
920
926
|
ByteList num = absSubSequence(p, new_p);
|
921
927
|
return bytesToInum(runtime, num);
|
922
928
|
}
|
923
|
-
|
929
|
+
|
924
930
|
RubyInteger bytesToInum(Ruby runtime, ByteList num) {
|
925
931
|
return runtime.is1_9() ?
|
926
932
|
ConvertBytes.byteListToInum19(runtime, num, 10, true) :
|
@@ -928,7 +934,7 @@ case 5:
|
|
928
934
|
}
|
929
935
|
|
930
936
|
|
931
|
-
// line
|
937
|
+
// line 938 "Parser.java"
|
932
938
|
private static byte[] init__JSON_float_actions_0()
|
933
939
|
{
|
934
940
|
return new byte [] {
|
@@ -1030,7 +1036,7 @@ static final int JSON_float_error = 0;
|
|
1030
1036
|
static final int JSON_float_en_main = 1;
|
1031
1037
|
|
1032
1038
|
|
1033
|
-
// line
|
1039
|
+
// line 526 "Parser.rl"
|
1034
1040
|
|
1035
1041
|
|
1036
1042
|
void parseFloat(ParserResult res, int p, int pe) {
|
@@ -1039,7 +1045,9 @@ static final int JSON_float_en_main = 1;
|
|
1039
1045
|
res.update(null, p);
|
1040
1046
|
return;
|
1041
1047
|
}
|
1042
|
-
|
1048
|
+
IRubyObject number = parser.decimalClass == null ?
|
1049
|
+
createFloat(p, new_p) : createCustomDecimal(p, new_p);
|
1050
|
+
|
1043
1051
|
res.update(number, new_p + 1);
|
1044
1052
|
return;
|
1045
1053
|
}
|
@@ -1048,15 +1056,15 @@ static final int JSON_float_en_main = 1;
|
|
1048
1056
|
int cs = EVIL;
|
1049
1057
|
|
1050
1058
|
|
1051
|
-
// line
|
1059
|
+
// line 1060 "Parser.java"
|
1052
1060
|
{
|
1053
1061
|
cs = JSON_float_start;
|
1054
1062
|
}
|
1055
1063
|
|
1056
|
-
// line
|
1064
|
+
// line 545 "Parser.rl"
|
1057
1065
|
int memo = p;
|
1058
1066
|
|
1059
|
-
// line
|
1067
|
+
// line 1068 "Parser.java"
|
1060
1068
|
{
|
1061
1069
|
int _klen;
|
1062
1070
|
int _trans = 0;
|
@@ -1137,13 +1145,13 @@ case 1:
|
|
1137
1145
|
switch ( _JSON_float_actions[_acts++] )
|
1138
1146
|
{
|
1139
1147
|
case 0:
|
1140
|
-
// line
|
1148
|
+
// line 517 "Parser.rl"
|
1141
1149
|
{
|
1142
1150
|
p--;
|
1143
1151
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
1144
1152
|
}
|
1145
1153
|
break;
|
1146
|
-
// line
|
1154
|
+
// line 1155 "Parser.java"
|
1147
1155
|
}
|
1148
1156
|
}
|
1149
1157
|
}
|
@@ -1163,23 +1171,30 @@ case 5:
|
|
1163
1171
|
break; }
|
1164
1172
|
}
|
1165
1173
|
|
1166
|
-
// line
|
1174
|
+
// line 547 "Parser.rl"
|
1167
1175
|
|
1168
1176
|
if (cs < JSON_float_first_final) {
|
1169
1177
|
return -1;
|
1170
1178
|
}
|
1171
|
-
|
1179
|
+
|
1172
1180
|
return p;
|
1173
1181
|
}
|
1174
|
-
|
1182
|
+
|
1175
1183
|
RubyFloat createFloat(int p, int new_p) {
|
1176
1184
|
Ruby runtime = getRuntime();
|
1177
1185
|
ByteList num = absSubSequence(p, new_p);
|
1178
1186
|
return RubyFloat.newFloat(runtime, dc.parse(num, true, runtime.is1_9()));
|
1179
1187
|
}
|
1180
1188
|
|
1189
|
+
IRubyObject createCustomDecimal(int p, int new_p) {
|
1190
|
+
Ruby runtime = getRuntime();
|
1191
|
+
ByteList num = absSubSequence(p, new_p);
|
1192
|
+
IRubyObject numString = runtime.newString(num.toString());
|
1193
|
+
return parser.decimalClass.callMethod(context, "new", numString);
|
1194
|
+
}
|
1195
|
+
|
1181
1196
|
|
1182
|
-
// line
|
1197
|
+
// line 1198 "Parser.java"
|
1183
1198
|
private static byte[] init__JSON_string_actions_0()
|
1184
1199
|
{
|
1185
1200
|
return new byte [] {
|
@@ -1281,7 +1296,7 @@ static final int JSON_string_error = 0;
|
|
1281
1296
|
static final int JSON_string_en_main = 1;
|
1282
1297
|
|
1283
1298
|
|
1284
|
-
// line
|
1299
|
+
// line 599 "Parser.rl"
|
1285
1300
|
|
1286
1301
|
|
1287
1302
|
void parseString(ParserResult res, int p, int pe) {
|
@@ -1289,15 +1304,15 @@ static final int JSON_string_en_main = 1;
|
|
1289
1304
|
IRubyObject result = null;
|
1290
1305
|
|
1291
1306
|
|
1292
|
-
// line
|
1307
|
+
// line 1308 "Parser.java"
|
1293
1308
|
{
|
1294
1309
|
cs = JSON_string_start;
|
1295
1310
|
}
|
1296
1311
|
|
1297
|
-
// line
|
1312
|
+
// line 606 "Parser.rl"
|
1298
1313
|
int memo = p;
|
1299
1314
|
|
1300
|
-
// line
|
1315
|
+
// line 1316 "Parser.java"
|
1301
1316
|
{
|
1302
1317
|
int _klen;
|
1303
1318
|
int _trans = 0;
|
@@ -1378,7 +1393,7 @@ case 1:
|
|
1378
1393
|
switch ( _JSON_string_actions[_acts++] )
|
1379
1394
|
{
|
1380
1395
|
case 0:
|
1381
|
-
// line
|
1396
|
+
// line 574 "Parser.rl"
|
1382
1397
|
{
|
1383
1398
|
int offset = byteList.begin();
|
1384
1399
|
ByteList decoded = decoder.decode(byteList, memo + 1 - offset,
|
@@ -1393,13 +1408,13 @@ case 1:
|
|
1393
1408
|
}
|
1394
1409
|
break;
|
1395
1410
|
case 1:
|
1396
|
-
// line
|
1411
|
+
// line 587 "Parser.rl"
|
1397
1412
|
{
|
1398
1413
|
p--;
|
1399
1414
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
1400
1415
|
}
|
1401
1416
|
break;
|
1402
|
-
// line
|
1417
|
+
// line 1418 "Parser.java"
|
1403
1418
|
}
|
1404
1419
|
}
|
1405
1420
|
}
|
@@ -1419,7 +1434,7 @@ case 5:
|
|
1419
1434
|
break; }
|
1420
1435
|
}
|
1421
1436
|
|
1422
|
-
// line
|
1437
|
+
// line 608 "Parser.rl"
|
1423
1438
|
|
1424
1439
|
if (parser.createAdditions) {
|
1425
1440
|
RubyHash matchString = parser.matchString;
|
@@ -1446,7 +1461,7 @@ case 5:
|
|
1446
1461
|
}
|
1447
1462
|
}
|
1448
1463
|
|
1449
|
-
if (cs >= JSON_string_first_final && result != null) {
|
1464
|
+
if (cs >= JSON_string_first_final && result != null) {
|
1450
1465
|
if (result instanceof RubyString) {
|
1451
1466
|
((RubyString)result).force_encoding(context, info.utf8.get());
|
1452
1467
|
}
|
@@ -1457,7 +1472,7 @@ case 5:
|
|
1457
1472
|
}
|
1458
1473
|
|
1459
1474
|
|
1460
|
-
// line
|
1475
|
+
// line 1476 "Parser.java"
|
1461
1476
|
private static byte[] init__JSON_array_actions_0()
|
1462
1477
|
{
|
1463
1478
|
return new byte [] {
|
@@ -1570,7 +1585,7 @@ static final int JSON_array_error = 0;
|
|
1570
1585
|
static final int JSON_array_en_main = 1;
|
1571
1586
|
|
1572
1587
|
|
1573
|
-
// line
|
1588
|
+
// line 681 "Parser.rl"
|
1574
1589
|
|
1575
1590
|
|
1576
1591
|
void parseArray(ParserResult res, int p, int pe) {
|
@@ -1590,14 +1605,14 @@ static final int JSON_array_en_main = 1;
|
|
1590
1605
|
}
|
1591
1606
|
|
1592
1607
|
|
1593
|
-
// line
|
1608
|
+
// line 1609 "Parser.java"
|
1594
1609
|
{
|
1595
1610
|
cs = JSON_array_start;
|
1596
1611
|
}
|
1597
1612
|
|
1598
|
-
// line
|
1613
|
+
// line 700 "Parser.rl"
|
1599
1614
|
|
1600
|
-
// line
|
1615
|
+
// line 1616 "Parser.java"
|
1601
1616
|
{
|
1602
1617
|
int _klen;
|
1603
1618
|
int _trans = 0;
|
@@ -1678,7 +1693,7 @@ case 1:
|
|
1678
1693
|
switch ( _JSON_array_actions[_acts++] )
|
1679
1694
|
{
|
1680
1695
|
case 0:
|
1681
|
-
// line
|
1696
|
+
// line 650 "Parser.rl"
|
1682
1697
|
{
|
1683
1698
|
parseValue(res, p, pe);
|
1684
1699
|
if (res.result == null) {
|
@@ -1695,13 +1710,13 @@ case 1:
|
|
1695
1710
|
}
|
1696
1711
|
break;
|
1697
1712
|
case 1:
|
1698
|
-
// line
|
1713
|
+
// line 665 "Parser.rl"
|
1699
1714
|
{
|
1700
1715
|
p--;
|
1701
1716
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
1702
1717
|
}
|
1703
1718
|
break;
|
1704
|
-
// line
|
1719
|
+
// line 1720 "Parser.java"
|
1705
1720
|
}
|
1706
1721
|
}
|
1707
1722
|
}
|
@@ -1721,7 +1736,7 @@ case 5:
|
|
1721
1736
|
break; }
|
1722
1737
|
}
|
1723
1738
|
|
1724
|
-
// line
|
1739
|
+
// line 701 "Parser.rl"
|
1725
1740
|
|
1726
1741
|
if (cs >= JSON_array_first_final) {
|
1727
1742
|
res.update(result, p + 1);
|
@@ -1731,7 +1746,7 @@ case 5:
|
|
1731
1746
|
}
|
1732
1747
|
|
1733
1748
|
|
1734
|
-
// line
|
1749
|
+
// line 1750 "Parser.java"
|
1735
1750
|
private static byte[] init__JSON_object_actions_0()
|
1736
1751
|
{
|
1737
1752
|
return new byte [] {
|
@@ -1854,7 +1869,7 @@ static final int JSON_object_error = 0;
|
|
1854
1869
|
static final int JSON_object_en_main = 1;
|
1855
1870
|
|
1856
1871
|
|
1857
|
-
// line
|
1872
|
+
// line 760 "Parser.rl"
|
1858
1873
|
|
1859
1874
|
|
1860
1875
|
void parseObject(ParserResult res, int p, int pe) {
|
@@ -1879,14 +1894,14 @@ static final int JSON_object_en_main = 1;
|
|
1879
1894
|
}
|
1880
1895
|
|
1881
1896
|
|
1882
|
-
// line
|
1897
|
+
// line 1898 "Parser.java"
|
1883
1898
|
{
|
1884
1899
|
cs = JSON_object_start;
|
1885
1900
|
}
|
1886
1901
|
|
1887
|
-
// line
|
1902
|
+
// line 784 "Parser.rl"
|
1888
1903
|
|
1889
|
-
// line
|
1904
|
+
// line 1905 "Parser.java"
|
1890
1905
|
{
|
1891
1906
|
int _klen;
|
1892
1907
|
int _trans = 0;
|
@@ -1967,7 +1982,7 @@ case 1:
|
|
1967
1982
|
switch ( _JSON_object_actions[_acts++] )
|
1968
1983
|
{
|
1969
1984
|
case 0:
|
1970
|
-
// line
|
1985
|
+
// line 715 "Parser.rl"
|
1971
1986
|
{
|
1972
1987
|
parseValue(res, p, pe);
|
1973
1988
|
if (res.result == null) {
|
@@ -1984,7 +1999,7 @@ case 1:
|
|
1984
1999
|
}
|
1985
2000
|
break;
|
1986
2001
|
case 1:
|
1987
|
-
// line
|
2002
|
+
// line 730 "Parser.rl"
|
1988
2003
|
{
|
1989
2004
|
parseString(res, p, pe);
|
1990
2005
|
if (res.result == null) {
|
@@ -2004,13 +2019,13 @@ case 1:
|
|
2004
2019
|
}
|
2005
2020
|
break;
|
2006
2021
|
case 2:
|
2007
|
-
// line
|
2022
|
+
// line 748 "Parser.rl"
|
2008
2023
|
{
|
2009
2024
|
p--;
|
2010
2025
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
2011
2026
|
}
|
2012
2027
|
break;
|
2013
|
-
// line
|
2028
|
+
// line 2029 "Parser.java"
|
2014
2029
|
}
|
2015
2030
|
}
|
2016
2031
|
}
|
@@ -2030,7 +2045,7 @@ case 5:
|
|
2030
2045
|
break; }
|
2031
2046
|
}
|
2032
2047
|
|
2033
|
-
// line
|
2048
|
+
// line 785 "Parser.rl"
|
2034
2049
|
|
2035
2050
|
if (cs < JSON_object_first_final) {
|
2036
2051
|
res.update(null, p + 1);
|
@@ -2063,7 +2078,7 @@ case 5:
|
|
2063
2078
|
}
|
2064
2079
|
|
2065
2080
|
|
2066
|
-
// line
|
2081
|
+
// line 2082 "Parser.java"
|
2067
2082
|
private static byte[] init__JSON_actions_0()
|
2068
2083
|
{
|
2069
2084
|
return new byte [] {
|
@@ -2166,7 +2181,7 @@ static final int JSON_error = 0;
|
|
2166
2181
|
static final int JSON_en_main = 1;
|
2167
2182
|
|
2168
2183
|
|
2169
|
-
// line
|
2184
|
+
// line 836 "Parser.rl"
|
2170
2185
|
|
2171
2186
|
|
2172
2187
|
public IRubyObject parseImplemetation() {
|
@@ -2176,16 +2191,16 @@ static final int JSON_en_main = 1;
|
|
2176
2191
|
ParserResult res = new ParserResult();
|
2177
2192
|
|
2178
2193
|
|
2179
|
-
// line
|
2194
|
+
// line 2195 "Parser.java"
|
2180
2195
|
{
|
2181
2196
|
cs = JSON_start;
|
2182
2197
|
}
|
2183
2198
|
|
2184
|
-
// line
|
2199
|
+
// line 845 "Parser.rl"
|
2185
2200
|
p = byteList.begin();
|
2186
2201
|
pe = p + byteList.length();
|
2187
2202
|
|
2188
|
-
// line
|
2203
|
+
// line 2204 "Parser.java"
|
2189
2204
|
{
|
2190
2205
|
int _klen;
|
2191
2206
|
int _trans = 0;
|
@@ -2266,7 +2281,7 @@ case 1:
|
|
2266
2281
|
switch ( _JSON_actions[_acts++] )
|
2267
2282
|
{
|
2268
2283
|
case 0:
|
2269
|
-
// line
|
2284
|
+
// line 822 "Parser.rl"
|
2270
2285
|
{
|
2271
2286
|
parseValue(res, p, pe);
|
2272
2287
|
if (res.result == null) {
|
@@ -2278,7 +2293,7 @@ case 1:
|
|
2278
2293
|
}
|
2279
2294
|
}
|
2280
2295
|
break;
|
2281
|
-
// line
|
2296
|
+
// line 2297 "Parser.java"
|
2282
2297
|
}
|
2283
2298
|
}
|
2284
2299
|
}
|
@@ -2298,7 +2313,7 @@ case 5:
|
|
2298
2313
|
break; }
|
2299
2314
|
}
|
2300
2315
|
|
2301
|
-
// line
|
2316
|
+
// line 848 "Parser.rl"
|
2302
2317
|
|
2303
2318
|
if (cs >= JSON_first_final && p == pe) {
|
2304
2319
|
return result;
|