json_pure 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/Rakefile +5 -7
- data/VERSION +1 -1
- data/benchmarks/benchmark_generator.rb +0 -0
- data/benchmarks/benchmark_parser.rb +0 -0
- data/benchmarks/benchmark_rails.rb +0 -0
- data/bin/edit_json.rb +0 -1
- data/bin/prettify_json.rb +1 -0
- data/data/index.html +5 -4
- data/ext/json/ext/generator/extconf.rb +1 -1
- data/ext/json/ext/generator/generator.c +3 -4
- data/ext/json/ext/generator/unicode.c +0 -2
- data/ext/json/ext/parser/extconf.rb +1 -1
- data/ext/json/ext/parser/parser.c +315 -309
- data/ext/json/ext/parser/parser.rl +27 -28
- data/ext/json/ext/parser/unicode.c +0 -2
- data/install.rb +0 -0
- data/lib/json/add/core.rb +20 -5
- data/lib/json/common.rb +5 -5
- data/lib/json/editor.rb +0 -1
- data/lib/json/pure/generator.rb +1 -1
- data/lib/json/pure/parser.rb +1 -1
- data/lib/json/version.rb +1 -1
- data/tests/runner.rb +0 -1
- data/tests/test_json.rb +0 -1
- data/tests/test_json_addition.rb +24 -7
- data/tests/test_json_fixtures.rb +0 -0
- data/tests/test_json_generate.rb +0 -0
- data/tests/test_json_rails.rb +6 -2
- data/tests/test_json_unicode.rb +0 -0
- data/tools/fuzz.rb +10 -2
- data/tools/server.rb +0 -0
- metadata +41 -34
@@ -1,6 +1,4 @@
|
|
1
1
|
#line 1 "parser.rl"
|
2
|
-
/* vim: set cin et sw=4 ts=4: */
|
3
|
-
|
4
2
|
#include "ruby.h"
|
5
3
|
#include "re.h"
|
6
4
|
#include "st.h"
|
@@ -38,18 +36,18 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
38
36
|
JSON_Parser *json; \
|
39
37
|
Data_Get_Struct(self, JSON_Parser, json);
|
40
38
|
|
41
|
-
#line
|
39
|
+
#line 64 "parser.rl"
|
42
40
|
|
43
41
|
|
44
42
|
|
45
|
-
#line
|
43
|
+
#line 44 "parser.c"
|
46
44
|
static const int JSON_object_start = 1;
|
47
45
|
static const int JSON_object_first_final = 27;
|
48
46
|
static const int JSON_object_error = 0;
|
49
47
|
|
50
48
|
static const int JSON_object_en_main = 1;
|
51
49
|
|
52
|
-
#line
|
50
|
+
#line 97 "parser.rl"
|
53
51
|
|
54
52
|
|
55
53
|
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -64,16 +62,16 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
64
62
|
*result = rb_hash_new();
|
65
63
|
|
66
64
|
|
67
|
-
#line
|
65
|
+
#line 66 "parser.c"
|
68
66
|
{
|
69
67
|
cs = JSON_object_start;
|
70
68
|
}
|
71
|
-
#line
|
69
|
+
#line 111 "parser.rl"
|
72
70
|
|
73
|
-
#line
|
71
|
+
#line 72 "parser.c"
|
74
72
|
{
|
75
73
|
if ( p == pe )
|
76
|
-
goto
|
74
|
+
goto _test_eof;
|
77
75
|
switch ( cs )
|
78
76
|
{
|
79
77
|
case 1:
|
@@ -81,10 +79,11 @@ case 1:
|
|
81
79
|
goto st2;
|
82
80
|
goto st0;
|
83
81
|
st0:
|
84
|
-
|
82
|
+
cs = 0;
|
83
|
+
goto _out;
|
85
84
|
st2:
|
86
85
|
if ( ++p == pe )
|
87
|
-
goto
|
86
|
+
goto _test_eof2;
|
88
87
|
case 2:
|
89
88
|
switch( (*p) ) {
|
90
89
|
case 13: goto st2;
|
@@ -97,17 +96,17 @@ case 2:
|
|
97
96
|
goto st2;
|
98
97
|
goto st0;
|
99
98
|
tr2:
|
100
|
-
#line
|
99
|
+
#line 83 "parser.rl"
|
101
100
|
{
|
102
101
|
char *np = JSON_parse_string(json, p, pe, &last_name);
|
103
|
-
if (np == NULL) goto
|
102
|
+
if (np == NULL) { p--; {p++; cs = 3; goto _out;} } else {p = (( np))-1;}
|
104
103
|
}
|
105
104
|
goto st3;
|
106
105
|
st3:
|
107
106
|
if ( ++p == pe )
|
108
|
-
goto
|
107
|
+
goto _test_eof3;
|
109
108
|
case 3:
|
110
|
-
#line
|
109
|
+
#line 110 "parser.c"
|
111
110
|
switch( (*p) ) {
|
112
111
|
case 13: goto st3;
|
113
112
|
case 32: goto st3;
|
@@ -119,7 +118,7 @@ case 3:
|
|
119
118
|
goto st0;
|
120
119
|
st4:
|
121
120
|
if ( ++p == pe )
|
122
|
-
goto
|
121
|
+
goto _test_eof4;
|
123
122
|
case 4:
|
124
123
|
switch( (*p) ) {
|
125
124
|
case 42: goto st5;
|
@@ -128,14 +127,14 @@ case 4:
|
|
128
127
|
goto st0;
|
129
128
|
st5:
|
130
129
|
if ( ++p == pe )
|
131
|
-
goto
|
130
|
+
goto _test_eof5;
|
132
131
|
case 5:
|
133
132
|
if ( (*p) == 42 )
|
134
133
|
goto st6;
|
135
134
|
goto st5;
|
136
135
|
st6:
|
137
136
|
if ( ++p == pe )
|
138
|
-
goto
|
137
|
+
goto _test_eof6;
|
139
138
|
case 6:
|
140
139
|
switch( (*p) ) {
|
141
140
|
case 42: goto st6;
|
@@ -144,14 +143,14 @@ case 6:
|
|
144
143
|
goto st5;
|
145
144
|
st7:
|
146
145
|
if ( ++p == pe )
|
147
|
-
goto
|
146
|
+
goto _test_eof7;
|
148
147
|
case 7:
|
149
148
|
if ( (*p) == 10 )
|
150
149
|
goto st3;
|
151
150
|
goto st7;
|
152
151
|
st8:
|
153
152
|
if ( ++p == pe )
|
154
|
-
goto
|
153
|
+
goto _test_eof8;
|
155
154
|
case 8:
|
156
155
|
switch( (*p) ) {
|
157
156
|
case 13: goto st8;
|
@@ -174,12 +173,12 @@ case 8:
|
|
174
173
|
goto st8;
|
175
174
|
goto st0;
|
176
175
|
tr11:
|
177
|
-
#line
|
176
|
+
#line 72 "parser.rl"
|
178
177
|
{
|
179
178
|
VALUE v = Qnil;
|
180
179
|
char *np = JSON_parse_value(json, p, pe, &v);
|
181
180
|
if (np == NULL) {
|
182
|
-
goto
|
181
|
+
p--; {p++; cs = 9; goto _out;}
|
183
182
|
} else {
|
184
183
|
rb_hash_aset(*result, last_name, v);
|
185
184
|
{p = (( np))-1;}
|
@@ -188,9 +187,9 @@ tr11:
|
|
188
187
|
goto st9;
|
189
188
|
st9:
|
190
189
|
if ( ++p == pe )
|
191
|
-
goto
|
190
|
+
goto _test_eof9;
|
192
191
|
case 9:
|
193
|
-
#line
|
192
|
+
#line 193 "parser.c"
|
194
193
|
switch( (*p) ) {
|
195
194
|
case 13: goto st9;
|
196
195
|
case 32: goto st9;
|
@@ -203,7 +202,7 @@ case 9:
|
|
203
202
|
goto st0;
|
204
203
|
st10:
|
205
204
|
if ( ++p == pe )
|
206
|
-
goto
|
205
|
+
goto _test_eof10;
|
207
206
|
case 10:
|
208
207
|
switch( (*p) ) {
|
209
208
|
case 13: goto st10;
|
@@ -216,7 +215,7 @@ case 10:
|
|
216
215
|
goto st0;
|
217
216
|
st11:
|
218
217
|
if ( ++p == pe )
|
219
|
-
goto
|
218
|
+
goto _test_eof11;
|
220
219
|
case 11:
|
221
220
|
switch( (*p) ) {
|
222
221
|
case 42: goto st12;
|
@@ -225,14 +224,14 @@ case 11:
|
|
225
224
|
goto st0;
|
226
225
|
st12:
|
227
226
|
if ( ++p == pe )
|
228
|
-
goto
|
227
|
+
goto _test_eof12;
|
229
228
|
case 12:
|
230
229
|
if ( (*p) == 42 )
|
231
230
|
goto st13;
|
232
231
|
goto st12;
|
233
232
|
st13:
|
234
233
|
if ( ++p == pe )
|
235
|
-
goto
|
234
|
+
goto _test_eof13;
|
236
235
|
case 13:
|
237
236
|
switch( (*p) ) {
|
238
237
|
case 42: goto st13;
|
@@ -241,14 +240,14 @@ case 13:
|
|
241
240
|
goto st12;
|
242
241
|
st14:
|
243
242
|
if ( ++p == pe )
|
244
|
-
goto
|
243
|
+
goto _test_eof14;
|
245
244
|
case 14:
|
246
245
|
if ( (*p) == 10 )
|
247
246
|
goto st10;
|
248
247
|
goto st14;
|
249
248
|
st15:
|
250
249
|
if ( ++p == pe )
|
251
|
-
goto
|
250
|
+
goto _test_eof15;
|
252
251
|
case 15:
|
253
252
|
switch( (*p) ) {
|
254
253
|
case 42: goto st16;
|
@@ -257,14 +256,14 @@ case 15:
|
|
257
256
|
goto st0;
|
258
257
|
st16:
|
259
258
|
if ( ++p == pe )
|
260
|
-
goto
|
259
|
+
goto _test_eof16;
|
261
260
|
case 16:
|
262
261
|
if ( (*p) == 42 )
|
263
262
|
goto st17;
|
264
263
|
goto st16;
|
265
264
|
st17:
|
266
265
|
if ( ++p == pe )
|
267
|
-
goto
|
266
|
+
goto _test_eof17;
|
268
267
|
case 17:
|
269
268
|
switch( (*p) ) {
|
270
269
|
case 42: goto st17;
|
@@ -273,24 +272,24 @@ case 17:
|
|
273
272
|
goto st16;
|
274
273
|
st18:
|
275
274
|
if ( ++p == pe )
|
276
|
-
goto
|
275
|
+
goto _test_eof18;
|
277
276
|
case 18:
|
278
277
|
if ( (*p) == 10 )
|
279
278
|
goto st9;
|
280
279
|
goto st18;
|
281
280
|
tr4:
|
282
|
-
#line
|
283
|
-
{ goto
|
281
|
+
#line 88 "parser.rl"
|
282
|
+
{ p--; {p++; cs = 27; goto _out;} }
|
284
283
|
goto st27;
|
285
284
|
st27:
|
286
285
|
if ( ++p == pe )
|
287
|
-
goto
|
286
|
+
goto _test_eof27;
|
288
287
|
case 27:
|
289
|
-
#line
|
288
|
+
#line 289 "parser.c"
|
290
289
|
goto st0;
|
291
290
|
st19:
|
292
291
|
if ( ++p == pe )
|
293
|
-
goto
|
292
|
+
goto _test_eof19;
|
294
293
|
case 19:
|
295
294
|
switch( (*p) ) {
|
296
295
|
case 42: goto st20;
|
@@ -299,14 +298,14 @@ case 19:
|
|
299
298
|
goto st0;
|
300
299
|
st20:
|
301
300
|
if ( ++p == pe )
|
302
|
-
goto
|
301
|
+
goto _test_eof20;
|
303
302
|
case 20:
|
304
303
|
if ( (*p) == 42 )
|
305
304
|
goto st21;
|
306
305
|
goto st20;
|
307
306
|
st21:
|
308
307
|
if ( ++p == pe )
|
309
|
-
goto
|
308
|
+
goto _test_eof21;
|
310
309
|
case 21:
|
311
310
|
switch( (*p) ) {
|
312
311
|
case 42: goto st21;
|
@@ -315,14 +314,14 @@ case 21:
|
|
315
314
|
goto st20;
|
316
315
|
st22:
|
317
316
|
if ( ++p == pe )
|
318
|
-
goto
|
317
|
+
goto _test_eof22;
|
319
318
|
case 22:
|
320
319
|
if ( (*p) == 10 )
|
321
320
|
goto st8;
|
322
321
|
goto st22;
|
323
322
|
st23:
|
324
323
|
if ( ++p == pe )
|
325
|
-
goto
|
324
|
+
goto _test_eof23;
|
326
325
|
case 23:
|
327
326
|
switch( (*p) ) {
|
328
327
|
case 42: goto st24;
|
@@ -331,14 +330,14 @@ case 23:
|
|
331
330
|
goto st0;
|
332
331
|
st24:
|
333
332
|
if ( ++p == pe )
|
334
|
-
goto
|
333
|
+
goto _test_eof24;
|
335
334
|
case 24:
|
336
335
|
if ( (*p) == 42 )
|
337
336
|
goto st25;
|
338
337
|
goto st24;
|
339
338
|
st25:
|
340
339
|
if ( ++p == pe )
|
341
|
-
goto
|
340
|
+
goto _test_eof25;
|
342
341
|
case 25:
|
343
342
|
switch( (*p) ) {
|
344
343
|
case 42: goto st25;
|
@@ -347,43 +346,43 @@ case 25:
|
|
347
346
|
goto st24;
|
348
347
|
st26:
|
349
348
|
if ( ++p == pe )
|
350
|
-
goto
|
349
|
+
goto _test_eof26;
|
351
350
|
case 26:
|
352
351
|
if ( (*p) == 10 )
|
353
352
|
goto st2;
|
354
353
|
goto st26;
|
355
354
|
}
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
355
|
+
_test_eof2: cs = 2; goto _test_eof;
|
356
|
+
_test_eof3: cs = 3; goto _test_eof;
|
357
|
+
_test_eof4: cs = 4; goto _test_eof;
|
358
|
+
_test_eof5: cs = 5; goto _test_eof;
|
359
|
+
_test_eof6: cs = 6; goto _test_eof;
|
360
|
+
_test_eof7: cs = 7; goto _test_eof;
|
361
|
+
_test_eof8: cs = 8; goto _test_eof;
|
362
|
+
_test_eof9: cs = 9; goto _test_eof;
|
363
|
+
_test_eof10: cs = 10; goto _test_eof;
|
364
|
+
_test_eof11: cs = 11; goto _test_eof;
|
365
|
+
_test_eof12: cs = 12; goto _test_eof;
|
366
|
+
_test_eof13: cs = 13; goto _test_eof;
|
367
|
+
_test_eof14: cs = 14; goto _test_eof;
|
368
|
+
_test_eof15: cs = 15; goto _test_eof;
|
369
|
+
_test_eof16: cs = 16; goto _test_eof;
|
370
|
+
_test_eof17: cs = 17; goto _test_eof;
|
371
|
+
_test_eof18: cs = 18; goto _test_eof;
|
372
|
+
_test_eof27: cs = 27; goto _test_eof;
|
373
|
+
_test_eof19: cs = 19; goto _test_eof;
|
374
|
+
_test_eof20: cs = 20; goto _test_eof;
|
375
|
+
_test_eof21: cs = 21; goto _test_eof;
|
376
|
+
_test_eof22: cs = 22; goto _test_eof;
|
377
|
+
_test_eof23: cs = 23; goto _test_eof;
|
378
|
+
_test_eof24: cs = 24; goto _test_eof;
|
379
|
+
_test_eof25: cs = 25; goto _test_eof;
|
380
|
+
_test_eof26: cs = 26; goto _test_eof;
|
381
|
+
|
382
|
+
_test_eof: {}
|
384
383
|
_out: {}
|
385
384
|
}
|
386
|
-
#line
|
385
|
+
#line 112 "parser.rl"
|
387
386
|
|
388
387
|
if (cs >= JSON_object_first_final) {
|
389
388
|
if (RTEST(json->create_id)) {
|
@@ -402,14 +401,14 @@ case 26:
|
|
402
401
|
}
|
403
402
|
|
404
403
|
|
405
|
-
#line
|
404
|
+
#line 405 "parser.c"
|
406
405
|
static const int JSON_value_start = 1;
|
407
406
|
static const int JSON_value_first_final = 21;
|
408
407
|
static const int JSON_value_error = 0;
|
409
408
|
|
410
409
|
static const int JSON_value_en_main = 1;
|
411
410
|
|
412
|
-
#line
|
411
|
+
#line 210 "parser.rl"
|
413
412
|
|
414
413
|
|
415
414
|
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -417,16 +416,16 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
417
416
|
int cs = EVIL;
|
418
417
|
|
419
418
|
|
420
|
-
#line
|
419
|
+
#line 420 "parser.c"
|
421
420
|
{
|
422
421
|
cs = JSON_value_start;
|
423
422
|
}
|
424
|
-
#line
|
423
|
+
#line 217 "parser.rl"
|
425
424
|
|
426
|
-
#line
|
425
|
+
#line 426 "parser.c"
|
427
426
|
{
|
428
427
|
if ( p == pe )
|
429
|
-
goto
|
428
|
+
goto _test_eof;
|
430
429
|
switch ( cs )
|
431
430
|
{
|
432
431
|
case 1:
|
@@ -445,259 +444,260 @@ case 1:
|
|
445
444
|
goto tr2;
|
446
445
|
goto st0;
|
447
446
|
st0:
|
448
|
-
|
447
|
+
cs = 0;
|
448
|
+
goto _out;
|
449
449
|
tr0:
|
450
|
-
#line
|
450
|
+
#line 158 "parser.rl"
|
451
451
|
{
|
452
452
|
char *np = JSON_parse_string(json, p, pe, result);
|
453
|
-
if (np == NULL) goto
|
453
|
+
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
454
454
|
}
|
455
455
|
goto st21;
|
456
456
|
tr2:
|
457
|
-
#line
|
457
|
+
#line 163 "parser.rl"
|
458
458
|
{
|
459
459
|
char *np;
|
460
460
|
if(pe > p + 9 && !strncmp(MinusInfinity, p, 9)) {
|
461
461
|
if (json->allow_nan) {
|
462
462
|
*result = CMinusInfinity;
|
463
463
|
{p = (( p + 10))-1;}
|
464
|
-
goto
|
464
|
+
p--; {p++; cs = 21; goto _out;}
|
465
465
|
} else {
|
466
|
-
rb_raise(eParserError, "unexpected token at '%s'", p);
|
466
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
467
467
|
}
|
468
468
|
}
|
469
469
|
np = JSON_parse_float(json, p, pe, result);
|
470
470
|
if (np != NULL) {p = (( np))-1;}
|
471
471
|
np = JSON_parse_integer(json, p, pe, result);
|
472
472
|
if (np != NULL) {p = (( np))-1;}
|
473
|
-
goto
|
473
|
+
p--; {p++; cs = 21; goto _out;}
|
474
474
|
}
|
475
475
|
goto st21;
|
476
476
|
tr5:
|
477
|
-
#line
|
477
|
+
#line 181 "parser.rl"
|
478
478
|
{
|
479
479
|
char *np;
|
480
|
-
json->current_nesting
|
480
|
+
json->current_nesting++;
|
481
481
|
np = JSON_parse_array(json, p, pe, result);
|
482
|
-
json->current_nesting
|
483
|
-
if (np == NULL) goto
|
482
|
+
json->current_nesting--;
|
483
|
+
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
484
484
|
}
|
485
485
|
goto st21;
|
486
486
|
tr9:
|
487
|
-
#line
|
487
|
+
#line 189 "parser.rl"
|
488
488
|
{
|
489
489
|
char *np;
|
490
|
-
json->current_nesting
|
490
|
+
json->current_nesting++;
|
491
491
|
np = JSON_parse_object(json, p, pe, result);
|
492
|
-
json->current_nesting
|
493
|
-
if (np == NULL) goto
|
492
|
+
json->current_nesting--;
|
493
|
+
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
494
494
|
}
|
495
495
|
goto st21;
|
496
496
|
tr16:
|
497
|
-
#line
|
497
|
+
#line 151 "parser.rl"
|
498
498
|
{
|
499
499
|
if (json->allow_nan) {
|
500
500
|
*result = CInfinity;
|
501
501
|
} else {
|
502
|
-
rb_raise(eParserError, "unexpected token at '%s'", p - 8);
|
502
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
|
503
503
|
}
|
504
504
|
}
|
505
505
|
goto st21;
|
506
506
|
tr18:
|
507
|
-
#line
|
507
|
+
#line 144 "parser.rl"
|
508
508
|
{
|
509
509
|
if (json->allow_nan) {
|
510
510
|
*result = CNaN;
|
511
511
|
} else {
|
512
|
-
rb_raise(eParserError, "unexpected token at '%s'", p - 2);
|
512
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
|
513
513
|
}
|
514
514
|
}
|
515
515
|
goto st21;
|
516
516
|
tr22:
|
517
|
-
#line
|
517
|
+
#line 138 "parser.rl"
|
518
518
|
{
|
519
519
|
*result = Qfalse;
|
520
520
|
}
|
521
521
|
goto st21;
|
522
522
|
tr25:
|
523
|
-
#line
|
523
|
+
#line 135 "parser.rl"
|
524
524
|
{
|
525
525
|
*result = Qnil;
|
526
526
|
}
|
527
527
|
goto st21;
|
528
528
|
tr28:
|
529
|
-
#line
|
529
|
+
#line 141 "parser.rl"
|
530
530
|
{
|
531
531
|
*result = Qtrue;
|
532
532
|
}
|
533
533
|
goto st21;
|
534
534
|
st21:
|
535
535
|
if ( ++p == pe )
|
536
|
-
goto
|
536
|
+
goto _test_eof21;
|
537
537
|
case 21:
|
538
|
-
#line
|
539
|
-
{ goto
|
538
|
+
#line 197 "parser.rl"
|
539
|
+
{ p--; {p++; cs = 21; goto _out;} }
|
540
540
|
#line 541 "parser.c"
|
541
541
|
goto st0;
|
542
542
|
st2:
|
543
543
|
if ( ++p == pe )
|
544
|
-
goto
|
544
|
+
goto _test_eof2;
|
545
545
|
case 2:
|
546
546
|
if ( (*p) == 110 )
|
547
547
|
goto st3;
|
548
548
|
goto st0;
|
549
549
|
st3:
|
550
550
|
if ( ++p == pe )
|
551
|
-
goto
|
551
|
+
goto _test_eof3;
|
552
552
|
case 3:
|
553
553
|
if ( (*p) == 102 )
|
554
554
|
goto st4;
|
555
555
|
goto st0;
|
556
556
|
st4:
|
557
557
|
if ( ++p == pe )
|
558
|
-
goto
|
558
|
+
goto _test_eof4;
|
559
559
|
case 4:
|
560
560
|
if ( (*p) == 105 )
|
561
561
|
goto st5;
|
562
562
|
goto st0;
|
563
563
|
st5:
|
564
564
|
if ( ++p == pe )
|
565
|
-
goto
|
565
|
+
goto _test_eof5;
|
566
566
|
case 5:
|
567
567
|
if ( (*p) == 110 )
|
568
568
|
goto st6;
|
569
569
|
goto st0;
|
570
570
|
st6:
|
571
571
|
if ( ++p == pe )
|
572
|
-
goto
|
572
|
+
goto _test_eof6;
|
573
573
|
case 6:
|
574
574
|
if ( (*p) == 105 )
|
575
575
|
goto st7;
|
576
576
|
goto st0;
|
577
577
|
st7:
|
578
578
|
if ( ++p == pe )
|
579
|
-
goto
|
579
|
+
goto _test_eof7;
|
580
580
|
case 7:
|
581
581
|
if ( (*p) == 116 )
|
582
582
|
goto st8;
|
583
583
|
goto st0;
|
584
584
|
st8:
|
585
585
|
if ( ++p == pe )
|
586
|
-
goto
|
586
|
+
goto _test_eof8;
|
587
587
|
case 8:
|
588
588
|
if ( (*p) == 121 )
|
589
589
|
goto tr16;
|
590
590
|
goto st0;
|
591
591
|
st9:
|
592
592
|
if ( ++p == pe )
|
593
|
-
goto
|
593
|
+
goto _test_eof9;
|
594
594
|
case 9:
|
595
595
|
if ( (*p) == 97 )
|
596
596
|
goto st10;
|
597
597
|
goto st0;
|
598
598
|
st10:
|
599
599
|
if ( ++p == pe )
|
600
|
-
goto
|
600
|
+
goto _test_eof10;
|
601
601
|
case 10:
|
602
602
|
if ( (*p) == 78 )
|
603
603
|
goto tr18;
|
604
604
|
goto st0;
|
605
605
|
st11:
|
606
606
|
if ( ++p == pe )
|
607
|
-
goto
|
607
|
+
goto _test_eof11;
|
608
608
|
case 11:
|
609
609
|
if ( (*p) == 97 )
|
610
610
|
goto st12;
|
611
611
|
goto st0;
|
612
612
|
st12:
|
613
613
|
if ( ++p == pe )
|
614
|
-
goto
|
614
|
+
goto _test_eof12;
|
615
615
|
case 12:
|
616
616
|
if ( (*p) == 108 )
|
617
617
|
goto st13;
|
618
618
|
goto st0;
|
619
619
|
st13:
|
620
620
|
if ( ++p == pe )
|
621
|
-
goto
|
621
|
+
goto _test_eof13;
|
622
622
|
case 13:
|
623
623
|
if ( (*p) == 115 )
|
624
624
|
goto st14;
|
625
625
|
goto st0;
|
626
626
|
st14:
|
627
627
|
if ( ++p == pe )
|
628
|
-
goto
|
628
|
+
goto _test_eof14;
|
629
629
|
case 14:
|
630
630
|
if ( (*p) == 101 )
|
631
631
|
goto tr22;
|
632
632
|
goto st0;
|
633
633
|
st15:
|
634
634
|
if ( ++p == pe )
|
635
|
-
goto
|
635
|
+
goto _test_eof15;
|
636
636
|
case 15:
|
637
637
|
if ( (*p) == 117 )
|
638
638
|
goto st16;
|
639
639
|
goto st0;
|
640
640
|
st16:
|
641
641
|
if ( ++p == pe )
|
642
|
-
goto
|
642
|
+
goto _test_eof16;
|
643
643
|
case 16:
|
644
644
|
if ( (*p) == 108 )
|
645
645
|
goto st17;
|
646
646
|
goto st0;
|
647
647
|
st17:
|
648
648
|
if ( ++p == pe )
|
649
|
-
goto
|
649
|
+
goto _test_eof17;
|
650
650
|
case 17:
|
651
651
|
if ( (*p) == 108 )
|
652
652
|
goto tr25;
|
653
653
|
goto st0;
|
654
654
|
st18:
|
655
655
|
if ( ++p == pe )
|
656
|
-
goto
|
656
|
+
goto _test_eof18;
|
657
657
|
case 18:
|
658
658
|
if ( (*p) == 114 )
|
659
659
|
goto st19;
|
660
660
|
goto st0;
|
661
661
|
st19:
|
662
662
|
if ( ++p == pe )
|
663
|
-
goto
|
663
|
+
goto _test_eof19;
|
664
664
|
case 19:
|
665
665
|
if ( (*p) == 117 )
|
666
666
|
goto st20;
|
667
667
|
goto st0;
|
668
668
|
st20:
|
669
669
|
if ( ++p == pe )
|
670
|
-
goto
|
670
|
+
goto _test_eof20;
|
671
671
|
case 20:
|
672
672
|
if ( (*p) == 101 )
|
673
673
|
goto tr28;
|
674
674
|
goto st0;
|
675
675
|
}
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
676
|
+
_test_eof21: cs = 21; goto _test_eof;
|
677
|
+
_test_eof2: cs = 2; goto _test_eof;
|
678
|
+
_test_eof3: cs = 3; goto _test_eof;
|
679
|
+
_test_eof4: cs = 4; goto _test_eof;
|
680
|
+
_test_eof5: cs = 5; goto _test_eof;
|
681
|
+
_test_eof6: cs = 6; goto _test_eof;
|
682
|
+
_test_eof7: cs = 7; goto _test_eof;
|
683
|
+
_test_eof8: cs = 8; goto _test_eof;
|
684
|
+
_test_eof9: cs = 9; goto _test_eof;
|
685
|
+
_test_eof10: cs = 10; goto _test_eof;
|
686
|
+
_test_eof11: cs = 11; goto _test_eof;
|
687
|
+
_test_eof12: cs = 12; goto _test_eof;
|
688
|
+
_test_eof13: cs = 13; goto _test_eof;
|
689
|
+
_test_eof14: cs = 14; goto _test_eof;
|
690
|
+
_test_eof15: cs = 15; goto _test_eof;
|
691
|
+
_test_eof16: cs = 16; goto _test_eof;
|
692
|
+
_test_eof17: cs = 17; goto _test_eof;
|
693
|
+
_test_eof18: cs = 18; goto _test_eof;
|
694
|
+
_test_eof19: cs = 19; goto _test_eof;
|
695
|
+
_test_eof20: cs = 20; goto _test_eof;
|
696
|
+
|
697
|
+
_test_eof: {}
|
698
698
|
_out: {}
|
699
699
|
}
|
700
|
-
#line
|
700
|
+
#line 218 "parser.rl"
|
701
701
|
|
702
702
|
if (cs >= JSON_value_first_final) {
|
703
703
|
return p;
|
@@ -714,7 +714,7 @@ static const int JSON_integer_error = 0;
|
|
714
714
|
|
715
715
|
static const int JSON_integer_en_main = 1;
|
716
716
|
|
717
|
-
#line
|
717
|
+
#line 234 "parser.rl"
|
718
718
|
|
719
719
|
|
720
720
|
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -726,13 +726,13 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
|
|
726
726
|
{
|
727
727
|
cs = JSON_integer_start;
|
728
728
|
}
|
729
|
-
#line
|
729
|
+
#line 241 "parser.rl"
|
730
730
|
json->memo = p;
|
731
731
|
|
732
732
|
#line 733 "parser.c"
|
733
733
|
{
|
734
734
|
if ( p == pe )
|
735
|
-
goto
|
735
|
+
goto _test_eof;
|
736
736
|
switch ( cs )
|
737
737
|
{
|
738
738
|
case 1:
|
@@ -744,10 +744,11 @@ case 1:
|
|
744
744
|
goto st4;
|
745
745
|
goto st0;
|
746
746
|
st0:
|
747
|
-
|
747
|
+
cs = 0;
|
748
|
+
goto _out;
|
748
749
|
st2:
|
749
750
|
if ( ++p == pe )
|
750
|
-
goto
|
751
|
+
goto _test_eof2;
|
751
752
|
case 2:
|
752
753
|
if ( (*p) == 48 )
|
753
754
|
goto st3;
|
@@ -756,38 +757,38 @@ case 2:
|
|
756
757
|
goto st0;
|
757
758
|
st3:
|
758
759
|
if ( ++p == pe )
|
759
|
-
goto
|
760
|
+
goto _test_eof3;
|
760
761
|
case 3:
|
761
762
|
if ( 48 <= (*p) && (*p) <= 57 )
|
762
763
|
goto st0;
|
763
764
|
goto tr4;
|
764
765
|
tr4:
|
765
|
-
#line
|
766
|
-
{ goto
|
766
|
+
#line 231 "parser.rl"
|
767
|
+
{ p--; {p++; cs = 5; goto _out;} }
|
767
768
|
goto st5;
|
768
769
|
st5:
|
769
770
|
if ( ++p == pe )
|
770
|
-
goto
|
771
|
+
goto _test_eof5;
|
771
772
|
case 5:
|
772
|
-
#line
|
773
|
+
#line 774 "parser.c"
|
773
774
|
goto st0;
|
774
775
|
st4:
|
775
776
|
if ( ++p == pe )
|
776
|
-
goto
|
777
|
+
goto _test_eof4;
|
777
778
|
case 4:
|
778
779
|
if ( 48 <= (*p) && (*p) <= 57 )
|
779
780
|
goto st4;
|
780
781
|
goto tr4;
|
781
782
|
}
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
_out4: cs = 4; goto _out;
|
783
|
+
_test_eof2: cs = 2; goto _test_eof;
|
784
|
+
_test_eof3: cs = 3; goto _test_eof;
|
785
|
+
_test_eof5: cs = 5; goto _test_eof;
|
786
|
+
_test_eof4: cs = 4; goto _test_eof;
|
787
787
|
|
788
|
+
_test_eof: {}
|
788
789
|
_out: {}
|
789
790
|
}
|
790
|
-
#line
|
791
|
+
#line 243 "parser.rl"
|
791
792
|
|
792
793
|
if (cs >= JSON_integer_first_final) {
|
793
794
|
long len = p - json->memo;
|
@@ -799,14 +800,14 @@ case 4:
|
|
799
800
|
}
|
800
801
|
|
801
802
|
|
802
|
-
#line
|
803
|
+
#line 804 "parser.c"
|
803
804
|
static const int JSON_float_start = 1;
|
804
805
|
static const int JSON_float_first_final = 10;
|
805
806
|
static const int JSON_float_error = 0;
|
806
807
|
|
807
808
|
static const int JSON_float_en_main = 1;
|
808
809
|
|
809
|
-
#line
|
810
|
+
#line 265 "parser.rl"
|
810
811
|
|
811
812
|
|
812
813
|
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -814,17 +815,17 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
814
815
|
int cs = EVIL;
|
815
816
|
|
816
817
|
|
817
|
-
#line
|
818
|
+
#line 819 "parser.c"
|
818
819
|
{
|
819
820
|
cs = JSON_float_start;
|
820
821
|
}
|
821
|
-
#line
|
822
|
+
#line 272 "parser.rl"
|
822
823
|
json->memo = p;
|
823
824
|
|
824
|
-
#line
|
825
|
+
#line 826 "parser.c"
|
825
826
|
{
|
826
827
|
if ( p == pe )
|
827
|
-
goto
|
828
|
+
goto _test_eof;
|
828
829
|
switch ( cs )
|
829
830
|
{
|
830
831
|
case 1:
|
@@ -836,10 +837,11 @@ case 1:
|
|
836
837
|
goto st9;
|
837
838
|
goto st0;
|
838
839
|
st0:
|
839
|
-
|
840
|
+
cs = 0;
|
841
|
+
goto _out;
|
840
842
|
st2:
|
841
843
|
if ( ++p == pe )
|
842
|
-
goto
|
844
|
+
goto _test_eof2;
|
843
845
|
case 2:
|
844
846
|
if ( (*p) == 48 )
|
845
847
|
goto st3;
|
@@ -848,7 +850,7 @@ case 2:
|
|
848
850
|
goto st0;
|
849
851
|
st3:
|
850
852
|
if ( ++p == pe )
|
851
|
-
goto
|
853
|
+
goto _test_eof3;
|
852
854
|
case 3:
|
853
855
|
switch( (*p) ) {
|
854
856
|
case 46: goto st4;
|
@@ -858,14 +860,14 @@ case 3:
|
|
858
860
|
goto st0;
|
859
861
|
st4:
|
860
862
|
if ( ++p == pe )
|
861
|
-
goto
|
863
|
+
goto _test_eof4;
|
862
864
|
case 4:
|
863
865
|
if ( 48 <= (*p) && (*p) <= 57 )
|
864
866
|
goto st5;
|
865
867
|
goto st0;
|
866
868
|
st5:
|
867
869
|
if ( ++p == pe )
|
868
|
-
goto
|
870
|
+
goto _test_eof5;
|
869
871
|
case 5:
|
870
872
|
switch( (*p) ) {
|
871
873
|
case 69: goto st6;
|
@@ -878,18 +880,18 @@ case 5:
|
|
878
880
|
goto st0;
|
879
881
|
goto tr7;
|
880
882
|
tr7:
|
881
|
-
#line
|
882
|
-
{ goto
|
883
|
+
#line 259 "parser.rl"
|
884
|
+
{ p--; {p++; cs = 10; goto _out;} }
|
883
885
|
goto st10;
|
884
886
|
st10:
|
885
887
|
if ( ++p == pe )
|
886
|
-
goto
|
888
|
+
goto _test_eof10;
|
887
889
|
case 10:
|
888
|
-
#line
|
890
|
+
#line 891 "parser.c"
|
889
891
|
goto st0;
|
890
892
|
st6:
|
891
893
|
if ( ++p == pe )
|
892
|
-
goto
|
894
|
+
goto _test_eof6;
|
893
895
|
case 6:
|
894
896
|
switch( (*p) ) {
|
895
897
|
case 43: goto st7;
|
@@ -900,14 +902,14 @@ case 6:
|
|
900
902
|
goto st0;
|
901
903
|
st7:
|
902
904
|
if ( ++p == pe )
|
903
|
-
goto
|
905
|
+
goto _test_eof7;
|
904
906
|
case 7:
|
905
907
|
if ( 48 <= (*p) && (*p) <= 57 )
|
906
908
|
goto st8;
|
907
909
|
goto st0;
|
908
910
|
st8:
|
909
911
|
if ( ++p == pe )
|
910
|
-
goto
|
912
|
+
goto _test_eof8;
|
911
913
|
case 8:
|
912
914
|
switch( (*p) ) {
|
913
915
|
case 69: goto st0;
|
@@ -921,7 +923,7 @@ case 8:
|
|
921
923
|
goto tr7;
|
922
924
|
st9:
|
923
925
|
if ( ++p == pe )
|
924
|
-
goto
|
926
|
+
goto _test_eof9;
|
925
927
|
case 9:
|
926
928
|
switch( (*p) ) {
|
927
929
|
case 46: goto st4;
|
@@ -932,20 +934,20 @@ case 9:
|
|
932
934
|
goto st9;
|
933
935
|
goto st0;
|
934
936
|
}
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
937
|
+
_test_eof2: cs = 2; goto _test_eof;
|
938
|
+
_test_eof3: cs = 3; goto _test_eof;
|
939
|
+
_test_eof4: cs = 4; goto _test_eof;
|
940
|
+
_test_eof5: cs = 5; goto _test_eof;
|
941
|
+
_test_eof10: cs = 10; goto _test_eof;
|
942
|
+
_test_eof6: cs = 6; goto _test_eof;
|
943
|
+
_test_eof7: cs = 7; goto _test_eof;
|
944
|
+
_test_eof8: cs = 8; goto _test_eof;
|
945
|
+
_test_eof9: cs = 9; goto _test_eof;
|
946
|
+
|
947
|
+
_test_eof: {}
|
946
948
|
_out: {}
|
947
949
|
}
|
948
|
-
#line
|
950
|
+
#line 274 "parser.rl"
|
949
951
|
|
950
952
|
if (cs >= JSON_float_first_final) {
|
951
953
|
long len = p - json->memo;
|
@@ -958,14 +960,14 @@ case 9:
|
|
958
960
|
|
959
961
|
|
960
962
|
|
961
|
-
#line
|
963
|
+
#line 964 "parser.c"
|
962
964
|
static const int JSON_array_start = 1;
|
963
965
|
static const int JSON_array_first_final = 17;
|
964
966
|
static const int JSON_array_error = 0;
|
965
967
|
|
966
968
|
static const int JSON_array_en_main = 1;
|
967
969
|
|
968
|
-
#line
|
970
|
+
#line 310 "parser.rl"
|
969
971
|
|
970
972
|
|
971
973
|
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -978,16 +980,16 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
|
|
978
980
|
*result = rb_ary_new();
|
979
981
|
|
980
982
|
|
981
|
-
#line
|
983
|
+
#line 984 "parser.c"
|
982
984
|
{
|
983
985
|
cs = JSON_array_start;
|
984
986
|
}
|
985
|
-
#line
|
987
|
+
#line 322 "parser.rl"
|
986
988
|
|
987
|
-
#line
|
989
|
+
#line 990 "parser.c"
|
988
990
|
{
|
989
991
|
if ( p == pe )
|
990
|
-
goto
|
992
|
+
goto _test_eof;
|
991
993
|
switch ( cs )
|
992
994
|
{
|
993
995
|
case 1:
|
@@ -995,10 +997,11 @@ case 1:
|
|
995
997
|
goto st2;
|
996
998
|
goto st0;
|
997
999
|
st0:
|
998
|
-
|
1000
|
+
cs = 0;
|
1001
|
+
goto _out;
|
999
1002
|
st2:
|
1000
1003
|
if ( ++p == pe )
|
1001
|
-
goto
|
1004
|
+
goto _test_eof2;
|
1002
1005
|
case 2:
|
1003
1006
|
switch( (*p) ) {
|
1004
1007
|
case 13: goto st2;
|
@@ -1022,12 +1025,12 @@ case 2:
|
|
1022
1025
|
goto st2;
|
1023
1026
|
goto st0;
|
1024
1027
|
tr2:
|
1025
|
-
#line
|
1028
|
+
#line 291 "parser.rl"
|
1026
1029
|
{
|
1027
1030
|
VALUE v = Qnil;
|
1028
1031
|
char *np = JSON_parse_value(json, p, pe, &v);
|
1029
1032
|
if (np == NULL) {
|
1030
|
-
goto
|
1033
|
+
p--; {p++; cs = 3; goto _out;}
|
1031
1034
|
} else {
|
1032
1035
|
rb_ary_push(*result, v);
|
1033
1036
|
{p = (( np))-1;}
|
@@ -1036,9 +1039,9 @@ tr2:
|
|
1036
1039
|
goto st3;
|
1037
1040
|
st3:
|
1038
1041
|
if ( ++p == pe )
|
1039
|
-
goto
|
1042
|
+
goto _test_eof3;
|
1040
1043
|
case 3:
|
1041
|
-
#line
|
1044
|
+
#line 1045 "parser.c"
|
1042
1045
|
switch( (*p) ) {
|
1043
1046
|
case 13: goto st3;
|
1044
1047
|
case 32: goto st3;
|
@@ -1051,7 +1054,7 @@ case 3:
|
|
1051
1054
|
goto st0;
|
1052
1055
|
st4:
|
1053
1056
|
if ( ++p == pe )
|
1054
|
-
goto
|
1057
|
+
goto _test_eof4;
|
1055
1058
|
case 4:
|
1056
1059
|
switch( (*p) ) {
|
1057
1060
|
case 13: goto st4;
|
@@ -1075,7 +1078,7 @@ case 4:
|
|
1075
1078
|
goto st0;
|
1076
1079
|
st5:
|
1077
1080
|
if ( ++p == pe )
|
1078
|
-
goto
|
1081
|
+
goto _test_eof5;
|
1079
1082
|
case 5:
|
1080
1083
|
switch( (*p) ) {
|
1081
1084
|
case 42: goto st6;
|
@@ -1084,14 +1087,14 @@ case 5:
|
|
1084
1087
|
goto st0;
|
1085
1088
|
st6:
|
1086
1089
|
if ( ++p == pe )
|
1087
|
-
goto
|
1090
|
+
goto _test_eof6;
|
1088
1091
|
case 6:
|
1089
1092
|
if ( (*p) == 42 )
|
1090
1093
|
goto st7;
|
1091
1094
|
goto st6;
|
1092
1095
|
st7:
|
1093
1096
|
if ( ++p == pe )
|
1094
|
-
goto
|
1097
|
+
goto _test_eof7;
|
1095
1098
|
case 7:
|
1096
1099
|
switch( (*p) ) {
|
1097
1100
|
case 42: goto st7;
|
@@ -1100,14 +1103,14 @@ case 7:
|
|
1100
1103
|
goto st6;
|
1101
1104
|
st8:
|
1102
1105
|
if ( ++p == pe )
|
1103
|
-
goto
|
1106
|
+
goto _test_eof8;
|
1104
1107
|
case 8:
|
1105
1108
|
if ( (*p) == 10 )
|
1106
1109
|
goto st4;
|
1107
1110
|
goto st8;
|
1108
1111
|
st9:
|
1109
1112
|
if ( ++p == pe )
|
1110
|
-
goto
|
1113
|
+
goto _test_eof9;
|
1111
1114
|
case 9:
|
1112
1115
|
switch( (*p) ) {
|
1113
1116
|
case 42: goto st10;
|
@@ -1116,14 +1119,14 @@ case 9:
|
|
1116
1119
|
goto st0;
|
1117
1120
|
st10:
|
1118
1121
|
if ( ++p == pe )
|
1119
|
-
goto
|
1122
|
+
goto _test_eof10;
|
1120
1123
|
case 10:
|
1121
1124
|
if ( (*p) == 42 )
|
1122
1125
|
goto st11;
|
1123
1126
|
goto st10;
|
1124
1127
|
st11:
|
1125
1128
|
if ( ++p == pe )
|
1126
|
-
goto
|
1129
|
+
goto _test_eof11;
|
1127
1130
|
case 11:
|
1128
1131
|
switch( (*p) ) {
|
1129
1132
|
case 42: goto st11;
|
@@ -1132,24 +1135,24 @@ case 11:
|
|
1132
1135
|
goto st10;
|
1133
1136
|
st12:
|
1134
1137
|
if ( ++p == pe )
|
1135
|
-
goto
|
1138
|
+
goto _test_eof12;
|
1136
1139
|
case 12:
|
1137
1140
|
if ( (*p) == 10 )
|
1138
1141
|
goto st3;
|
1139
1142
|
goto st12;
|
1140
1143
|
tr4:
|
1141
|
-
#line
|
1142
|
-
{ goto
|
1144
|
+
#line 302 "parser.rl"
|
1145
|
+
{ p--; {p++; cs = 17; goto _out;} }
|
1143
1146
|
goto st17;
|
1144
1147
|
st17:
|
1145
1148
|
if ( ++p == pe )
|
1146
|
-
goto
|
1149
|
+
goto _test_eof17;
|
1147
1150
|
case 17:
|
1148
|
-
#line
|
1151
|
+
#line 1152 "parser.c"
|
1149
1152
|
goto st0;
|
1150
1153
|
st13:
|
1151
1154
|
if ( ++p == pe )
|
1152
|
-
goto
|
1155
|
+
goto _test_eof13;
|
1153
1156
|
case 13:
|
1154
1157
|
switch( (*p) ) {
|
1155
1158
|
case 42: goto st14;
|
@@ -1158,14 +1161,14 @@ case 13:
|
|
1158
1161
|
goto st0;
|
1159
1162
|
st14:
|
1160
1163
|
if ( ++p == pe )
|
1161
|
-
goto
|
1164
|
+
goto _test_eof14;
|
1162
1165
|
case 14:
|
1163
1166
|
if ( (*p) == 42 )
|
1164
1167
|
goto st15;
|
1165
1168
|
goto st14;
|
1166
1169
|
st15:
|
1167
1170
|
if ( ++p == pe )
|
1168
|
-
goto
|
1171
|
+
goto _test_eof15;
|
1169
1172
|
case 15:
|
1170
1173
|
switch( (*p) ) {
|
1171
1174
|
case 42: goto st15;
|
@@ -1174,38 +1177,38 @@ case 15:
|
|
1174
1177
|
goto st14;
|
1175
1178
|
st16:
|
1176
1179
|
if ( ++p == pe )
|
1177
|
-
goto
|
1180
|
+
goto _test_eof16;
|
1178
1181
|
case 16:
|
1179
1182
|
if ( (*p) == 10 )
|
1180
1183
|
goto st2;
|
1181
1184
|
goto st16;
|
1182
1185
|
}
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1186
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1187
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1188
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1189
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1190
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1191
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1192
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1193
|
+
_test_eof9: cs = 9; goto _test_eof;
|
1194
|
+
_test_eof10: cs = 10; goto _test_eof;
|
1195
|
+
_test_eof11: cs = 11; goto _test_eof;
|
1196
|
+
_test_eof12: cs = 12; goto _test_eof;
|
1197
|
+
_test_eof17: cs = 17; goto _test_eof;
|
1198
|
+
_test_eof13: cs = 13; goto _test_eof;
|
1199
|
+
_test_eof14: cs = 14; goto _test_eof;
|
1200
|
+
_test_eof15: cs = 15; goto _test_eof;
|
1201
|
+
_test_eof16: cs = 16; goto _test_eof;
|
1202
|
+
|
1203
|
+
_test_eof: {}
|
1201
1204
|
_out: {}
|
1202
1205
|
}
|
1203
|
-
#line
|
1206
|
+
#line 323 "parser.rl"
|
1204
1207
|
|
1205
1208
|
if(cs >= JSON_array_first_final) {
|
1206
1209
|
return p + 1;
|
1207
1210
|
} else {
|
1208
|
-
rb_raise(eParserError, "unexpected token at '%s'", p);
|
1211
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
1209
1212
|
}
|
1210
1213
|
}
|
1211
1214
|
|
@@ -1266,14 +1269,14 @@ static VALUE json_string_unescape(char *p, char *pe)
|
|
1266
1269
|
}
|
1267
1270
|
|
1268
1271
|
|
1269
|
-
#line
|
1272
|
+
#line 1273 "parser.c"
|
1270
1273
|
static const int JSON_string_start = 1;
|
1271
1274
|
static const int JSON_string_first_final = 8;
|
1272
1275
|
static const int JSON_string_error = 0;
|
1273
1276
|
|
1274
1277
|
static const int JSON_string_en_main = 1;
|
1275
1278
|
|
1276
|
-
#line
|
1279
|
+
#line 401 "parser.rl"
|
1277
1280
|
|
1278
1281
|
|
1279
1282
|
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
@@ -1282,17 +1285,17 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
1282
1285
|
|
1283
1286
|
*result = rb_str_new("", 0);
|
1284
1287
|
|
1285
|
-
#line
|
1288
|
+
#line 1289 "parser.c"
|
1286
1289
|
{
|
1287
1290
|
cs = JSON_string_start;
|
1288
1291
|
}
|
1289
|
-
#line
|
1292
|
+
#line 409 "parser.rl"
|
1290
1293
|
json->memo = p;
|
1291
1294
|
|
1292
|
-
#line
|
1295
|
+
#line 1296 "parser.c"
|
1293
1296
|
{
|
1294
1297
|
if ( p == pe )
|
1295
|
-
goto
|
1298
|
+
goto _test_eof;
|
1296
1299
|
switch ( cs )
|
1297
1300
|
{
|
1298
1301
|
case 1:
|
@@ -1300,10 +1303,11 @@ case 1:
|
|
1300
1303
|
goto st2;
|
1301
1304
|
goto st0;
|
1302
1305
|
st0:
|
1303
|
-
|
1306
|
+
cs = 0;
|
1307
|
+
goto _out;
|
1304
1308
|
st2:
|
1305
1309
|
if ( ++p == pe )
|
1306
|
-
goto
|
1310
|
+
goto _test_eof2;
|
1307
1311
|
case 2:
|
1308
1312
|
switch( (*p) ) {
|
1309
1313
|
case 34: goto tr2;
|
@@ -1313,23 +1317,23 @@ case 2:
|
|
1313
1317
|
goto st0;
|
1314
1318
|
goto st2;
|
1315
1319
|
tr2:
|
1316
|
-
#line
|
1320
|
+
#line 393 "parser.rl"
|
1317
1321
|
{
|
1318
1322
|
*result = json_string_unescape(json->memo + 1, p);
|
1319
|
-
if (NIL_P(*result)) goto
|
1323
|
+
if (NIL_P(*result)) { p--; {p++; cs = 8; goto _out;} } else {p = (( p + 1))-1;}
|
1320
1324
|
}
|
1321
|
-
#line
|
1322
|
-
{ goto
|
1325
|
+
#line 398 "parser.rl"
|
1326
|
+
{ p--; {p++; cs = 8; goto _out;} }
|
1323
1327
|
goto st8;
|
1324
1328
|
st8:
|
1325
1329
|
if ( ++p == pe )
|
1326
|
-
goto
|
1330
|
+
goto _test_eof8;
|
1327
1331
|
case 8:
|
1328
|
-
#line
|
1332
|
+
#line 1333 "parser.c"
|
1329
1333
|
goto st0;
|
1330
1334
|
st3:
|
1331
1335
|
if ( ++p == pe )
|
1332
|
-
goto
|
1336
|
+
goto _test_eof3;
|
1333
1337
|
case 3:
|
1334
1338
|
if ( (*p) == 117 )
|
1335
1339
|
goto st4;
|
@@ -1338,7 +1342,7 @@ case 3:
|
|
1338
1342
|
goto st2;
|
1339
1343
|
st4:
|
1340
1344
|
if ( ++p == pe )
|
1341
|
-
goto
|
1345
|
+
goto _test_eof4;
|
1342
1346
|
case 4:
|
1343
1347
|
if ( (*p) < 65 ) {
|
1344
1348
|
if ( 48 <= (*p) && (*p) <= 57 )
|
@@ -1351,7 +1355,7 @@ case 4:
|
|
1351
1355
|
goto st0;
|
1352
1356
|
st5:
|
1353
1357
|
if ( ++p == pe )
|
1354
|
-
goto
|
1358
|
+
goto _test_eof5;
|
1355
1359
|
case 5:
|
1356
1360
|
if ( (*p) < 65 ) {
|
1357
1361
|
if ( 48 <= (*p) && (*p) <= 57 )
|
@@ -1364,7 +1368,7 @@ case 5:
|
|
1364
1368
|
goto st0;
|
1365
1369
|
st6:
|
1366
1370
|
if ( ++p == pe )
|
1367
|
-
goto
|
1371
|
+
goto _test_eof6;
|
1368
1372
|
case 6:
|
1369
1373
|
if ( (*p) < 65 ) {
|
1370
1374
|
if ( 48 <= (*p) && (*p) <= 57 )
|
@@ -1377,7 +1381,7 @@ case 6:
|
|
1377
1381
|
goto st0;
|
1378
1382
|
st7:
|
1379
1383
|
if ( ++p == pe )
|
1380
|
-
goto
|
1384
|
+
goto _test_eof7;
|
1381
1385
|
case 7:
|
1382
1386
|
if ( (*p) < 65 ) {
|
1383
1387
|
if ( 48 <= (*p) && (*p) <= 57 )
|
@@ -1389,18 +1393,18 @@ case 7:
|
|
1389
1393
|
goto st2;
|
1390
1394
|
goto st0;
|
1391
1395
|
}
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1396
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1397
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1398
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1399
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1400
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1401
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1402
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1403
|
+
|
1404
|
+
_test_eof: {}
|
1401
1405
|
_out: {}
|
1402
1406
|
}
|
1403
|
-
#line
|
1407
|
+
#line 411 "parser.rl"
|
1404
1408
|
|
1405
1409
|
if (cs >= JSON_string_first_final) {
|
1406
1410
|
return p + 1;
|
@@ -1411,14 +1415,14 @@ case 7:
|
|
1411
1415
|
|
1412
1416
|
|
1413
1417
|
|
1414
|
-
#line
|
1418
|
+
#line 1419 "parser.c"
|
1415
1419
|
static const int JSON_start = 1;
|
1416
1420
|
static const int JSON_first_final = 10;
|
1417
1421
|
static const int JSON_error = 0;
|
1418
1422
|
|
1419
1423
|
static const int JSON_en_main = 1;
|
1420
1424
|
|
1421
|
-
#line
|
1425
|
+
#line 445 "parser.rl"
|
1422
1426
|
|
1423
1427
|
|
1424
1428
|
/*
|
@@ -1541,23 +1545,23 @@ static VALUE cParser_parse(VALUE self)
|
|
1541
1545
|
GET_STRUCT;
|
1542
1546
|
|
1543
1547
|
|
1544
|
-
#line
|
1548
|
+
#line 1549 "parser.c"
|
1545
1549
|
{
|
1546
1550
|
cs = JSON_start;
|
1547
1551
|
}
|
1548
|
-
#line
|
1552
|
+
#line 567 "parser.rl"
|
1549
1553
|
p = json->source;
|
1550
1554
|
pe = p + json->len;
|
1551
1555
|
|
1552
|
-
#line
|
1556
|
+
#line 1557 "parser.c"
|
1553
1557
|
{
|
1554
1558
|
if ( p == pe )
|
1555
|
-
goto
|
1559
|
+
goto _test_eof;
|
1556
1560
|
switch ( cs )
|
1557
1561
|
{
|
1558
1562
|
st1:
|
1559
1563
|
if ( ++p == pe )
|
1560
|
-
goto
|
1564
|
+
goto _test_eof1;
|
1561
1565
|
case 1:
|
1562
1566
|
switch( (*p) ) {
|
1563
1567
|
case 13: goto st1;
|
@@ -1570,10 +1574,11 @@ case 1:
|
|
1570
1574
|
goto st1;
|
1571
1575
|
goto st0;
|
1572
1576
|
st0:
|
1573
|
-
|
1577
|
+
cs = 0;
|
1578
|
+
goto _out;
|
1574
1579
|
st2:
|
1575
1580
|
if ( ++p == pe )
|
1576
|
-
goto
|
1581
|
+
goto _test_eof2;
|
1577
1582
|
case 2:
|
1578
1583
|
switch( (*p) ) {
|
1579
1584
|
case 42: goto st3;
|
@@ -1582,14 +1587,14 @@ case 2:
|
|
1582
1587
|
goto st0;
|
1583
1588
|
st3:
|
1584
1589
|
if ( ++p == pe )
|
1585
|
-
goto
|
1590
|
+
goto _test_eof3;
|
1586
1591
|
case 3:
|
1587
1592
|
if ( (*p) == 42 )
|
1588
1593
|
goto st4;
|
1589
1594
|
goto st3;
|
1590
1595
|
st4:
|
1591
1596
|
if ( ++p == pe )
|
1592
|
-
goto
|
1597
|
+
goto _test_eof4;
|
1593
1598
|
case 4:
|
1594
1599
|
switch( (*p) ) {
|
1595
1600
|
case 42: goto st4;
|
@@ -1598,34 +1603,34 @@ case 4:
|
|
1598
1603
|
goto st3;
|
1599
1604
|
st5:
|
1600
1605
|
if ( ++p == pe )
|
1601
|
-
goto
|
1606
|
+
goto _test_eof5;
|
1602
1607
|
case 5:
|
1603
1608
|
if ( (*p) == 10 )
|
1604
1609
|
goto st1;
|
1605
1610
|
goto st5;
|
1606
1611
|
tr3:
|
1607
|
-
#line
|
1612
|
+
#line 434 "parser.rl"
|
1608
1613
|
{
|
1609
1614
|
char *np;
|
1610
1615
|
json->current_nesting = 1;
|
1611
1616
|
np = JSON_parse_array(json, p, pe, &result);
|
1612
|
-
if (np == NULL) goto
|
1617
|
+
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
1613
1618
|
}
|
1614
1619
|
goto st10;
|
1615
1620
|
tr4:
|
1616
|
-
#line
|
1621
|
+
#line 427 "parser.rl"
|
1617
1622
|
{
|
1618
1623
|
char *np;
|
1619
1624
|
json->current_nesting = 1;
|
1620
1625
|
np = JSON_parse_object(json, p, pe, &result);
|
1621
|
-
if (np == NULL) goto
|
1626
|
+
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
1622
1627
|
}
|
1623
1628
|
goto st10;
|
1624
1629
|
st10:
|
1625
1630
|
if ( ++p == pe )
|
1626
|
-
goto
|
1631
|
+
goto _test_eof10;
|
1627
1632
|
case 10:
|
1628
|
-
#line
|
1633
|
+
#line 1634 "parser.c"
|
1629
1634
|
switch( (*p) ) {
|
1630
1635
|
case 13: goto st10;
|
1631
1636
|
case 32: goto st10;
|
@@ -1636,7 +1641,7 @@ case 10:
|
|
1636
1641
|
goto st0;
|
1637
1642
|
st6:
|
1638
1643
|
if ( ++p == pe )
|
1639
|
-
goto
|
1644
|
+
goto _test_eof6;
|
1640
1645
|
case 6:
|
1641
1646
|
switch( (*p) ) {
|
1642
1647
|
case 42: goto st7;
|
@@ -1645,14 +1650,14 @@ case 6:
|
|
1645
1650
|
goto st0;
|
1646
1651
|
st7:
|
1647
1652
|
if ( ++p == pe )
|
1648
|
-
goto
|
1653
|
+
goto _test_eof7;
|
1649
1654
|
case 7:
|
1650
1655
|
if ( (*p) == 42 )
|
1651
1656
|
goto st8;
|
1652
1657
|
goto st7;
|
1653
1658
|
st8:
|
1654
1659
|
if ( ++p == pe )
|
1655
|
-
goto
|
1660
|
+
goto _test_eof8;
|
1656
1661
|
case 8:
|
1657
1662
|
switch( (*p) ) {
|
1658
1663
|
case 42: goto st8;
|
@@ -1661,32 +1666,32 @@ case 8:
|
|
1661
1666
|
goto st7;
|
1662
1667
|
st9:
|
1663
1668
|
if ( ++p == pe )
|
1664
|
-
goto
|
1669
|
+
goto _test_eof9;
|
1665
1670
|
case 9:
|
1666
1671
|
if ( (*p) == 10 )
|
1667
1672
|
goto st10;
|
1668
1673
|
goto st9;
|
1669
1674
|
}
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1675
|
+
_test_eof1: cs = 1; goto _test_eof;
|
1676
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1677
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1678
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1679
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1680
|
+
_test_eof10: cs = 10; goto _test_eof;
|
1681
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1682
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1683
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1684
|
+
_test_eof9: cs = 9; goto _test_eof;
|
1685
|
+
|
1686
|
+
_test_eof: {}
|
1682
1687
|
_out: {}
|
1683
1688
|
}
|
1684
|
-
#line
|
1689
|
+
#line 570 "parser.rl"
|
1685
1690
|
|
1686
1691
|
if (cs >= JSON_first_final && p == pe) {
|
1687
1692
|
return result;
|
1688
1693
|
} else {
|
1689
|
-
rb_raise(eParserError, "unexpected token at '%s'", p);
|
1694
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
1690
1695
|
}
|
1691
1696
|
}
|
1692
1697
|
|
@@ -1728,6 +1733,7 @@ static VALUE cParser_source(VALUE self)
|
|
1728
1733
|
|
1729
1734
|
void Init_parser()
|
1730
1735
|
{
|
1736
|
+
rb_require("json/common");
|
1731
1737
|
mJSON = rb_define_module("JSON");
|
1732
1738
|
mExt = rb_define_module_under(mJSON, "Ext");
|
1733
1739
|
cParser = rb_define_class_under(mExt, "Parser", rb_cObject);
|