edn_turbo 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/bin/ppedn +24 -3
- data/ext/edn_turbo/edn_parser.cc +524 -318
- data/ext/edn_turbo/edn_parser.h +21 -7
- data/ext/edn_turbo/edn_parser.rl +126 -29
- data/ext/edn_turbo/edn_parser_util.cc +70 -16
- data/ext/edn_turbo/main.cc +21 -11
- data/lib/edn_turbo/edn_parser.rb +2 -1
- data/lib/edn_turbo/version.rb +2 -2
- data/lib/edn_turbo.rb +30 -0
- data/test/test_output_diff.rb +28 -1
- metadata +4 -3
data/ext/edn_turbo/edn_parser.cc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#line 1 "edn_parser.rl"
|
3
3
|
#include <iostream>
|
4
4
|
#include <string>
|
5
|
-
#include <
|
5
|
+
#include <vector>
|
6
6
|
#include <exception>
|
7
7
|
|
8
8
|
#include "edn_parser.h"
|
@@ -16,7 +16,7 @@
|
|
16
16
|
//
|
17
17
|
|
18
18
|
|
19
|
-
#line
|
19
|
+
#line 59 "edn_parser.rl"
|
20
20
|
|
21
21
|
|
22
22
|
// ============================================================
|
@@ -32,7 +32,7 @@ static const int EDN_value_error = 0;
|
|
32
32
|
static const int EDN_value_en_main = 1;
|
33
33
|
|
34
34
|
|
35
|
-
#line
|
35
|
+
#line 175 "edn_parser.rl"
|
36
36
|
|
37
37
|
|
38
38
|
|
@@ -46,7 +46,7 @@ const char *edn::Parser::parse_value(const char *p, const char *pe, VALUE& v)
|
|
46
46
|
cs = EDN_value_start;
|
47
47
|
}
|
48
48
|
|
49
|
-
#line
|
49
|
+
#line 183 "edn_parser.rl"
|
50
50
|
|
51
51
|
#line 52 "edn_parser.cc"
|
52
52
|
{
|
@@ -62,8 +62,9 @@ case 1:
|
|
62
62
|
case 58: goto tr6;
|
63
63
|
case 91: goto tr8;
|
64
64
|
case 92: goto tr9;
|
65
|
+
case 94: goto tr10;
|
65
66
|
case 95: goto tr0;
|
66
|
-
case 123: goto
|
67
|
+
case 123: goto tr11;
|
67
68
|
}
|
68
69
|
if ( (*p) < 48 ) {
|
69
70
|
if ( (*p) < 42 ) {
|
@@ -90,7 +91,7 @@ st0:
|
|
90
91
|
cs = 0;
|
91
92
|
goto _out;
|
92
93
|
tr0:
|
93
|
-
#line
|
94
|
+
#line 103 "edn_parser.rl"
|
94
95
|
{
|
95
96
|
// stand-alone operators *, +, -, etc.
|
96
97
|
const char *np = parse_operator(p, pe, v);
|
@@ -98,7 +99,7 @@ tr0:
|
|
98
99
|
}
|
99
100
|
goto st2;
|
100
101
|
tr2:
|
101
|
-
#line
|
102
|
+
#line 71 "edn_parser.rl"
|
102
103
|
{
|
103
104
|
// string types within double-quotes
|
104
105
|
const char *np = parse_string(p, pe, v);
|
@@ -106,7 +107,7 @@ tr2:
|
|
106
107
|
}
|
107
108
|
goto st2;
|
108
109
|
tr3:
|
109
|
-
#line
|
110
|
+
#line 155 "edn_parser.rl"
|
110
111
|
{
|
111
112
|
// handles tokens w/ leading # ("#_", "#{", and tagged elems)
|
112
113
|
const char *np = parse_dispatch(p + 1, pe, v);
|
@@ -114,7 +115,7 @@ tr3:
|
|
114
115
|
}
|
115
116
|
goto st2;
|
116
117
|
tr4:
|
117
|
-
#line
|
118
|
+
#line 137 "edn_parser.rl"
|
118
119
|
{
|
119
120
|
// (
|
120
121
|
const char *np = parse_list(p, pe, v);
|
@@ -122,7 +123,7 @@ tr4:
|
|
122
123
|
}
|
123
124
|
goto st2;
|
124
125
|
tr5:
|
125
|
-
#line
|
126
|
+
#line 83 "edn_parser.rl"
|
126
127
|
{
|
127
128
|
// tokens w/ leading digits: non-negative integers & decimals.
|
128
129
|
// try to parse a decimal first
|
@@ -144,7 +145,7 @@ tr5:
|
|
144
145
|
}
|
145
146
|
goto st2;
|
146
147
|
tr6:
|
147
|
-
#line
|
148
|
+
#line 77 "edn_parser.rl"
|
148
149
|
{
|
149
150
|
// tokens with a leading ':'
|
150
151
|
const char *np = parse_keyword(p, pe, v);
|
@@ -152,7 +153,7 @@ tr6:
|
|
152
153
|
}
|
153
154
|
goto st2;
|
154
155
|
tr7:
|
155
|
-
#line
|
156
|
+
#line 115 "edn_parser.rl"
|
156
157
|
{
|
157
158
|
// user identifiers and reserved keywords (true, false, nil)
|
158
159
|
VALUE sym = Qnil;
|
@@ -170,7 +171,7 @@ tr7:
|
|
170
171
|
}
|
171
172
|
goto st2;
|
172
173
|
tr8:
|
173
|
-
#line
|
174
|
+
#line 131 "edn_parser.rl"
|
174
175
|
{
|
175
176
|
// [
|
176
177
|
const char *np = parse_vector(p, pe, v);
|
@@ -178,7 +179,7 @@ tr8:
|
|
178
179
|
}
|
179
180
|
goto st2;
|
180
181
|
tr9:
|
181
|
-
#line
|
182
|
+
#line 109 "edn_parser.rl"
|
182
183
|
{
|
183
184
|
// tokens w/ leading \ (escaped characters \newline, \c, etc.)
|
184
185
|
const char *np = parse_esc_char(p, pe, v);
|
@@ -186,7 +187,15 @@ tr9:
|
|
186
187
|
}
|
187
188
|
goto st2;
|
188
189
|
tr10:
|
189
|
-
#line
|
190
|
+
#line 149 "edn_parser.rl"
|
191
|
+
{
|
192
|
+
// ^
|
193
|
+
const char *np = parse_meta(p, pe);
|
194
|
+
if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
195
|
+
}
|
196
|
+
goto st2;
|
197
|
+
tr11:
|
198
|
+
#line 143 "edn_parser.rl"
|
190
199
|
{
|
191
200
|
// {
|
192
201
|
const char *np = parse_map(p, pe, v);
|
@@ -197,9 +206,9 @@ st2:
|
|
197
206
|
if ( ++p == pe )
|
198
207
|
goto _test_eof2;
|
199
208
|
case 2:
|
200
|
-
#line
|
209
|
+
#line 58 "edn_parser.rl"
|
201
210
|
{ p--; {p++; cs = 2; goto _out;} }
|
202
|
-
#line
|
211
|
+
#line 212 "edn_parser.cc"
|
203
212
|
goto st0;
|
204
213
|
}
|
205
214
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -208,7 +217,7 @@ case 2:
|
|
208
217
|
_out: {}
|
209
218
|
}
|
210
219
|
|
211
|
-
#line
|
220
|
+
#line 184 "edn_parser.rl"
|
212
221
|
|
213
222
|
if (cs >= EDN_value_first_final) {
|
214
223
|
return p;
|
@@ -230,7 +239,7 @@ case 2:
|
|
230
239
|
// ascii range is found.
|
231
240
|
//
|
232
241
|
|
233
|
-
#line
|
242
|
+
#line 243 "edn_parser.cc"
|
234
243
|
static const int EDN_string_start = 1;
|
235
244
|
static const int EDN_string_first_final = 8;
|
236
245
|
static const int EDN_string_error = 0;
|
@@ -238,27 +247,26 @@ static const int EDN_string_error = 0;
|
|
238
247
|
static const int EDN_string_en_main = 1;
|
239
248
|
|
240
249
|
|
241
|
-
#line
|
250
|
+
#line 229 "edn_parser.rl"
|
242
251
|
|
243
252
|
|
244
253
|
|
245
254
|
const char* edn::Parser::parse_string(const char *p, const char *pe, VALUE& v)
|
246
255
|
{
|
247
|
-
// std::cerr << __FUNCTION__ << " - p: '" << p << "'" << std::endl;
|
248
256
|
static const char* EDN_TYPE = "string";
|
249
257
|
int cs;
|
250
258
|
bool encode = false;
|
251
259
|
|
252
260
|
|
253
|
-
#line
|
261
|
+
#line 262 "edn_parser.cc"
|
254
262
|
{
|
255
263
|
cs = EDN_string_start;
|
256
264
|
}
|
257
265
|
|
258
|
-
#line
|
266
|
+
#line 239 "edn_parser.rl"
|
259
267
|
const char* p_save = p;
|
260
268
|
|
261
|
-
#line
|
269
|
+
#line 270 "edn_parser.cc"
|
262
270
|
{
|
263
271
|
if ( p == pe )
|
264
272
|
goto _test_eof;
|
@@ -269,7 +277,7 @@ case 1:
|
|
269
277
|
goto st2;
|
270
278
|
goto st0;
|
271
279
|
tr3:
|
272
|
-
#line
|
280
|
+
#line 51 "edn_parser.rl"
|
273
281
|
{
|
274
282
|
std::stringstream s;
|
275
283
|
s << "unterminated " << EDN_TYPE;
|
@@ -277,12 +285,12 @@ tr3:
|
|
277
285
|
p--; {p++; cs = 0; goto _out;}
|
278
286
|
}
|
279
287
|
goto st0;
|
280
|
-
#line
|
288
|
+
#line 289 "edn_parser.cc"
|
281
289
|
st0:
|
282
290
|
cs = 0;
|
283
291
|
goto _out;
|
284
292
|
tr2:
|
285
|
-
#line
|
293
|
+
#line 218 "edn_parser.rl"
|
286
294
|
{
|
287
295
|
encode = true;
|
288
296
|
}
|
@@ -291,7 +299,7 @@ st2:
|
|
291
299
|
if ( ++p == pe )
|
292
300
|
goto _test_eof2;
|
293
301
|
case 2:
|
294
|
-
#line
|
302
|
+
#line 303 "edn_parser.cc"
|
295
303
|
switch( (*p) ) {
|
296
304
|
case 34: goto tr4;
|
297
305
|
case 92: goto tr5;
|
@@ -303,7 +311,7 @@ case 2:
|
|
303
311
|
goto tr2;
|
304
312
|
goto st2;
|
305
313
|
tr4:
|
306
|
-
#line
|
314
|
+
#line 210 "edn_parser.rl"
|
307
315
|
{
|
308
316
|
if (Parser::parse_byte_stream(p_save + 1, p, v, encode)) {
|
309
317
|
{p = (( p + 1))-1;}
|
@@ -311,17 +319,17 @@ tr4:
|
|
311
319
|
p--; {p++; cs = 8; goto _out;}
|
312
320
|
}
|
313
321
|
}
|
314
|
-
#line
|
322
|
+
#line 58 "edn_parser.rl"
|
315
323
|
{ p--; {p++; cs = 8; goto _out;} }
|
316
324
|
goto st8;
|
317
325
|
st8:
|
318
326
|
if ( ++p == pe )
|
319
327
|
goto _test_eof8;
|
320
328
|
case 8:
|
321
|
-
#line
|
329
|
+
#line 330 "edn_parser.cc"
|
322
330
|
goto st0;
|
323
331
|
tr5:
|
324
|
-
#line
|
332
|
+
#line 218 "edn_parser.rl"
|
325
333
|
{
|
326
334
|
encode = true;
|
327
335
|
}
|
@@ -330,7 +338,7 @@ st3:
|
|
330
338
|
if ( ++p == pe )
|
331
339
|
goto _test_eof3;
|
332
340
|
case 3:
|
333
|
-
#line
|
341
|
+
#line 342 "edn_parser.cc"
|
334
342
|
switch( (*p) ) {
|
335
343
|
case 34: goto tr2;
|
336
344
|
case 47: goto tr2;
|
@@ -346,7 +354,7 @@ case 3:
|
|
346
354
|
goto st0;
|
347
355
|
goto st2;
|
348
356
|
tr6:
|
349
|
-
#line
|
357
|
+
#line 218 "edn_parser.rl"
|
350
358
|
{
|
351
359
|
encode = true;
|
352
360
|
}
|
@@ -355,7 +363,7 @@ st4:
|
|
355
363
|
if ( ++p == pe )
|
356
364
|
goto _test_eof4;
|
357
365
|
case 4:
|
358
|
-
#line
|
366
|
+
#line 367 "edn_parser.cc"
|
359
367
|
if ( (*p) < 65 ) {
|
360
368
|
if ( 48 <= (*p) && (*p) <= 57 )
|
361
369
|
goto tr7;
|
@@ -366,7 +374,7 @@ case 4:
|
|
366
374
|
goto tr7;
|
367
375
|
goto st0;
|
368
376
|
tr7:
|
369
|
-
#line
|
377
|
+
#line 218 "edn_parser.rl"
|
370
378
|
{
|
371
379
|
encode = true;
|
372
380
|
}
|
@@ -375,7 +383,7 @@ st5:
|
|
375
383
|
if ( ++p == pe )
|
376
384
|
goto _test_eof5;
|
377
385
|
case 5:
|
378
|
-
#line
|
386
|
+
#line 387 "edn_parser.cc"
|
379
387
|
if ( (*p) < 65 ) {
|
380
388
|
if ( 48 <= (*p) && (*p) <= 57 )
|
381
389
|
goto tr8;
|
@@ -386,7 +394,7 @@ case 5:
|
|
386
394
|
goto tr8;
|
387
395
|
goto st0;
|
388
396
|
tr8:
|
389
|
-
#line
|
397
|
+
#line 218 "edn_parser.rl"
|
390
398
|
{
|
391
399
|
encode = true;
|
392
400
|
}
|
@@ -395,7 +403,7 @@ st6:
|
|
395
403
|
if ( ++p == pe )
|
396
404
|
goto _test_eof6;
|
397
405
|
case 6:
|
398
|
-
#line
|
406
|
+
#line 407 "edn_parser.cc"
|
399
407
|
if ( (*p) < 65 ) {
|
400
408
|
if ( 48 <= (*p) && (*p) <= 57 )
|
401
409
|
goto tr9;
|
@@ -406,7 +414,7 @@ case 6:
|
|
406
414
|
goto tr9;
|
407
415
|
goto st0;
|
408
416
|
tr9:
|
409
|
-
#line
|
417
|
+
#line 218 "edn_parser.rl"
|
410
418
|
{
|
411
419
|
encode = true;
|
412
420
|
}
|
@@ -415,7 +423,7 @@ st7:
|
|
415
423
|
if ( ++p == pe )
|
416
424
|
goto _test_eof7;
|
417
425
|
case 7:
|
418
|
-
#line
|
426
|
+
#line 427 "edn_parser.cc"
|
419
427
|
if ( (*p) < 65 ) {
|
420
428
|
if ( 48 <= (*p) && (*p) <= 57 )
|
421
429
|
goto tr2;
|
@@ -439,7 +447,7 @@ case 7:
|
|
439
447
|
{
|
440
448
|
switch ( cs ) {
|
441
449
|
case 2:
|
442
|
-
#line
|
450
|
+
#line 51 "edn_parser.rl"
|
443
451
|
{
|
444
452
|
std::stringstream s;
|
445
453
|
s << "unterminated " << EDN_TYPE;
|
@@ -447,14 +455,14 @@ case 7:
|
|
447
455
|
p--; {p++; cs = 0; goto _out;}
|
448
456
|
}
|
449
457
|
break;
|
450
|
-
#line
|
458
|
+
#line 459 "edn_parser.cc"
|
451
459
|
}
|
452
460
|
}
|
453
461
|
|
454
462
|
_out: {}
|
455
463
|
}
|
456
464
|
|
457
|
-
#line
|
465
|
+
#line 241 "edn_parser.rl"
|
458
466
|
|
459
467
|
if (cs >= EDN_string_first_final) {
|
460
468
|
return p + 1;
|
@@ -472,7 +480,7 @@ case 7:
|
|
472
480
|
// keyword parsing
|
473
481
|
//
|
474
482
|
|
475
|
-
#line
|
483
|
+
#line 484 "edn_parser.cc"
|
476
484
|
static const int EDN_keyword_start = 1;
|
477
485
|
static const int EDN_keyword_first_final = 3;
|
478
486
|
static const int EDN_keyword_error = 0;
|
@@ -480,7 +488,7 @@ static const int EDN_keyword_error = 0;
|
|
480
488
|
static const int EDN_keyword_en_main = 1;
|
481
489
|
|
482
490
|
|
483
|
-
#line
|
491
|
+
#line 270 "edn_parser.rl"
|
484
492
|
|
485
493
|
|
486
494
|
|
@@ -489,15 +497,15 @@ const char* edn::Parser::parse_keyword(const char *p, const char *pe, VALUE& v)
|
|
489
497
|
int cs;
|
490
498
|
|
491
499
|
|
492
|
-
#line
|
500
|
+
#line 501 "edn_parser.cc"
|
493
501
|
{
|
494
502
|
cs = EDN_keyword_start;
|
495
503
|
}
|
496
504
|
|
497
|
-
#line
|
505
|
+
#line 278 "edn_parser.rl"
|
498
506
|
const char* p_save = p;
|
499
507
|
|
500
|
-
#line
|
508
|
+
#line 509 "edn_parser.cc"
|
501
509
|
{
|
502
510
|
if ( p == pe )
|
503
511
|
goto _test_eof;
|
@@ -534,7 +542,7 @@ case 3:
|
|
534
542
|
case 95: goto st3;
|
535
543
|
}
|
536
544
|
if ( (*p) < 45 ) {
|
537
|
-
if ( (*p) >
|
545
|
+
if ( (*p) > 39 ) {
|
538
546
|
if ( 42 <= (*p) && (*p) <= 43 )
|
539
547
|
goto st3;
|
540
548
|
} else if ( (*p) >= 35 )
|
@@ -552,14 +560,14 @@ case 3:
|
|
552
560
|
goto st3;
|
553
561
|
goto tr3;
|
554
562
|
tr3:
|
555
|
-
#line
|
563
|
+
#line 58 "edn_parser.rl"
|
556
564
|
{ p--; {p++; cs = 4; goto _out;} }
|
557
565
|
goto st4;
|
558
566
|
st4:
|
559
567
|
if ( ++p == pe )
|
560
568
|
goto _test_eof4;
|
561
569
|
case 4:
|
562
|
-
#line
|
570
|
+
#line 571 "edn_parser.cc"
|
563
571
|
goto st0;
|
564
572
|
}
|
565
573
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -570,7 +578,7 @@ case 4:
|
|
570
578
|
_out: {}
|
571
579
|
}
|
572
580
|
|
573
|
-
#line
|
581
|
+
#line 280 "edn_parser.rl"
|
574
582
|
|
575
583
|
if (cs >= EDN_keyword_first_final) {
|
576
584
|
std::string buf;
|
@@ -594,14 +602,14 @@ case 4:
|
|
594
602
|
// decimal parsing machine
|
595
603
|
//
|
596
604
|
|
597
|
-
#line
|
605
|
+
#line 606 "edn_parser.cc"
|
598
606
|
static const int EDN_decimal_start = 1;
|
599
607
|
static const int EDN_decimal_first_final = 9;
|
600
608
|
|
601
609
|
static const int EDN_decimal_en_main = 1;
|
602
610
|
|
603
611
|
|
604
|
-
#line
|
612
|
+
#line 313 "edn_parser.rl"
|
605
613
|
|
606
614
|
|
607
615
|
|
@@ -610,15 +618,15 @@ const char* edn::Parser::parse_decimal(const char *p, const char *pe, VALUE& v)
|
|
610
618
|
int cs;
|
611
619
|
|
612
620
|
|
613
|
-
#line
|
621
|
+
#line 622 "edn_parser.cc"
|
614
622
|
{
|
615
623
|
cs = EDN_decimal_start;
|
616
624
|
}
|
617
625
|
|
618
|
-
#line
|
626
|
+
#line 321 "edn_parser.rl"
|
619
627
|
const char* p_save = p;
|
620
628
|
|
621
|
-
#line
|
629
|
+
#line 630 "edn_parser.cc"
|
622
630
|
{
|
623
631
|
if ( p == pe )
|
624
632
|
goto _test_eof;
|
@@ -672,14 +680,14 @@ case 9:
|
|
672
680
|
goto st0;
|
673
681
|
goto tr10;
|
674
682
|
tr10:
|
675
|
-
#line
|
683
|
+
#line 58 "edn_parser.rl"
|
676
684
|
{ p--; {p++; cs = 10; goto _out;} }
|
677
685
|
goto st10;
|
678
686
|
st10:
|
679
687
|
if ( ++p == pe )
|
680
688
|
goto _test_eof10;
|
681
689
|
case 10:
|
682
|
-
#line
|
690
|
+
#line 691 "edn_parser.cc"
|
683
691
|
goto st0;
|
684
692
|
st4:
|
685
693
|
if ( ++p == pe )
|
@@ -795,7 +803,7 @@ case 8:
|
|
795
803
|
_out: {}
|
796
804
|
}
|
797
805
|
|
798
|
-
#line
|
806
|
+
#line 323 "edn_parser.rl"
|
799
807
|
|
800
808
|
if (cs >= EDN_decimal_first_final) {
|
801
809
|
v = Parser::float_to_ruby(p_save, p - p_save);
|
@@ -810,14 +818,14 @@ case 8:
|
|
810
818
|
// integer parsing machine
|
811
819
|
//
|
812
820
|
|
813
|
-
#line
|
821
|
+
#line 822 "edn_parser.cc"
|
814
822
|
static const int EDN_integer_start = 1;
|
815
823
|
static const int EDN_integer_first_final = 3;
|
816
824
|
|
817
825
|
static const int EDN_integer_en_main = 1;
|
818
826
|
|
819
827
|
|
820
|
-
#line
|
828
|
+
#line 346 "edn_parser.rl"
|
821
829
|
|
822
830
|
|
823
831
|
const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
|
@@ -825,15 +833,15 @@ const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
|
|
825
833
|
int cs;
|
826
834
|
|
827
835
|
|
828
|
-
#line
|
836
|
+
#line 837 "edn_parser.cc"
|
829
837
|
{
|
830
838
|
cs = EDN_integer_start;
|
831
839
|
}
|
832
840
|
|
833
|
-
#line
|
841
|
+
#line 353 "edn_parser.rl"
|
834
842
|
const char* p_save = p;
|
835
843
|
|
836
|
-
#line
|
844
|
+
#line 845 "edn_parser.cc"
|
837
845
|
{
|
838
846
|
if ( p == pe )
|
839
847
|
goto _test_eof;
|
@@ -875,14 +883,14 @@ case 3:
|
|
875
883
|
goto st0;
|
876
884
|
goto tr4;
|
877
885
|
tr4:
|
878
|
-
#line
|
886
|
+
#line 58 "edn_parser.rl"
|
879
887
|
{ p--; {p++; cs = 4; goto _out;} }
|
880
888
|
goto st4;
|
881
889
|
st4:
|
882
890
|
if ( ++p == pe )
|
883
891
|
goto _test_eof4;
|
884
892
|
case 4:
|
885
|
-
#line
|
893
|
+
#line 894 "edn_parser.cc"
|
886
894
|
goto st0;
|
887
895
|
st5:
|
888
896
|
if ( ++p == pe )
|
@@ -923,7 +931,7 @@ case 6:
|
|
923
931
|
_out: {}
|
924
932
|
}
|
925
933
|
|
926
|
-
#line
|
934
|
+
#line 355 "edn_parser.rl"
|
927
935
|
|
928
936
|
if (cs >= EDN_integer_first_final) {
|
929
937
|
v = Parser::integer_to_ruby(p_save, p - p_save);
|
@@ -943,7 +951,7 @@ case 6:
|
|
943
951
|
// 3. stand-alone operators: +, -, /, *, etc.
|
944
952
|
//
|
945
953
|
|
946
|
-
#line
|
954
|
+
#line 955 "edn_parser.cc"
|
947
955
|
static const int EDN_operator_start = 1;
|
948
956
|
static const int EDN_operator_first_final = 3;
|
949
957
|
static const int EDN_operator_error = 0;
|
@@ -951,7 +959,7 @@ static const int EDN_operator_error = 0;
|
|
951
959
|
static const int EDN_operator_en_main = 1;
|
952
960
|
|
953
961
|
|
954
|
-
#line
|
962
|
+
#line 425 "edn_parser.rl"
|
955
963
|
|
956
964
|
|
957
965
|
|
@@ -960,15 +968,15 @@ const char* edn::Parser::parse_operator(const char *p, const char *pe, VALUE& v)
|
|
960
968
|
int cs;
|
961
969
|
|
962
970
|
|
963
|
-
#line
|
971
|
+
#line 972 "edn_parser.cc"
|
964
972
|
{
|
965
973
|
cs = EDN_operator_start;
|
966
974
|
}
|
967
975
|
|
968
|
-
#line
|
976
|
+
#line 433 "edn_parser.rl"
|
969
977
|
const char* p_save = p;
|
970
978
|
|
971
|
-
#line
|
979
|
+
#line 980 "edn_parser.cc"
|
972
980
|
{
|
973
981
|
if ( p == pe )
|
974
982
|
goto _test_eof;
|
@@ -1024,43 +1032,43 @@ case 3:
|
|
1024
1032
|
goto st0;
|
1025
1033
|
goto tr6;
|
1026
1034
|
tr6:
|
1027
|
-
#line
|
1035
|
+
#line 412 "edn_parser.rl"
|
1028
1036
|
{
|
1029
1037
|
// stand-alone operators (-, +, /, ... etc)
|
1030
1038
|
char op[2] = { *p_save, 0 };
|
1031
1039
|
VALUE sym = rb_str_new2(op);
|
1032
1040
|
v = Parser::make_edn_symbol(sym);
|
1033
1041
|
}
|
1034
|
-
#line
|
1042
|
+
#line 58 "edn_parser.rl"
|
1035
1043
|
{ p--; {p++; cs = 4; goto _out;} }
|
1036
1044
|
goto st4;
|
1037
1045
|
tr10:
|
1038
|
-
#line
|
1046
|
+
#line 58 "edn_parser.rl"
|
1039
1047
|
{ p--; {p++; cs = 4; goto _out;} }
|
1040
1048
|
goto st4;
|
1041
1049
|
st4:
|
1042
1050
|
if ( ++p == pe )
|
1043
1051
|
goto _test_eof4;
|
1044
1052
|
case 4:
|
1045
|
-
#line
|
1053
|
+
#line 1054 "edn_parser.cc"
|
1046
1054
|
goto st0;
|
1047
1055
|
tr5:
|
1048
1056
|
#line 20 "edn_parser.rl"
|
1049
1057
|
{ line_number++; }
|
1050
1058
|
goto st5;
|
1051
1059
|
tr7:
|
1052
|
-
#line
|
1060
|
+
#line 412 "edn_parser.rl"
|
1053
1061
|
{
|
1054
1062
|
// stand-alone operators (-, +, /, ... etc)
|
1055
1063
|
char op[2] = { *p_save, 0 };
|
1056
1064
|
VALUE sym = rb_str_new2(op);
|
1057
1065
|
v = Parser::make_edn_symbol(sym);
|
1058
1066
|
}
|
1059
|
-
#line
|
1067
|
+
#line 58 "edn_parser.rl"
|
1060
1068
|
{ p--; {p++; cs = 5; goto _out;} }
|
1061
1069
|
goto st5;
|
1062
1070
|
tr8:
|
1063
|
-
#line
|
1071
|
+
#line 412 "edn_parser.rl"
|
1064
1072
|
{
|
1065
1073
|
// stand-alone operators (-, +, /, ... etc)
|
1066
1074
|
char op[2] = { *p_save, 0 };
|
@@ -1069,24 +1077,24 @@ tr8:
|
|
1069
1077
|
}
|
1070
1078
|
#line 20 "edn_parser.rl"
|
1071
1079
|
{ line_number++; }
|
1072
|
-
#line
|
1080
|
+
#line 58 "edn_parser.rl"
|
1073
1081
|
{ p--; {p++; cs = 5; goto _out;} }
|
1074
1082
|
goto st5;
|
1075
1083
|
tr11:
|
1076
|
-
#line
|
1084
|
+
#line 58 "edn_parser.rl"
|
1077
1085
|
{ p--; {p++; cs = 5; goto _out;} }
|
1078
1086
|
goto st5;
|
1079
1087
|
tr12:
|
1080
1088
|
#line 20 "edn_parser.rl"
|
1081
1089
|
{ line_number++; }
|
1082
|
-
#line
|
1090
|
+
#line 58 "edn_parser.rl"
|
1083
1091
|
{ p--; {p++; cs = 5; goto _out;} }
|
1084
1092
|
goto st5;
|
1085
1093
|
st5:
|
1086
1094
|
if ( ++p == pe )
|
1087
1095
|
goto _test_eof5;
|
1088
1096
|
case 5:
|
1089
|
-
#line
|
1097
|
+
#line 1098 "edn_parser.cc"
|
1090
1098
|
switch( (*p) ) {
|
1091
1099
|
case 10: goto tr12;
|
1092
1100
|
case 32: goto tr11;
|
@@ -1114,25 +1122,25 @@ case 5:
|
|
1114
1122
|
goto st0;
|
1115
1123
|
goto tr10;
|
1116
1124
|
tr9:
|
1117
|
-
#line
|
1125
|
+
#line 412 "edn_parser.rl"
|
1118
1126
|
{
|
1119
1127
|
// stand-alone operators (-, +, /, ... etc)
|
1120
1128
|
char op[2] = { *p_save, 0 };
|
1121
1129
|
VALUE sym = rb_str_new2(op);
|
1122
1130
|
v = Parser::make_edn_symbol(sym);
|
1123
1131
|
}
|
1124
|
-
#line
|
1132
|
+
#line 58 "edn_parser.rl"
|
1125
1133
|
{ p--; {p++; cs = 6; goto _out;} }
|
1126
1134
|
goto st6;
|
1127
1135
|
tr13:
|
1128
|
-
#line
|
1136
|
+
#line 58 "edn_parser.rl"
|
1129
1137
|
{ p--; {p++; cs = 6; goto _out;} }
|
1130
1138
|
goto st6;
|
1131
1139
|
st6:
|
1132
1140
|
if ( ++p == pe )
|
1133
1141
|
goto _test_eof6;
|
1134
1142
|
case 6:
|
1135
|
-
#line
|
1143
|
+
#line 1144 "edn_parser.cc"
|
1136
1144
|
if ( (*p) == 10 )
|
1137
1145
|
goto tr5;
|
1138
1146
|
goto st2;
|
@@ -1177,7 +1185,7 @@ case 7:
|
|
1177
1185
|
goto tr14;
|
1178
1186
|
goto tr6;
|
1179
1187
|
tr14:
|
1180
|
-
#line
|
1188
|
+
#line 389 "edn_parser.rl"
|
1181
1189
|
{
|
1182
1190
|
// parse a number with the leading symbol - this is slightly
|
1183
1191
|
// different than the one within EDN_value since it includes
|
@@ -1202,7 +1210,7 @@ tr14:
|
|
1202
1210
|
}
|
1203
1211
|
goto st8;
|
1204
1212
|
tr15:
|
1205
|
-
#line
|
1213
|
+
#line 379 "edn_parser.rl"
|
1206
1214
|
{
|
1207
1215
|
// parse a symbol including the leading operator (-, +, .)
|
1208
1216
|
VALUE sym = Qnil;
|
@@ -1217,7 +1225,7 @@ st8:
|
|
1217
1225
|
if ( ++p == pe )
|
1218
1226
|
goto _test_eof8;
|
1219
1227
|
case 8:
|
1220
|
-
#line
|
1228
|
+
#line 1229 "edn_parser.cc"
|
1221
1229
|
switch( (*p) ) {
|
1222
1230
|
case 33: goto st0;
|
1223
1231
|
case 95: goto st0;
|
@@ -1287,7 +1295,7 @@ case 9:
|
|
1287
1295
|
case 3:
|
1288
1296
|
case 7:
|
1289
1297
|
case 9:
|
1290
|
-
#line
|
1298
|
+
#line 412 "edn_parser.rl"
|
1291
1299
|
{
|
1292
1300
|
// stand-alone operators (-, +, /, ... etc)
|
1293
1301
|
char op[2] = { *p_save, 0 };
|
@@ -1295,14 +1303,14 @@ case 9:
|
|
1295
1303
|
v = Parser::make_edn_symbol(sym);
|
1296
1304
|
}
|
1297
1305
|
break;
|
1298
|
-
#line
|
1306
|
+
#line 1307 "edn_parser.cc"
|
1299
1307
|
}
|
1300
1308
|
}
|
1301
1309
|
|
1302
1310
|
_out: {}
|
1303
1311
|
}
|
1304
1312
|
|
1305
|
-
#line
|
1313
|
+
#line 435 "edn_parser.rl"
|
1306
1314
|
|
1307
1315
|
if (cs >= EDN_operator_first_final) {
|
1308
1316
|
return p;
|
@@ -1321,7 +1329,7 @@ case 9:
|
|
1321
1329
|
// escaped char parsing - handles \c, \newline, \formfeed, etc.
|
1322
1330
|
//
|
1323
1331
|
|
1324
|
-
#line
|
1332
|
+
#line 1333 "edn_parser.cc"
|
1325
1333
|
static const int EDN_escaped_char_start = 1;
|
1326
1334
|
static const int EDN_escaped_char_first_final = 4;
|
1327
1335
|
static const int EDN_escaped_char_error = 0;
|
@@ -1329,7 +1337,7 @@ static const int EDN_escaped_char_error = 0;
|
|
1329
1337
|
static const int EDN_escaped_char_en_main = 1;
|
1330
1338
|
|
1331
1339
|
|
1332
|
-
#line
|
1340
|
+
#line 464 "edn_parser.rl"
|
1333
1341
|
|
1334
1342
|
|
1335
1343
|
|
@@ -1338,15 +1346,15 @@ const char* edn::Parser::parse_esc_char(const char *p, const char *pe, VALUE& v)
|
|
1338
1346
|
int cs;
|
1339
1347
|
|
1340
1348
|
|
1341
|
-
#line
|
1349
|
+
#line 1350 "edn_parser.cc"
|
1342
1350
|
{
|
1343
1351
|
cs = EDN_escaped_char_start;
|
1344
1352
|
}
|
1345
1353
|
|
1346
|
-
#line
|
1354
|
+
#line 472 "edn_parser.rl"
|
1347
1355
|
const char* p_save = p;
|
1348
1356
|
|
1349
|
-
#line
|
1357
|
+
#line 1358 "edn_parser.cc"
|
1350
1358
|
{
|
1351
1359
|
if ( p == pe )
|
1352
1360
|
goto _test_eof;
|
@@ -1390,34 +1398,34 @@ case 4:
|
|
1390
1398
|
goto st4;
|
1391
1399
|
goto tr5;
|
1392
1400
|
tr5:
|
1393
|
-
#line
|
1401
|
+
#line 58 "edn_parser.rl"
|
1394
1402
|
{ p--; {p++; cs = 5; goto _out;} }
|
1395
1403
|
goto st5;
|
1396
1404
|
st5:
|
1397
1405
|
if ( ++p == pe )
|
1398
1406
|
goto _test_eof5;
|
1399
1407
|
case 5:
|
1400
|
-
#line
|
1408
|
+
#line 1409 "edn_parser.cc"
|
1401
1409
|
goto st0;
|
1402
1410
|
tr4:
|
1403
1411
|
#line 20 "edn_parser.rl"
|
1404
1412
|
{ line_number++; }
|
1405
1413
|
goto st6;
|
1406
1414
|
tr6:
|
1407
|
-
#line
|
1415
|
+
#line 58 "edn_parser.rl"
|
1408
1416
|
{ p--; {p++; cs = 6; goto _out;} }
|
1409
1417
|
goto st6;
|
1410
1418
|
tr7:
|
1411
1419
|
#line 20 "edn_parser.rl"
|
1412
1420
|
{ line_number++; }
|
1413
|
-
#line
|
1421
|
+
#line 58 "edn_parser.rl"
|
1414
1422
|
{ p--; {p++; cs = 6; goto _out;} }
|
1415
1423
|
goto st6;
|
1416
1424
|
st6:
|
1417
1425
|
if ( ++p == pe )
|
1418
1426
|
goto _test_eof6;
|
1419
1427
|
case 6:
|
1420
|
-
#line
|
1428
|
+
#line 1429 "edn_parser.cc"
|
1421
1429
|
switch( (*p) ) {
|
1422
1430
|
case 10: goto tr7;
|
1423
1431
|
case 32: goto tr6;
|
@@ -1435,14 +1443,14 @@ case 6:
|
|
1435
1443
|
goto st0;
|
1436
1444
|
goto tr5;
|
1437
1445
|
tr8:
|
1438
|
-
#line
|
1446
|
+
#line 58 "edn_parser.rl"
|
1439
1447
|
{ p--; {p++; cs = 7; goto _out;} }
|
1440
1448
|
goto st7;
|
1441
1449
|
st7:
|
1442
1450
|
if ( ++p == pe )
|
1443
1451
|
goto _test_eof7;
|
1444
1452
|
case 7:
|
1445
|
-
#line
|
1453
|
+
#line 1454 "edn_parser.cc"
|
1446
1454
|
if ( (*p) == 10 )
|
1447
1455
|
goto tr4;
|
1448
1456
|
goto st3;
|
@@ -1465,7 +1473,7 @@ case 3:
|
|
1465
1473
|
_out: {}
|
1466
1474
|
}
|
1467
1475
|
|
1468
|
-
#line
|
1476
|
+
#line 474 "edn_parser.rl"
|
1469
1477
|
|
1470
1478
|
if (cs >= EDN_escaped_char_first_final) {
|
1471
1479
|
// convert the escaped value to a character
|
@@ -1492,7 +1500,7 @@ case 3:
|
|
1492
1500
|
//
|
1493
1501
|
//
|
1494
1502
|
|
1495
|
-
#line
|
1503
|
+
#line 1504 "edn_parser.cc"
|
1496
1504
|
static const int EDN_symbol_start = 1;
|
1497
1505
|
static const int EDN_symbol_first_final = 5;
|
1498
1506
|
static const int EDN_symbol_error = 0;
|
@@ -1500,7 +1508,7 @@ static const int EDN_symbol_error = 0;
|
|
1500
1508
|
static const int EDN_symbol_en_main = 1;
|
1501
1509
|
|
1502
1510
|
|
1503
|
-
#line
|
1511
|
+
#line 509 "edn_parser.rl"
|
1504
1512
|
|
1505
1513
|
|
1506
1514
|
|
@@ -1509,15 +1517,15 @@ const char* edn::Parser::parse_symbol(const char *p, const char *pe, VALUE& s)
|
|
1509
1517
|
int cs;
|
1510
1518
|
|
1511
1519
|
|
1512
|
-
#line
|
1520
|
+
#line 1521 "edn_parser.cc"
|
1513
1521
|
{
|
1514
1522
|
cs = EDN_symbol_start;
|
1515
1523
|
}
|
1516
1524
|
|
1517
|
-
#line
|
1525
|
+
#line 517 "edn_parser.rl"
|
1518
1526
|
const char* p_save = p;
|
1519
1527
|
|
1520
|
-
#line
|
1528
|
+
#line 1529 "edn_parser.cc"
|
1521
1529
|
{
|
1522
1530
|
if ( p == pe )
|
1523
1531
|
goto _test_eof;
|
@@ -1568,6 +1576,7 @@ case 5:
|
|
1568
1576
|
case 32: goto tr7;
|
1569
1577
|
case 33: goto st0;
|
1570
1578
|
case 35: goto st5;
|
1579
|
+
case 39: goto st5;
|
1571
1580
|
case 44: goto tr7;
|
1572
1581
|
case 47: goto st4;
|
1573
1582
|
case 59: goto tr10;
|
@@ -1595,34 +1604,34 @@ case 5:
|
|
1595
1604
|
goto st5;
|
1596
1605
|
goto tr6;
|
1597
1606
|
tr6:
|
1598
|
-
#line
|
1607
|
+
#line 58 "edn_parser.rl"
|
1599
1608
|
{ p--; {p++; cs = 6; goto _out;} }
|
1600
1609
|
goto st6;
|
1601
1610
|
st6:
|
1602
1611
|
if ( ++p == pe )
|
1603
1612
|
goto _test_eof6;
|
1604
1613
|
case 6:
|
1605
|
-
#line
|
1614
|
+
#line 1615 "edn_parser.cc"
|
1606
1615
|
goto st0;
|
1607
1616
|
tr4:
|
1608
1617
|
#line 20 "edn_parser.rl"
|
1609
1618
|
{ line_number++; }
|
1610
1619
|
goto st7;
|
1611
1620
|
tr7:
|
1612
|
-
#line
|
1621
|
+
#line 58 "edn_parser.rl"
|
1613
1622
|
{ p--; {p++; cs = 7; goto _out;} }
|
1614
1623
|
goto st7;
|
1615
1624
|
tr8:
|
1616
1625
|
#line 20 "edn_parser.rl"
|
1617
1626
|
{ line_number++; }
|
1618
|
-
#line
|
1627
|
+
#line 58 "edn_parser.rl"
|
1619
1628
|
{ p--; {p++; cs = 7; goto _out;} }
|
1620
1629
|
goto st7;
|
1621
1630
|
st7:
|
1622
1631
|
if ( ++p == pe )
|
1623
1632
|
goto _test_eof7;
|
1624
1633
|
case 7:
|
1625
|
-
#line
|
1634
|
+
#line 1635 "edn_parser.cc"
|
1626
1635
|
switch( (*p) ) {
|
1627
1636
|
case 10: goto tr8;
|
1628
1637
|
case 32: goto tr7;
|
@@ -1633,7 +1642,7 @@ case 7:
|
|
1633
1642
|
}
|
1634
1643
|
if ( (*p) < 42 ) {
|
1635
1644
|
if ( (*p) > 13 ) {
|
1636
|
-
if ( 35 <= (*p) && (*p) <=
|
1645
|
+
if ( 35 <= (*p) && (*p) <= 39 )
|
1637
1646
|
goto st0;
|
1638
1647
|
} else if ( (*p) >= 9 )
|
1639
1648
|
goto tr7;
|
@@ -1647,14 +1656,14 @@ case 7:
|
|
1647
1656
|
goto st0;
|
1648
1657
|
goto tr6;
|
1649
1658
|
tr10:
|
1650
|
-
#line
|
1659
|
+
#line 58 "edn_parser.rl"
|
1651
1660
|
{ p--; {p++; cs = 8; goto _out;} }
|
1652
1661
|
goto st8;
|
1653
1662
|
st8:
|
1654
1663
|
if ( ++p == pe )
|
1655
1664
|
goto _test_eof8;
|
1656
1665
|
case 8:
|
1657
|
-
#line
|
1666
|
+
#line 1667 "edn_parser.cc"
|
1658
1667
|
if ( (*p) == 10 )
|
1659
1668
|
goto tr4;
|
1660
1669
|
goto st3;
|
@@ -1684,6 +1693,7 @@ case 9:
|
|
1684
1693
|
case 32: goto tr7;
|
1685
1694
|
case 33: goto st0;
|
1686
1695
|
case 35: goto st9;
|
1696
|
+
case 39: goto st9;
|
1687
1697
|
case 44: goto tr7;
|
1688
1698
|
case 47: goto st0;
|
1689
1699
|
case 59: goto tr10;
|
@@ -1724,7 +1734,7 @@ case 9:
|
|
1724
1734
|
_out: {}
|
1725
1735
|
}
|
1726
1736
|
|
1727
|
-
#line
|
1737
|
+
#line 519 "edn_parser.rl"
|
1728
1738
|
|
1729
1739
|
if (cs >= EDN_symbol_first_final) {
|
1730
1740
|
// copy the symbol text
|
@@ -1750,13 +1760,13 @@ case 9:
|
|
1750
1760
|
// sets the same array is used)
|
1751
1761
|
//
|
1752
1762
|
|
1753
|
-
#line
|
1763
|
+
#line 575 "edn_parser.rl"
|
1754
1764
|
|
1755
1765
|
|
1756
1766
|
//
|
1757
1767
|
// vector-specific machine
|
1758
1768
|
|
1759
|
-
#line
|
1769
|
+
#line 1770 "edn_parser.cc"
|
1760
1770
|
static const int EDN_vector_start = 1;
|
1761
1771
|
static const int EDN_vector_first_final = 4;
|
1762
1772
|
static const int EDN_vector_error = 0;
|
@@ -1764,7 +1774,7 @@ static const int EDN_vector_error = 0;
|
|
1764
1774
|
static const int EDN_vector_en_main = 1;
|
1765
1775
|
|
1766
1776
|
|
1767
|
-
#line
|
1777
|
+
#line 591 "edn_parser.rl"
|
1768
1778
|
|
1769
1779
|
|
1770
1780
|
|
@@ -1779,14 +1789,14 @@ const char* edn::Parser::parse_vector(const char *p, const char *pe, VALUE& v)
|
|
1779
1789
|
VALUE elems = rb_ary_new(); // will store the vector's elements
|
1780
1790
|
|
1781
1791
|
|
1782
|
-
#line
|
1792
|
+
#line 1793 "edn_parser.cc"
|
1783
1793
|
{
|
1784
1794
|
cs = EDN_vector_start;
|
1785
1795
|
}
|
1786
1796
|
|
1787
|
-
#line
|
1797
|
+
#line 605 "edn_parser.rl"
|
1788
1798
|
|
1789
|
-
#line
|
1799
|
+
#line 1800 "edn_parser.cc"
|
1790
1800
|
{
|
1791
1801
|
if ( p == pe )
|
1792
1802
|
goto _test_eof;
|
@@ -1797,7 +1807,7 @@ case 1:
|
|
1797
1807
|
goto st2;
|
1798
1808
|
goto st0;
|
1799
1809
|
tr2:
|
1800
|
-
#line
|
1810
|
+
#line 51 "edn_parser.rl"
|
1801
1811
|
{
|
1802
1812
|
std::stringstream s;
|
1803
1813
|
s << "unterminated " << EDN_TYPE;
|
@@ -1805,7 +1815,7 @@ tr2:
|
|
1805
1815
|
p--; {p++; cs = 0; goto _out;}
|
1806
1816
|
}
|
1807
1817
|
goto st0;
|
1808
|
-
#line
|
1818
|
+
#line 1819 "edn_parser.cc"
|
1809
1819
|
st0:
|
1810
1820
|
cs = 0;
|
1811
1821
|
goto _out;
|
@@ -1814,7 +1824,7 @@ tr3:
|
|
1814
1824
|
{ line_number++; }
|
1815
1825
|
goto st2;
|
1816
1826
|
tr4:
|
1817
|
-
#line
|
1827
|
+
#line 547 "edn_parser.rl"
|
1818
1828
|
{
|
1819
1829
|
// reads an item within a sequence (vector, list, map, or
|
1820
1830
|
// set). Regardless of the sequence type, an array of the
|
@@ -1829,7 +1839,7 @@ tr4:
|
|
1829
1839
|
// object is not meant to be kept due to a #_ so don't
|
1830
1840
|
// push it into the list of elements
|
1831
1841
|
if (!discard.empty()) {
|
1832
|
-
discard.
|
1842
|
+
discard.pop_back();
|
1833
1843
|
}
|
1834
1844
|
else {
|
1835
1845
|
// otherwise we add it to the list of elements for the
|
@@ -1844,7 +1854,7 @@ st2:
|
|
1844
1854
|
if ( ++p == pe )
|
1845
1855
|
goto _test_eof2;
|
1846
1856
|
case 2:
|
1847
|
-
#line
|
1857
|
+
#line 1858 "edn_parser.cc"
|
1848
1858
|
switch( (*p) ) {
|
1849
1859
|
case 10: goto tr3;
|
1850
1860
|
case 32: goto st2;
|
@@ -1852,7 +1862,6 @@ case 2:
|
|
1852
1862
|
case 44: goto st2;
|
1853
1863
|
case 59: goto st3;
|
1854
1864
|
case 93: goto tr6;
|
1855
|
-
case 95: goto tr4;
|
1856
1865
|
}
|
1857
1866
|
if ( (*p) < 42 ) {
|
1858
1867
|
if ( (*p) > 13 ) {
|
@@ -1861,7 +1870,7 @@ case 2:
|
|
1861
1870
|
} else if ( (*p) >= 9 )
|
1862
1871
|
goto st2;
|
1863
1872
|
} else if ( (*p) > 63 ) {
|
1864
|
-
if ( (*p) >
|
1873
|
+
if ( (*p) > 95 ) {
|
1865
1874
|
if ( 97 <= (*p) && (*p) <= 123 )
|
1866
1875
|
goto tr4;
|
1867
1876
|
} else if ( (*p) >= 65 )
|
@@ -1877,14 +1886,14 @@ case 3:
|
|
1877
1886
|
goto tr3;
|
1878
1887
|
goto st3;
|
1879
1888
|
tr6:
|
1880
|
-
#line
|
1889
|
+
#line 58 "edn_parser.rl"
|
1881
1890
|
{ p--; {p++; cs = 4; goto _out;} }
|
1882
1891
|
goto st4;
|
1883
1892
|
st4:
|
1884
1893
|
if ( ++p == pe )
|
1885
1894
|
goto _test_eof4;
|
1886
1895
|
case 4:
|
1887
|
-
#line
|
1896
|
+
#line 1897 "edn_parser.cc"
|
1888
1897
|
goto st0;
|
1889
1898
|
}
|
1890
1899
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -1897,7 +1906,7 @@ case 4:
|
|
1897
1906
|
switch ( cs ) {
|
1898
1907
|
case 2:
|
1899
1908
|
case 3:
|
1900
|
-
#line
|
1909
|
+
#line 51 "edn_parser.rl"
|
1901
1910
|
{
|
1902
1911
|
std::stringstream s;
|
1903
1912
|
s << "unterminated " << EDN_TYPE;
|
@@ -1905,14 +1914,14 @@ case 4:
|
|
1905
1914
|
p--; {p++; cs = 0; goto _out;}
|
1906
1915
|
}
|
1907
1916
|
break;
|
1908
|
-
#line
|
1917
|
+
#line 1918 "edn_parser.cc"
|
1909
1918
|
}
|
1910
1919
|
}
|
1911
1920
|
|
1912
1921
|
_out: {}
|
1913
1922
|
}
|
1914
1923
|
|
1915
|
-
#line
|
1924
|
+
#line 606 "edn_parser.rl"
|
1916
1925
|
|
1917
1926
|
if (cs >= EDN_vector_first_final) {
|
1918
1927
|
v = elems;
|
@@ -1932,7 +1941,7 @@ case 4:
|
|
1932
1941
|
// list parsing machine
|
1933
1942
|
//
|
1934
1943
|
|
1935
|
-
#line
|
1944
|
+
#line 1945 "edn_parser.cc"
|
1936
1945
|
static const int EDN_list_start = 1;
|
1937
1946
|
static const int EDN_list_first_final = 4;
|
1938
1947
|
static const int EDN_list_error = 0;
|
@@ -1940,7 +1949,7 @@ static const int EDN_list_error = 0;
|
|
1940
1949
|
static const int EDN_list_en_main = 1;
|
1941
1950
|
|
1942
1951
|
|
1943
|
-
#line
|
1952
|
+
#line 635 "edn_parser.rl"
|
1944
1953
|
|
1945
1954
|
|
1946
1955
|
//
|
@@ -1954,14 +1963,14 @@ const char* edn::Parser::parse_list(const char *p, const char *pe, VALUE& v)
|
|
1954
1963
|
VALUE elems = rb_ary_new();
|
1955
1964
|
|
1956
1965
|
|
1957
|
-
#line
|
1966
|
+
#line 1967 "edn_parser.cc"
|
1958
1967
|
{
|
1959
1968
|
cs = EDN_list_start;
|
1960
1969
|
}
|
1961
1970
|
|
1962
|
-
#line
|
1971
|
+
#line 648 "edn_parser.rl"
|
1963
1972
|
|
1964
|
-
#line
|
1973
|
+
#line 1974 "edn_parser.cc"
|
1965
1974
|
{
|
1966
1975
|
if ( p == pe )
|
1967
1976
|
goto _test_eof;
|
@@ -1972,7 +1981,7 @@ case 1:
|
|
1972
1981
|
goto st2;
|
1973
1982
|
goto st0;
|
1974
1983
|
tr2:
|
1975
|
-
#line
|
1984
|
+
#line 51 "edn_parser.rl"
|
1976
1985
|
{
|
1977
1986
|
std::stringstream s;
|
1978
1987
|
s << "unterminated " << EDN_TYPE;
|
@@ -1980,7 +1989,7 @@ tr2:
|
|
1980
1989
|
p--; {p++; cs = 0; goto _out;}
|
1981
1990
|
}
|
1982
1991
|
goto st0;
|
1983
|
-
#line
|
1992
|
+
#line 1993 "edn_parser.cc"
|
1984
1993
|
st0:
|
1985
1994
|
cs = 0;
|
1986
1995
|
goto _out;
|
@@ -1989,7 +1998,7 @@ tr3:
|
|
1989
1998
|
{ line_number++; }
|
1990
1999
|
goto st2;
|
1991
2000
|
tr4:
|
1992
|
-
#line
|
2001
|
+
#line 547 "edn_parser.rl"
|
1993
2002
|
{
|
1994
2003
|
// reads an item within a sequence (vector, list, map, or
|
1995
2004
|
// set). Regardless of the sequence type, an array of the
|
@@ -2004,7 +2013,7 @@ tr4:
|
|
2004
2013
|
// object is not meant to be kept due to a #_ so don't
|
2005
2014
|
// push it into the list of elements
|
2006
2015
|
if (!discard.empty()) {
|
2007
|
-
discard.
|
2016
|
+
discard.pop_back();
|
2008
2017
|
}
|
2009
2018
|
else {
|
2010
2019
|
// otherwise we add it to the list of elements for the
|
@@ -2019,14 +2028,13 @@ st2:
|
|
2019
2028
|
if ( ++p == pe )
|
2020
2029
|
goto _test_eof2;
|
2021
2030
|
case 2:
|
2022
|
-
#line
|
2031
|
+
#line 2032 "edn_parser.cc"
|
2023
2032
|
switch( (*p) ) {
|
2024
2033
|
case 10: goto tr3;
|
2025
2034
|
case 32: goto st2;
|
2026
2035
|
case 41: goto tr5;
|
2027
2036
|
case 44: goto st2;
|
2028
2037
|
case 59: goto st3;
|
2029
|
-
case 95: goto tr4;
|
2030
2038
|
}
|
2031
2039
|
if ( (*p) < 40 ) {
|
2032
2040
|
if ( (*p) > 13 ) {
|
@@ -2035,23 +2043,26 @@ case 2:
|
|
2035
2043
|
} else if ( (*p) >= 9 )
|
2036
2044
|
goto st2;
|
2037
2045
|
} else if ( (*p) > 63 ) {
|
2038
|
-
if ( (*p)
|
2046
|
+
if ( (*p) < 94 ) {
|
2047
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
2048
|
+
goto tr4;
|
2049
|
+
} else if ( (*p) > 95 ) {
|
2039
2050
|
if ( 97 <= (*p) && (*p) <= 123 )
|
2040
2051
|
goto tr4;
|
2041
|
-
} else
|
2052
|
+
} else
|
2042
2053
|
goto tr4;
|
2043
2054
|
} else
|
2044
2055
|
goto tr4;
|
2045
2056
|
goto tr2;
|
2046
2057
|
tr5:
|
2047
|
-
#line
|
2058
|
+
#line 58 "edn_parser.rl"
|
2048
2059
|
{ p--; {p++; cs = 4; goto _out;} }
|
2049
2060
|
goto st4;
|
2050
2061
|
st4:
|
2051
2062
|
if ( ++p == pe )
|
2052
2063
|
goto _test_eof4;
|
2053
2064
|
case 4:
|
2054
|
-
#line
|
2065
|
+
#line 2066 "edn_parser.cc"
|
2055
2066
|
goto st0;
|
2056
2067
|
st3:
|
2057
2068
|
if ( ++p == pe )
|
@@ -2071,7 +2082,7 @@ case 3:
|
|
2071
2082
|
switch ( cs ) {
|
2072
2083
|
case 2:
|
2073
2084
|
case 3:
|
2074
|
-
#line
|
2085
|
+
#line 51 "edn_parser.rl"
|
2075
2086
|
{
|
2076
2087
|
std::stringstream s;
|
2077
2088
|
s << "unterminated " << EDN_TYPE;
|
@@ -2079,14 +2090,14 @@ case 3:
|
|
2079
2090
|
p--; {p++; cs = 0; goto _out;}
|
2080
2091
|
}
|
2081
2092
|
break;
|
2082
|
-
#line
|
2093
|
+
#line 2094 "edn_parser.cc"
|
2083
2094
|
}
|
2084
2095
|
}
|
2085
2096
|
|
2086
2097
|
_out: {}
|
2087
2098
|
}
|
2088
2099
|
|
2089
|
-
#line
|
2100
|
+
#line 649 "edn_parser.rl"
|
2090
2101
|
|
2091
2102
|
if (cs >= EDN_list_first_final) {
|
2092
2103
|
v = elems;
|
@@ -2106,7 +2117,7 @@ case 3:
|
|
2106
2117
|
// hash parsing
|
2107
2118
|
//
|
2108
2119
|
|
2109
|
-
#line
|
2120
|
+
#line 2121 "edn_parser.cc"
|
2110
2121
|
static const int EDN_map_start = 1;
|
2111
2122
|
static const int EDN_map_first_final = 4;
|
2112
2123
|
static const int EDN_map_error = 0;
|
@@ -2114,7 +2125,7 @@ static const int EDN_map_error = 0;
|
|
2114
2125
|
static const int EDN_map_en_main = 1;
|
2115
2126
|
|
2116
2127
|
|
2117
|
-
#line
|
2128
|
+
#line 679 "edn_parser.rl"
|
2118
2129
|
|
2119
2130
|
|
2120
2131
|
|
@@ -2128,14 +2139,14 @@ const char* edn::Parser::parse_map(const char *p, const char *pe, VALUE& v)
|
|
2128
2139
|
VALUE elems = rb_ary_new();
|
2129
2140
|
|
2130
2141
|
|
2131
|
-
#line
|
2142
|
+
#line 2143 "edn_parser.cc"
|
2132
2143
|
{
|
2133
2144
|
cs = EDN_map_start;
|
2134
2145
|
}
|
2135
2146
|
|
2136
|
-
#line
|
2147
|
+
#line 692 "edn_parser.rl"
|
2137
2148
|
|
2138
|
-
#line
|
2149
|
+
#line 2150 "edn_parser.cc"
|
2139
2150
|
{
|
2140
2151
|
if ( p == pe )
|
2141
2152
|
goto _test_eof;
|
@@ -2146,7 +2157,7 @@ case 1:
|
|
2146
2157
|
goto st2;
|
2147
2158
|
goto st0;
|
2148
2159
|
tr2:
|
2149
|
-
#line
|
2160
|
+
#line 51 "edn_parser.rl"
|
2150
2161
|
{
|
2151
2162
|
std::stringstream s;
|
2152
2163
|
s << "unterminated " << EDN_TYPE;
|
@@ -2154,7 +2165,7 @@ tr2:
|
|
2154
2165
|
p--; {p++; cs = 0; goto _out;}
|
2155
2166
|
}
|
2156
2167
|
goto st0;
|
2157
|
-
#line
|
2168
|
+
#line 2169 "edn_parser.cc"
|
2158
2169
|
st0:
|
2159
2170
|
cs = 0;
|
2160
2171
|
goto _out;
|
@@ -2163,7 +2174,7 @@ tr3:
|
|
2163
2174
|
{ line_number++; }
|
2164
2175
|
goto st2;
|
2165
2176
|
tr4:
|
2166
|
-
#line
|
2177
|
+
#line 547 "edn_parser.rl"
|
2167
2178
|
{
|
2168
2179
|
// reads an item within a sequence (vector, list, map, or
|
2169
2180
|
// set). Regardless of the sequence type, an array of the
|
@@ -2178,7 +2189,7 @@ tr4:
|
|
2178
2189
|
// object is not meant to be kept due to a #_ so don't
|
2179
2190
|
// push it into the list of elements
|
2180
2191
|
if (!discard.empty()) {
|
2181
|
-
discard.
|
2192
|
+
discard.pop_back();
|
2182
2193
|
}
|
2183
2194
|
else {
|
2184
2195
|
// otherwise we add it to the list of elements for the
|
@@ -2193,14 +2204,13 @@ st2:
|
|
2193
2204
|
if ( ++p == pe )
|
2194
2205
|
goto _test_eof2;
|
2195
2206
|
case 2:
|
2196
|
-
#line
|
2207
|
+
#line 2208 "edn_parser.cc"
|
2197
2208
|
switch( (*p) ) {
|
2198
2209
|
case 10: goto tr3;
|
2199
2210
|
case 32: goto st2;
|
2200
2211
|
case 40: goto tr4;
|
2201
2212
|
case 44: goto st2;
|
2202
2213
|
case 59: goto st3;
|
2203
|
-
case 95: goto tr4;
|
2204
2214
|
case 125: goto tr6;
|
2205
2215
|
}
|
2206
2216
|
if ( (*p) < 42 ) {
|
@@ -2210,10 +2220,13 @@ case 2:
|
|
2210
2220
|
} else if ( (*p) >= 9 )
|
2211
2221
|
goto st2;
|
2212
2222
|
} else if ( (*p) > 63 ) {
|
2213
|
-
if ( (*p)
|
2223
|
+
if ( (*p) < 94 ) {
|
2224
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
2225
|
+
goto tr4;
|
2226
|
+
} else if ( (*p) > 95 ) {
|
2214
2227
|
if ( 97 <= (*p) && (*p) <= 123 )
|
2215
2228
|
goto tr4;
|
2216
|
-
} else
|
2229
|
+
} else
|
2217
2230
|
goto tr4;
|
2218
2231
|
} else
|
2219
2232
|
goto tr4;
|
@@ -2226,14 +2239,14 @@ case 3:
|
|
2226
2239
|
goto tr3;
|
2227
2240
|
goto st3;
|
2228
2241
|
tr6:
|
2229
|
-
#line
|
2242
|
+
#line 58 "edn_parser.rl"
|
2230
2243
|
{ p--; {p++; cs = 4; goto _out;} }
|
2231
2244
|
goto st4;
|
2232
2245
|
st4:
|
2233
2246
|
if ( ++p == pe )
|
2234
2247
|
goto _test_eof4;
|
2235
2248
|
case 4:
|
2236
|
-
#line
|
2249
|
+
#line 2250 "edn_parser.cc"
|
2237
2250
|
goto st0;
|
2238
2251
|
}
|
2239
2252
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2246,7 +2259,7 @@ case 4:
|
|
2246
2259
|
switch ( cs ) {
|
2247
2260
|
case 2:
|
2248
2261
|
case 3:
|
2249
|
-
#line
|
2262
|
+
#line 51 "edn_parser.rl"
|
2250
2263
|
{
|
2251
2264
|
std::stringstream s;
|
2252
2265
|
s << "unterminated " << EDN_TYPE;
|
@@ -2254,14 +2267,14 @@ case 4:
|
|
2254
2267
|
p--; {p++; cs = 0; goto _out;}
|
2255
2268
|
}
|
2256
2269
|
break;
|
2257
|
-
#line
|
2270
|
+
#line 2271 "edn_parser.cc"
|
2258
2271
|
}
|
2259
2272
|
}
|
2260
2273
|
|
2261
2274
|
_out: {}
|
2262
2275
|
}
|
2263
2276
|
|
2264
|
-
#line
|
2277
|
+
#line 693 "edn_parser.rl"
|
2265
2278
|
|
2266
2279
|
if (cs >= EDN_map_first_final) {
|
2267
2280
|
|
@@ -2297,7 +2310,7 @@ case 4:
|
|
2297
2310
|
// the remaining data to the correct parser
|
2298
2311
|
//
|
2299
2312
|
|
2300
|
-
#line
|
2313
|
+
#line 2314 "edn_parser.cc"
|
2301
2314
|
static const int EDN_dispatch_start = 1;
|
2302
2315
|
static const int EDN_dispatch_first_final = 2;
|
2303
2316
|
static const int EDN_dispatch_error = 0;
|
@@ -2305,7 +2318,7 @@ static const int EDN_dispatch_error = 0;
|
|
2305
2318
|
static const int EDN_dispatch_en_main = 1;
|
2306
2319
|
|
2307
2320
|
|
2308
|
-
#line
|
2321
|
+
#line 757 "edn_parser.rl"
|
2309
2322
|
|
2310
2323
|
|
2311
2324
|
|
@@ -2314,14 +2327,14 @@ const char* edn::Parser::parse_dispatch(const char *p, const char *pe, VALUE& v)
|
|
2314
2327
|
int cs;
|
2315
2328
|
|
2316
2329
|
|
2317
|
-
#line
|
2330
|
+
#line 2331 "edn_parser.cc"
|
2318
2331
|
{
|
2319
2332
|
cs = EDN_dispatch_start;
|
2320
2333
|
}
|
2321
2334
|
|
2322
|
-
#line
|
2335
|
+
#line 765 "edn_parser.rl"
|
2323
2336
|
|
2324
|
-
#line
|
2337
|
+
#line 2338 "edn_parser.cc"
|
2325
2338
|
{
|
2326
2339
|
if ( p == pe )
|
2327
2340
|
goto _test_eof;
|
@@ -2342,40 +2355,40 @@ st0:
|
|
2342
2355
|
cs = 0;
|
2343
2356
|
goto _out;
|
2344
2357
|
tr0:
|
2345
|
-
#line
|
2358
|
+
#line 745 "edn_parser.rl"
|
2346
2359
|
{
|
2347
2360
|
// #inst, #uuid, or #user/tag
|
2348
2361
|
const char *np = parse_tagged(p, pe, v);
|
2349
2362
|
if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
2350
2363
|
}
|
2351
|
-
#line
|
2364
|
+
#line 58 "edn_parser.rl"
|
2352
2365
|
{ p--; {p++; cs = 2; goto _out;} }
|
2353
2366
|
goto st2;
|
2354
2367
|
tr2:
|
2355
|
-
#line
|
2368
|
+
#line 739 "edn_parser.rl"
|
2356
2369
|
{
|
2357
2370
|
// discard token #_
|
2358
2371
|
const char *np = parse_discard(p, pe);
|
2359
2372
|
if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
2360
2373
|
}
|
2361
|
-
#line
|
2374
|
+
#line 58 "edn_parser.rl"
|
2362
2375
|
{ p--; {p++; cs = 2; goto _out;} }
|
2363
2376
|
goto st2;
|
2364
2377
|
tr3:
|
2365
|
-
#line
|
2378
|
+
#line 733 "edn_parser.rl"
|
2366
2379
|
{
|
2367
2380
|
// #{ }
|
2368
2381
|
const char *np = parse_set(p, pe, v);
|
2369
2382
|
if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
2370
2383
|
}
|
2371
|
-
#line
|
2384
|
+
#line 58 "edn_parser.rl"
|
2372
2385
|
{ p--; {p++; cs = 2; goto _out;} }
|
2373
2386
|
goto st2;
|
2374
2387
|
st2:
|
2375
2388
|
if ( ++p == pe )
|
2376
2389
|
goto _test_eof2;
|
2377
2390
|
case 2:
|
2378
|
-
#line
|
2391
|
+
#line 2392 "edn_parser.cc"
|
2379
2392
|
goto st0;
|
2380
2393
|
}
|
2381
2394
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2384,7 +2397,7 @@ case 2:
|
|
2384
2397
|
_out: {}
|
2385
2398
|
}
|
2386
2399
|
|
2387
|
-
#line
|
2400
|
+
#line 766 "edn_parser.rl"
|
2388
2401
|
|
2389
2402
|
if (cs >= EDN_dispatch_first_final) {
|
2390
2403
|
return p + 1;
|
@@ -2403,7 +2416,7 @@ case 2:
|
|
2403
2416
|
// set parsing machine
|
2404
2417
|
//
|
2405
2418
|
|
2406
|
-
#line
|
2419
|
+
#line 2420 "edn_parser.cc"
|
2407
2420
|
static const int EDN_set_start = 1;
|
2408
2421
|
static const int EDN_set_first_final = 4;
|
2409
2422
|
static const int EDN_set_error = 0;
|
@@ -2411,7 +2424,7 @@ static const int EDN_set_error = 0;
|
|
2411
2424
|
static const int EDN_set_en_main = 1;
|
2412
2425
|
|
2413
2426
|
|
2414
|
-
#line
|
2427
|
+
#line 795 "edn_parser.rl"
|
2415
2428
|
|
2416
2429
|
|
2417
2430
|
//
|
@@ -2425,14 +2438,14 @@ const char* edn::Parser::parse_set(const char *p, const char *pe, VALUE& v)
|
|
2425
2438
|
VALUE elems = rb_ary_new(); // stored as an array
|
2426
2439
|
|
2427
2440
|
|
2428
|
-
#line
|
2441
|
+
#line 2442 "edn_parser.cc"
|
2429
2442
|
{
|
2430
2443
|
cs = EDN_set_start;
|
2431
2444
|
}
|
2432
2445
|
|
2433
|
-
#line
|
2446
|
+
#line 808 "edn_parser.rl"
|
2434
2447
|
|
2435
|
-
#line
|
2448
|
+
#line 2449 "edn_parser.cc"
|
2436
2449
|
{
|
2437
2450
|
if ( p == pe )
|
2438
2451
|
goto _test_eof;
|
@@ -2443,7 +2456,7 @@ case 1:
|
|
2443
2456
|
goto st2;
|
2444
2457
|
goto st0;
|
2445
2458
|
tr2:
|
2446
|
-
#line
|
2459
|
+
#line 51 "edn_parser.rl"
|
2447
2460
|
{
|
2448
2461
|
std::stringstream s;
|
2449
2462
|
s << "unterminated " << EDN_TYPE;
|
@@ -2451,7 +2464,7 @@ tr2:
|
|
2451
2464
|
p--; {p++; cs = 0; goto _out;}
|
2452
2465
|
}
|
2453
2466
|
goto st0;
|
2454
|
-
#line
|
2467
|
+
#line 2468 "edn_parser.cc"
|
2455
2468
|
st0:
|
2456
2469
|
cs = 0;
|
2457
2470
|
goto _out;
|
@@ -2460,7 +2473,7 @@ tr3:
|
|
2460
2473
|
{ line_number++; }
|
2461
2474
|
goto st2;
|
2462
2475
|
tr4:
|
2463
|
-
#line
|
2476
|
+
#line 547 "edn_parser.rl"
|
2464
2477
|
{
|
2465
2478
|
// reads an item within a sequence (vector, list, map, or
|
2466
2479
|
// set). Regardless of the sequence type, an array of the
|
@@ -2475,7 +2488,7 @@ tr4:
|
|
2475
2488
|
// object is not meant to be kept due to a #_ so don't
|
2476
2489
|
// push it into the list of elements
|
2477
2490
|
if (!discard.empty()) {
|
2478
|
-
discard.
|
2491
|
+
discard.pop_back();
|
2479
2492
|
}
|
2480
2493
|
else {
|
2481
2494
|
// otherwise we add it to the list of elements for the
|
@@ -2490,14 +2503,13 @@ st2:
|
|
2490
2503
|
if ( ++p == pe )
|
2491
2504
|
goto _test_eof2;
|
2492
2505
|
case 2:
|
2493
|
-
#line
|
2506
|
+
#line 2507 "edn_parser.cc"
|
2494
2507
|
switch( (*p) ) {
|
2495
2508
|
case 10: goto tr3;
|
2496
2509
|
case 32: goto st2;
|
2497
2510
|
case 40: goto tr4;
|
2498
2511
|
case 44: goto st2;
|
2499
2512
|
case 59: goto st3;
|
2500
|
-
case 95: goto tr4;
|
2501
2513
|
case 125: goto tr6;
|
2502
2514
|
}
|
2503
2515
|
if ( (*p) < 42 ) {
|
@@ -2507,10 +2519,13 @@ case 2:
|
|
2507
2519
|
} else if ( (*p) >= 9 )
|
2508
2520
|
goto st2;
|
2509
2521
|
} else if ( (*p) > 63 ) {
|
2510
|
-
if ( (*p)
|
2522
|
+
if ( (*p) < 94 ) {
|
2523
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
2524
|
+
goto tr4;
|
2525
|
+
} else if ( (*p) > 95 ) {
|
2511
2526
|
if ( 97 <= (*p) && (*p) <= 123 )
|
2512
2527
|
goto tr4;
|
2513
|
-
} else
|
2528
|
+
} else
|
2514
2529
|
goto tr4;
|
2515
2530
|
} else
|
2516
2531
|
goto tr4;
|
@@ -2523,14 +2538,14 @@ case 3:
|
|
2523
2538
|
goto tr3;
|
2524
2539
|
goto st3;
|
2525
2540
|
tr6:
|
2526
|
-
#line
|
2541
|
+
#line 58 "edn_parser.rl"
|
2527
2542
|
{ p--; {p++; cs = 4; goto _out;} }
|
2528
2543
|
goto st4;
|
2529
2544
|
st4:
|
2530
2545
|
if ( ++p == pe )
|
2531
2546
|
goto _test_eof4;
|
2532
2547
|
case 4:
|
2533
|
-
#line
|
2548
|
+
#line 2549 "edn_parser.cc"
|
2534
2549
|
goto st0;
|
2535
2550
|
}
|
2536
2551
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2543,7 +2558,7 @@ case 4:
|
|
2543
2558
|
switch ( cs ) {
|
2544
2559
|
case 2:
|
2545
2560
|
case 3:
|
2546
|
-
#line
|
2561
|
+
#line 51 "edn_parser.rl"
|
2547
2562
|
{
|
2548
2563
|
std::stringstream s;
|
2549
2564
|
s << "unterminated " << EDN_TYPE;
|
@@ -2551,14 +2566,14 @@ case 4:
|
|
2551
2566
|
p--; {p++; cs = 0; goto _out;}
|
2552
2567
|
}
|
2553
2568
|
break;
|
2554
|
-
#line
|
2569
|
+
#line 2570 "edn_parser.cc"
|
2555
2570
|
}
|
2556
2571
|
}
|
2557
2572
|
|
2558
2573
|
_out: {}
|
2559
2574
|
}
|
2560
2575
|
|
2561
|
-
#line
|
2576
|
+
#line 809 "edn_parser.rl"
|
2562
2577
|
|
2563
2578
|
if (cs >= EDN_set_first_final) {
|
2564
2579
|
// all elements collected; now convert to a set
|
@@ -2581,7 +2596,7 @@ case 4:
|
|
2581
2596
|
// defining a machine to consume items within container delimiters
|
2582
2597
|
//
|
2583
2598
|
|
2584
|
-
#line
|
2599
|
+
#line 2600 "edn_parser.cc"
|
2585
2600
|
static const int EDN_discard_start = 1;
|
2586
2601
|
static const int EDN_discard_first_final = 4;
|
2587
2602
|
static const int EDN_discard_error = 0;
|
@@ -2589,7 +2604,7 @@ static const int EDN_discard_error = 0;
|
|
2589
2604
|
static const int EDN_discard_en_main = 1;
|
2590
2605
|
|
2591
2606
|
|
2592
|
-
#line
|
2607
|
+
#line 861 "edn_parser.rl"
|
2593
2608
|
|
2594
2609
|
|
2595
2610
|
|
@@ -2599,14 +2614,14 @@ const char* edn::Parser::parse_discard(const char *p, const char *pe)
|
|
2599
2614
|
VALUE v;
|
2600
2615
|
|
2601
2616
|
|
2602
|
-
#line
|
2617
|
+
#line 2618 "edn_parser.cc"
|
2603
2618
|
{
|
2604
2619
|
cs = EDN_discard_start;
|
2605
2620
|
}
|
2606
2621
|
|
2607
|
-
#line
|
2622
|
+
#line 870 "edn_parser.rl"
|
2608
2623
|
|
2609
|
-
#line
|
2624
|
+
#line 2625 "edn_parser.cc"
|
2610
2625
|
{
|
2611
2626
|
if ( p == pe )
|
2612
2627
|
goto _test_eof;
|
@@ -2616,10 +2631,20 @@ case 1:
|
|
2616
2631
|
if ( (*p) == 95 )
|
2617
2632
|
goto st2;
|
2618
2633
|
goto st0;
|
2634
|
+
tr2:
|
2635
|
+
#line 851 "edn_parser.rl"
|
2636
|
+
{
|
2637
|
+
std::stringstream s;
|
2638
|
+
s << "discard sequence without element to discard";
|
2639
|
+
error(__FUNCTION__, s.str());
|
2640
|
+
p--; {p++; cs = 0; goto _out;}
|
2641
|
+
}
|
2642
|
+
goto st0;
|
2643
|
+
#line 2644 "edn_parser.cc"
|
2619
2644
|
st0:
|
2620
2645
|
cs = 0;
|
2621
2646
|
goto _out;
|
2622
|
-
|
2647
|
+
tr3:
|
2623
2648
|
#line 20 "edn_parser.rl"
|
2624
2649
|
{ line_number++; }
|
2625
2650
|
goto st2;
|
@@ -2627,59 +2652,61 @@ st2:
|
|
2627
2652
|
if ( ++p == pe )
|
2628
2653
|
goto _test_eof2;
|
2629
2654
|
case 2:
|
2630
|
-
#line
|
2655
|
+
#line 2656 "edn_parser.cc"
|
2631
2656
|
switch( (*p) ) {
|
2632
|
-
case 10: goto
|
2657
|
+
case 10: goto tr3;
|
2633
2658
|
case 32: goto st2;
|
2634
|
-
case 40: goto
|
2659
|
+
case 40: goto tr4;
|
2635
2660
|
case 44: goto st2;
|
2636
2661
|
case 59: goto st3;
|
2637
|
-
case 95: goto tr3;
|
2638
2662
|
}
|
2639
2663
|
if ( (*p) < 42 ) {
|
2640
2664
|
if ( (*p) > 13 ) {
|
2641
2665
|
if ( 33 <= (*p) && (*p) <= 38 )
|
2642
|
-
goto
|
2666
|
+
goto tr4;
|
2643
2667
|
} else if ( (*p) >= 9 )
|
2644
2668
|
goto st2;
|
2645
2669
|
} else if ( (*p) > 63 ) {
|
2646
|
-
if ( (*p)
|
2670
|
+
if ( (*p) < 94 ) {
|
2671
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
2672
|
+
goto tr4;
|
2673
|
+
} else if ( (*p) > 95 ) {
|
2647
2674
|
if ( 97 <= (*p) && (*p) <= 123 )
|
2648
|
-
goto
|
2649
|
-
} else
|
2650
|
-
goto
|
2675
|
+
goto tr4;
|
2676
|
+
} else
|
2677
|
+
goto tr4;
|
2651
2678
|
} else
|
2652
|
-
goto
|
2653
|
-
goto
|
2654
|
-
|
2655
|
-
#line
|
2679
|
+
goto tr4;
|
2680
|
+
goto tr2;
|
2681
|
+
tr4:
|
2682
|
+
#line 838 "edn_parser.rl"
|
2656
2683
|
{
|
2657
2684
|
const char *np = parse_value(p, pe, v);
|
2658
2685
|
if (np) {
|
2659
2686
|
// this token is to be discard it so store it in the
|
2660
2687
|
// discard stack - we really don't need to save it so this
|
2661
2688
|
// could be simplified
|
2662
|
-
discard.
|
2689
|
+
discard.push_back(v);
|
2663
2690
|
{p = (( np))-1;}
|
2664
2691
|
} else {
|
2665
2692
|
p--; {p++; cs = 4; goto _out;}
|
2666
2693
|
}
|
2667
2694
|
}
|
2668
|
-
#line
|
2695
|
+
#line 58 "edn_parser.rl"
|
2669
2696
|
{ p--; {p++; cs = 4; goto _out;} }
|
2670
2697
|
goto st4;
|
2671
2698
|
st4:
|
2672
2699
|
if ( ++p == pe )
|
2673
2700
|
goto _test_eof4;
|
2674
2701
|
case 4:
|
2675
|
-
#line
|
2702
|
+
#line 2703 "edn_parser.cc"
|
2676
2703
|
goto st0;
|
2677
2704
|
st3:
|
2678
2705
|
if ( ++p == pe )
|
2679
2706
|
goto _test_eof3;
|
2680
2707
|
case 3:
|
2681
2708
|
if ( (*p) == 10 )
|
2682
|
-
goto
|
2709
|
+
goto tr3;
|
2683
2710
|
goto st3;
|
2684
2711
|
}
|
2685
2712
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2687,10 +2714,26 @@ case 3:
|
|
2687
2714
|
_test_eof3: cs = 3; goto _test_eof;
|
2688
2715
|
|
2689
2716
|
_test_eof: {}
|
2717
|
+
if ( p == eof )
|
2718
|
+
{
|
2719
|
+
switch ( cs ) {
|
2720
|
+
case 2:
|
2721
|
+
#line 851 "edn_parser.rl"
|
2722
|
+
{
|
2723
|
+
std::stringstream s;
|
2724
|
+
s << "discard sequence without element to discard";
|
2725
|
+
error(__FUNCTION__, s.str());
|
2726
|
+
p--; {p++; cs = 0; goto _out;}
|
2727
|
+
}
|
2728
|
+
break;
|
2729
|
+
#line 2730 "edn_parser.cc"
|
2730
|
+
}
|
2731
|
+
}
|
2732
|
+
|
2690
2733
|
_out: {}
|
2691
2734
|
}
|
2692
2735
|
|
2693
|
-
#line
|
2736
|
+
#line 871 "edn_parser.rl"
|
2694
2737
|
|
2695
2738
|
if (cs >= EDN_discard_first_final) {
|
2696
2739
|
return p + 1;
|
@@ -2721,7 +2764,7 @@ case 3:
|
|
2721
2764
|
// 2. add parse checks for uuid and inst for better error reporting
|
2722
2765
|
//
|
2723
2766
|
|
2724
|
-
#line
|
2767
|
+
#line 2768 "edn_parser.cc"
|
2725
2768
|
static const int EDN_tagged_start = 1;
|
2726
2769
|
static const int EDN_tagged_first_final = 6;
|
2727
2770
|
static const int EDN_tagged_error = 0;
|
@@ -2729,7 +2772,7 @@ static const int EDN_tagged_error = 0;
|
|
2729
2772
|
static const int EDN_tagged_en_main = 1;
|
2730
2773
|
|
2731
2774
|
|
2732
|
-
#line
|
2775
|
+
#line 922 "edn_parser.rl"
|
2733
2776
|
|
2734
2777
|
|
2735
2778
|
|
@@ -2741,14 +2784,14 @@ const char* edn::Parser::parse_tagged(const char *p, const char *pe, VALUE& v)
|
|
2741
2784
|
int cs;
|
2742
2785
|
|
2743
2786
|
|
2744
|
-
#line
|
2787
|
+
#line 2788 "edn_parser.cc"
|
2745
2788
|
{
|
2746
2789
|
cs = EDN_tagged_start;
|
2747
2790
|
}
|
2748
2791
|
|
2749
|
-
#line
|
2792
|
+
#line 933 "edn_parser.rl"
|
2750
2793
|
|
2751
|
-
#line
|
2794
|
+
#line 2795 "edn_parser.cc"
|
2752
2795
|
{
|
2753
2796
|
if ( p == pe )
|
2754
2797
|
goto _test_eof;
|
@@ -2765,7 +2808,7 @@ st0:
|
|
2765
2808
|
cs = 0;
|
2766
2809
|
goto _out;
|
2767
2810
|
tr0:
|
2768
|
-
#line
|
2811
|
+
#line 909 "edn_parser.rl"
|
2769
2812
|
{
|
2770
2813
|
// parses the symbol portion of the pair
|
2771
2814
|
const char *np = parse_symbol(p, pe, sym_name);
|
@@ -2776,15 +2819,16 @@ st2:
|
|
2776
2819
|
if ( ++p == pe )
|
2777
2820
|
goto _test_eof2;
|
2778
2821
|
case 2:
|
2779
|
-
#line
|
2822
|
+
#line 2823 "edn_parser.cc"
|
2780
2823
|
switch( (*p) ) {
|
2781
2824
|
case 10: goto tr3;
|
2782
2825
|
case 32: goto st3;
|
2783
2826
|
case 35: goto tr5;
|
2784
|
-
case
|
2827
|
+
case 39: goto st2;
|
2785
2828
|
case 44: goto st3;
|
2786
|
-
case 47: goto
|
2829
|
+
case 47: goto tr7;
|
2787
2830
|
case 59: goto st4;
|
2831
|
+
case 94: goto tr4;
|
2788
2832
|
case 95: goto tr5;
|
2789
2833
|
case 123: goto tr4;
|
2790
2834
|
}
|
@@ -2792,7 +2836,7 @@ case 2:
|
|
2792
2836
|
if ( (*p) < 33 ) {
|
2793
2837
|
if ( 9 <= (*p) && (*p) <= 13 )
|
2794
2838
|
goto st3;
|
2795
|
-
} else if ( (*p) >
|
2839
|
+
} else if ( (*p) > 40 ) {
|
2796
2840
|
if ( 42 <= (*p) && (*p) <= 43 )
|
2797
2841
|
goto tr4;
|
2798
2842
|
} else
|
@@ -2820,14 +2864,13 @@ st3:
|
|
2820
2864
|
if ( ++p == pe )
|
2821
2865
|
goto _test_eof3;
|
2822
2866
|
case 3:
|
2823
|
-
#line
|
2867
|
+
#line 2868 "edn_parser.cc"
|
2824
2868
|
switch( (*p) ) {
|
2825
2869
|
case 10: goto tr3;
|
2826
2870
|
case 32: goto st3;
|
2827
2871
|
case 40: goto tr4;
|
2828
2872
|
case 44: goto st3;
|
2829
2873
|
case 59: goto st4;
|
2830
|
-
case 95: goto tr4;
|
2831
2874
|
}
|
2832
2875
|
if ( (*p) < 42 ) {
|
2833
2876
|
if ( (*p) > 13 ) {
|
@@ -2836,29 +2879,32 @@ case 3:
|
|
2836
2879
|
} else if ( (*p) >= 9 )
|
2837
2880
|
goto st3;
|
2838
2881
|
} else if ( (*p) > 63 ) {
|
2839
|
-
if ( (*p)
|
2882
|
+
if ( (*p) < 94 ) {
|
2883
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
2884
|
+
goto tr4;
|
2885
|
+
} else if ( (*p) > 95 ) {
|
2840
2886
|
if ( 97 <= (*p) && (*p) <= 123 )
|
2841
2887
|
goto tr4;
|
2842
|
-
} else
|
2888
|
+
} else
|
2843
2889
|
goto tr4;
|
2844
2890
|
} else
|
2845
2891
|
goto tr4;
|
2846
2892
|
goto st0;
|
2847
2893
|
tr4:
|
2848
|
-
#line
|
2894
|
+
#line 914 "edn_parser.rl"
|
2849
2895
|
{
|
2850
2896
|
// parses the value portion
|
2851
2897
|
const char *np = parse_value(p, pe, data);
|
2852
2898
|
if (np == NULL) { p--; {p++; cs = 6; goto _out;} } else { {p = (( np))-1;} }
|
2853
2899
|
}
|
2854
|
-
#line
|
2900
|
+
#line 58 "edn_parser.rl"
|
2855
2901
|
{ p--; {p++; cs = 6; goto _out;} }
|
2856
2902
|
goto st6;
|
2857
2903
|
st6:
|
2858
2904
|
if ( ++p == pe )
|
2859
2905
|
goto _test_eof6;
|
2860
2906
|
case 6:
|
2861
|
-
#line
|
2907
|
+
#line 2908 "edn_parser.cc"
|
2862
2908
|
goto st0;
|
2863
2909
|
st4:
|
2864
2910
|
if ( ++p == pe )
|
@@ -2868,28 +2914,29 @@ case 4:
|
|
2868
2914
|
goto tr3;
|
2869
2915
|
goto st4;
|
2870
2916
|
tr5:
|
2871
|
-
#line
|
2917
|
+
#line 914 "edn_parser.rl"
|
2872
2918
|
{
|
2873
2919
|
// parses the value portion
|
2874
2920
|
const char *np = parse_value(p, pe, data);
|
2875
2921
|
if (np == NULL) { p--; {p++; cs = 7; goto _out;} } else { {p = (( np))-1;} }
|
2876
2922
|
}
|
2877
|
-
#line
|
2923
|
+
#line 58 "edn_parser.rl"
|
2878
2924
|
{ p--; {p++; cs = 7; goto _out;} }
|
2879
2925
|
goto st7;
|
2880
2926
|
st7:
|
2881
2927
|
if ( ++p == pe )
|
2882
2928
|
goto _test_eof7;
|
2883
2929
|
case 7:
|
2884
|
-
#line
|
2930
|
+
#line 2931 "edn_parser.cc"
|
2885
2931
|
switch( (*p) ) {
|
2886
2932
|
case 10: goto tr3;
|
2887
2933
|
case 32: goto st3;
|
2888
2934
|
case 35: goto tr5;
|
2889
|
-
case
|
2935
|
+
case 39: goto st2;
|
2890
2936
|
case 44: goto st3;
|
2891
|
-
case 47: goto
|
2937
|
+
case 47: goto tr7;
|
2892
2938
|
case 59: goto st4;
|
2939
|
+
case 94: goto tr4;
|
2893
2940
|
case 95: goto tr5;
|
2894
2941
|
case 123: goto tr4;
|
2895
2942
|
}
|
@@ -2897,7 +2944,7 @@ case 7:
|
|
2897
2944
|
if ( (*p) < 33 ) {
|
2898
2945
|
if ( 9 <= (*p) && (*p) <= 13 )
|
2899
2946
|
goto st3;
|
2900
|
-
} else if ( (*p) >
|
2947
|
+
} else if ( (*p) > 40 ) {
|
2901
2948
|
if ( 42 <= (*p) && (*p) <= 43 )
|
2902
2949
|
goto tr4;
|
2903
2950
|
} else
|
@@ -2917,21 +2964,21 @@ case 7:
|
|
2917
2964
|
} else
|
2918
2965
|
goto tr5;
|
2919
2966
|
goto st0;
|
2920
|
-
|
2921
|
-
#line
|
2967
|
+
tr7:
|
2968
|
+
#line 914 "edn_parser.rl"
|
2922
2969
|
{
|
2923
2970
|
// parses the value portion
|
2924
2971
|
const char *np = parse_value(p, pe, data);
|
2925
2972
|
if (np == NULL) { p--; {p++; cs = 8; goto _out;} } else { {p = (( np))-1;} }
|
2926
2973
|
}
|
2927
|
-
#line
|
2974
|
+
#line 58 "edn_parser.rl"
|
2928
2975
|
{ p--; {p++; cs = 8; goto _out;} }
|
2929
2976
|
goto st8;
|
2930
2977
|
st8:
|
2931
2978
|
if ( ++p == pe )
|
2932
2979
|
goto _test_eof8;
|
2933
2980
|
case 8:
|
2934
|
-
#line
|
2981
|
+
#line 2982 "edn_parser.cc"
|
2935
2982
|
if ( (*p) > 90 ) {
|
2936
2983
|
if ( 97 <= (*p) && (*p) <= 122 )
|
2937
2984
|
goto st5;
|
@@ -2945,19 +2992,20 @@ case 5:
|
|
2945
2992
|
switch( (*p) ) {
|
2946
2993
|
case 10: goto tr3;
|
2947
2994
|
case 32: goto st3;
|
2948
|
-
case 35: goto
|
2949
|
-
case
|
2995
|
+
case 35: goto tr9;
|
2996
|
+
case 39: goto st5;
|
2950
2997
|
case 44: goto st3;
|
2951
2998
|
case 47: goto tr4;
|
2952
2999
|
case 59: goto st4;
|
2953
|
-
case
|
3000
|
+
case 94: goto tr4;
|
3001
|
+
case 95: goto tr9;
|
2954
3002
|
case 123: goto tr4;
|
2955
3003
|
}
|
2956
3004
|
if ( (*p) < 45 ) {
|
2957
3005
|
if ( (*p) < 33 ) {
|
2958
3006
|
if ( 9 <= (*p) && (*p) <= 13 )
|
2959
3007
|
goto st3;
|
2960
|
-
} else if ( (*p) >
|
3008
|
+
} else if ( (*p) > 40 ) {
|
2961
3009
|
if ( 42 <= (*p) && (*p) <= 43 )
|
2962
3010
|
goto tr4;
|
2963
3011
|
} else
|
@@ -2969,45 +3017,46 @@ case 5:
|
|
2969
3017
|
} else if ( (*p) > 90 ) {
|
2970
3018
|
if ( (*p) > 92 ) {
|
2971
3019
|
if ( 97 <= (*p) && (*p) <= 122 )
|
2972
|
-
goto
|
3020
|
+
goto tr9;
|
2973
3021
|
} else if ( (*p) >= 91 )
|
2974
3022
|
goto tr4;
|
2975
3023
|
} else
|
2976
|
-
goto
|
3024
|
+
goto tr9;
|
2977
3025
|
} else
|
2978
|
-
goto
|
3026
|
+
goto tr9;
|
2979
3027
|
goto st0;
|
2980
|
-
|
2981
|
-
#line
|
3028
|
+
tr9:
|
3029
|
+
#line 914 "edn_parser.rl"
|
2982
3030
|
{
|
2983
3031
|
// parses the value portion
|
2984
3032
|
const char *np = parse_value(p, pe, data);
|
2985
3033
|
if (np == NULL) { p--; {p++; cs = 9; goto _out;} } else { {p = (( np))-1;} }
|
2986
3034
|
}
|
2987
|
-
#line
|
3035
|
+
#line 58 "edn_parser.rl"
|
2988
3036
|
{ p--; {p++; cs = 9; goto _out;} }
|
2989
3037
|
goto st9;
|
2990
3038
|
st9:
|
2991
3039
|
if ( ++p == pe )
|
2992
3040
|
goto _test_eof9;
|
2993
3041
|
case 9:
|
2994
|
-
#line
|
3042
|
+
#line 3043 "edn_parser.cc"
|
2995
3043
|
switch( (*p) ) {
|
2996
3044
|
case 10: goto tr3;
|
2997
3045
|
case 32: goto st3;
|
2998
|
-
case 35: goto
|
2999
|
-
case
|
3046
|
+
case 35: goto tr9;
|
3047
|
+
case 39: goto st5;
|
3000
3048
|
case 44: goto st3;
|
3001
3049
|
case 47: goto tr4;
|
3002
3050
|
case 59: goto st4;
|
3003
|
-
case
|
3051
|
+
case 94: goto tr4;
|
3052
|
+
case 95: goto tr9;
|
3004
3053
|
case 123: goto tr4;
|
3005
3054
|
}
|
3006
3055
|
if ( (*p) < 45 ) {
|
3007
3056
|
if ( (*p) < 33 ) {
|
3008
3057
|
if ( 9 <= (*p) && (*p) <= 13 )
|
3009
3058
|
goto st3;
|
3010
|
-
} else if ( (*p) >
|
3059
|
+
} else if ( (*p) > 40 ) {
|
3011
3060
|
if ( 42 <= (*p) && (*p) <= 43 )
|
3012
3061
|
goto tr4;
|
3013
3062
|
} else
|
@@ -3019,13 +3068,13 @@ case 9:
|
|
3019
3068
|
} else if ( (*p) > 90 ) {
|
3020
3069
|
if ( (*p) > 92 ) {
|
3021
3070
|
if ( 97 <= (*p) && (*p) <= 122 )
|
3022
|
-
goto
|
3071
|
+
goto tr9;
|
3023
3072
|
} else if ( (*p) >= 91 )
|
3024
3073
|
goto tr4;
|
3025
3074
|
} else
|
3026
|
-
goto
|
3075
|
+
goto tr9;
|
3027
3076
|
} else
|
3028
|
-
goto
|
3077
|
+
goto tr9;
|
3029
3078
|
goto st0;
|
3030
3079
|
}
|
3031
3080
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -3041,7 +3090,7 @@ case 9:
|
|
3041
3090
|
_out: {}
|
3042
3091
|
}
|
3043
3092
|
|
3044
|
-
#line
|
3093
|
+
#line 934 "edn_parser.rl"
|
3045
3094
|
|
3046
3095
|
if (cs >= EDN_tagged_first_final) {
|
3047
3096
|
//std::cerr << __FUNCTION__ << " parse symbol name as '" << sym_name << "', value is: " << data << std::endl;
|
@@ -3066,12 +3115,123 @@ case 9:
|
|
3066
3115
|
|
3067
3116
|
|
3068
3117
|
|
3118
|
+
// ============================================================
|
3119
|
+
// metadata - looks like ruby just discards this but we'll track it
|
3120
|
+
// and provide a means to retrive after each parse op - might be
|
3121
|
+
// useful?
|
3122
|
+
//
|
3123
|
+
|
3124
|
+
#line 3125 "edn_parser.cc"
|
3125
|
+
static const int EDN_meta_start = 1;
|
3126
|
+
static const int EDN_meta_first_final = 3;
|
3127
|
+
static const int EDN_meta_error = 0;
|
3128
|
+
|
3129
|
+
static const int EDN_meta_en_main = 1;
|
3130
|
+
|
3131
|
+
|
3132
|
+
#line 977 "edn_parser.rl"
|
3133
|
+
|
3134
|
+
|
3135
|
+
|
3136
|
+
const char* edn::Parser::parse_meta(const char *p, const char *pe)
|
3137
|
+
{
|
3138
|
+
int cs;
|
3139
|
+
VALUE v;
|
3140
|
+
|
3141
|
+
|
3142
|
+
#line 3143 "edn_parser.cc"
|
3143
|
+
{
|
3144
|
+
cs = EDN_meta_start;
|
3145
|
+
}
|
3146
|
+
|
3147
|
+
#line 986 "edn_parser.rl"
|
3148
|
+
|
3149
|
+
#line 3150 "edn_parser.cc"
|
3150
|
+
{
|
3151
|
+
if ( p == pe )
|
3152
|
+
goto _test_eof;
|
3153
|
+
switch ( cs )
|
3154
|
+
{
|
3155
|
+
case 1:
|
3156
|
+
if ( (*p) == 94 )
|
3157
|
+
goto st2;
|
3158
|
+
goto st0;
|
3159
|
+
st0:
|
3160
|
+
cs = 0;
|
3161
|
+
goto _out;
|
3162
|
+
st2:
|
3163
|
+
if ( ++p == pe )
|
3164
|
+
goto _test_eof2;
|
3165
|
+
case 2:
|
3166
|
+
if ( (*p) == 40 )
|
3167
|
+
goto tr2;
|
3168
|
+
if ( (*p) < 60 ) {
|
3169
|
+
if ( (*p) < 42 ) {
|
3170
|
+
if ( 33 <= (*p) && (*p) <= 38 )
|
3171
|
+
goto tr2;
|
3172
|
+
} else if ( (*p) > 43 ) {
|
3173
|
+
if ( 45 <= (*p) && (*p) <= 58 )
|
3174
|
+
goto tr2;
|
3175
|
+
} else
|
3176
|
+
goto tr2;
|
3177
|
+
} else if ( (*p) > 63 ) {
|
3178
|
+
if ( (*p) < 94 ) {
|
3179
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
3180
|
+
goto tr2;
|
3181
|
+
} else if ( (*p) > 95 ) {
|
3182
|
+
if ( 97 <= (*p) && (*p) <= 123 )
|
3183
|
+
goto tr2;
|
3184
|
+
} else
|
3185
|
+
goto tr2;
|
3186
|
+
} else
|
3187
|
+
goto tr2;
|
3188
|
+
goto st0;
|
3189
|
+
tr2:
|
3190
|
+
#line 969 "edn_parser.rl"
|
3191
|
+
{
|
3192
|
+
const char *np = parse_value(p, pe, v);
|
3193
|
+
if (np) { {p = (( np))-1;} } else { p--; {p++; cs = 3; goto _out;} }
|
3194
|
+
}
|
3195
|
+
#line 58 "edn_parser.rl"
|
3196
|
+
{ p--; {p++; cs = 3; goto _out;} }
|
3197
|
+
goto st3;
|
3198
|
+
st3:
|
3199
|
+
if ( ++p == pe )
|
3200
|
+
goto _test_eof3;
|
3201
|
+
case 3:
|
3202
|
+
#line 3203 "edn_parser.cc"
|
3203
|
+
goto st0;
|
3204
|
+
}
|
3205
|
+
_test_eof2: cs = 2; goto _test_eof;
|
3206
|
+
_test_eof3: cs = 3; goto _test_eof;
|
3207
|
+
|
3208
|
+
_test_eof: {}
|
3209
|
+
_out: {}
|
3210
|
+
}
|
3211
|
+
|
3212
|
+
#line 987 "edn_parser.rl"
|
3213
|
+
|
3214
|
+
if (cs >= EDN_meta_first_final) {
|
3215
|
+
metadata.push_back(v);
|
3216
|
+
return p + 1;
|
3217
|
+
}
|
3218
|
+
else if (cs == EDN_meta_error) {
|
3219
|
+
error(__FUNCTION__, *p);
|
3220
|
+
return pe;
|
3221
|
+
}
|
3222
|
+
else if (cs == EDN_meta_en_main) {} // silence ragel warning
|
3223
|
+
|
3224
|
+
return NULL;
|
3225
|
+
}
|
3226
|
+
|
3227
|
+
|
3228
|
+
|
3069
3229
|
// ============================================================
|
3070
3230
|
// parses entire input but expects single valid token at the
|
3071
3231
|
// top-level, therefore, does not tokenize source stream
|
3072
3232
|
//
|
3073
3233
|
|
3074
|
-
#line
|
3234
|
+
#line 3235 "edn_parser.cc"
|
3075
3235
|
static const int EDN_parser_start = 2;
|
3076
3236
|
static const int EDN_parser_first_final = 2;
|
3077
3237
|
static const int EDN_parser_error = 0;
|
@@ -3079,7 +3239,7 @@ static const int EDN_parser_error = 0;
|
|
3079
3239
|
static const int EDN_parser_en_main = 2;
|
3080
3240
|
|
3081
3241
|
|
3082
|
-
#line
|
3242
|
+
#line 1036 "edn_parser.rl"
|
3083
3243
|
|
3084
3244
|
|
3085
3245
|
|
@@ -3088,21 +3248,16 @@ VALUE edn::Parser::parse(const char* src, std::size_t len)
|
|
3088
3248
|
int cs;
|
3089
3249
|
VALUE result = Qnil;
|
3090
3250
|
|
3091
|
-
// reset line counter & discard stack
|
3092
|
-
reset();
|
3093
|
-
|
3094
3251
|
|
3095
|
-
#line
|
3252
|
+
#line 3253 "edn_parser.cc"
|
3096
3253
|
{
|
3097
3254
|
cs = EDN_parser_start;
|
3098
3255
|
}
|
3099
3256
|
|
3100
|
-
#line
|
3101
|
-
|
3102
|
-
pe = p + len;
|
3103
|
-
eof = pe;
|
3257
|
+
#line 1045 "edn_parser.rl"
|
3258
|
+
set_source(src, len);
|
3104
3259
|
|
3105
|
-
#line
|
3260
|
+
#line 3261 "edn_parser.cc"
|
3106
3261
|
{
|
3107
3262
|
if ( p == pe )
|
3108
3263
|
goto _test_eof;
|
@@ -3113,24 +3268,36 @@ tr1:
|
|
3113
3268
|
{ line_number++; }
|
3114
3269
|
goto st2;
|
3115
3270
|
tr4:
|
3116
|
-
#line
|
3271
|
+
#line 1013 "edn_parser.rl"
|
3117
3272
|
{
|
3273
|
+
// save the count of metadata items before we parse this value
|
3274
|
+
// so we can determine if we've read another metadata value or
|
3275
|
+
// an actual data item
|
3276
|
+
std::size_t meta_size = metadata.size();
|
3118
3277
|
const char* np = parse_value(p, pe, result);
|
3119
|
-
if (np == NULL) { {p = (( pe))-1;} {p++; cs = 2; goto _out;} } else {
|
3278
|
+
if (np == NULL) { {p = (( pe))-1;} {p++; cs = 2; goto _out;} } else {
|
3279
|
+
// if we have metadata saved and it matches the count we
|
3280
|
+
// saved before we parsed a value, then we must bind the
|
3281
|
+
// metadata sequence to it
|
3282
|
+
if (!metadata.empty() && metadata.size() == meta_size) {
|
3283
|
+
// this will empty the metadata sequence too
|
3284
|
+
result = bind_meta_to_value(result);
|
3285
|
+
}
|
3286
|
+
{p = (( np))-1;}
|
3287
|
+
}
|
3120
3288
|
}
|
3121
3289
|
goto st2;
|
3122
3290
|
st2:
|
3123
3291
|
if ( ++p == pe )
|
3124
3292
|
goto _test_eof2;
|
3125
3293
|
case 2:
|
3126
|
-
#line
|
3294
|
+
#line 3295 "edn_parser.cc"
|
3127
3295
|
switch( (*p) ) {
|
3128
3296
|
case 10: goto tr1;
|
3129
3297
|
case 32: goto st2;
|
3130
3298
|
case 40: goto tr4;
|
3131
3299
|
case 44: goto st2;
|
3132
3300
|
case 59: goto st1;
|
3133
|
-
case 95: goto tr4;
|
3134
3301
|
}
|
3135
3302
|
if ( (*p) < 42 ) {
|
3136
3303
|
if ( (*p) > 13 ) {
|
@@ -3139,10 +3306,13 @@ case 2:
|
|
3139
3306
|
} else if ( (*p) >= 9 )
|
3140
3307
|
goto st2;
|
3141
3308
|
} else if ( (*p) > 63 ) {
|
3142
|
-
if ( (*p)
|
3309
|
+
if ( (*p) < 94 ) {
|
3310
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
3311
|
+
goto tr4;
|
3312
|
+
} else if ( (*p) > 95 ) {
|
3143
3313
|
if ( 97 <= (*p) && (*p) <= 123 )
|
3144
3314
|
goto tr4;
|
3145
|
-
} else
|
3315
|
+
} else
|
3146
3316
|
goto tr4;
|
3147
3317
|
} else
|
3148
3318
|
goto tr4;
|
@@ -3165,16 +3335,15 @@ case 1:
|
|
3165
3335
|
_out: {}
|
3166
3336
|
}
|
3167
3337
|
|
3168
|
-
#line
|
3338
|
+
#line 1047 "edn_parser.rl"
|
3169
3339
|
|
3170
3340
|
if (cs == EDN_parser_error) {
|
3171
|
-
|
3172
|
-
|
3341
|
+
if (p)
|
3342
|
+
error(__FUNCTION__, *p);
|
3343
|
+
return EDNT_EOF;
|
3173
3344
|
}
|
3174
3345
|
else if (cs == EDN_parser_first_final) {
|
3175
|
-
// whole source is parsed so reset
|
3176
3346
|
p = pe = eof = NULL;
|
3177
|
-
reset();
|
3178
3347
|
}
|
3179
3348
|
else if (cs == EDN_parser_en_main) {} // silence ragel warning
|
3180
3349
|
return result;
|
@@ -3185,32 +3354,40 @@ case 1:
|
|
3185
3354
|
// token-by-token machine
|
3186
3355
|
//
|
3187
3356
|
|
3188
|
-
#line
|
3357
|
+
#line 3358 "edn_parser.cc"
|
3189
3358
|
static const int EDN_tokens_start = 1;
|
3359
|
+
static const int EDN_tokens_error = 0;
|
3190
3360
|
|
3191
3361
|
static const int EDN_tokens_en_main = 1;
|
3192
3362
|
|
3193
3363
|
|
3194
|
-
#line
|
3364
|
+
#line 1100 "edn_parser.rl"
|
3195
3365
|
|
3196
3366
|
|
3197
3367
|
|
3198
3368
|
//
|
3199
3369
|
//
|
3200
|
-
|
3370
|
+
bool edn::Parser::parse_next(VALUE& value)
|
3201
3371
|
{
|
3202
|
-
VALUE result = Qnil;
|
3203
3372
|
int cs;
|
3373
|
+
bool is_value = true;
|
3374
|
+
// need to track metadada read and bind it to the next value read
|
3375
|
+
// - but must account for sequences of metadata values
|
3376
|
+
std::size_t meta_size;
|
3377
|
+
|
3378
|
+
// clear any previously saved discards; only track if read during
|
3379
|
+
// this op
|
3380
|
+
discard.clear();
|
3204
3381
|
|
3205
3382
|
|
3206
|
-
#line
|
3383
|
+
#line 3384 "edn_parser.cc"
|
3207
3384
|
{
|
3208
3385
|
cs = EDN_tokens_start;
|
3209
3386
|
}
|
3210
3387
|
|
3211
|
-
#line
|
3388
|
+
#line 1118 "edn_parser.rl"
|
3212
3389
|
|
3213
|
-
#line
|
3390
|
+
#line 3391 "edn_parser.cc"
|
3214
3391
|
{
|
3215
3392
|
if ( p == pe )
|
3216
3393
|
goto _test_eof;
|
@@ -3224,14 +3401,13 @@ st1:
|
|
3224
3401
|
if ( ++p == pe )
|
3225
3402
|
goto _test_eof1;
|
3226
3403
|
case 1:
|
3227
|
-
#line
|
3404
|
+
#line 3405 "edn_parser.cc"
|
3228
3405
|
switch( (*p) ) {
|
3229
3406
|
case 10: goto tr2;
|
3230
3407
|
case 32: goto st1;
|
3231
3408
|
case 40: goto tr3;
|
3232
3409
|
case 44: goto st1;
|
3233
3410
|
case 59: goto st3;
|
3234
|
-
case 95: goto tr3;
|
3235
3411
|
}
|
3236
3412
|
if ( (*p) < 42 ) {
|
3237
3413
|
if ( (*p) > 13 ) {
|
@@ -3240,10 +3416,13 @@ case 1:
|
|
3240
3416
|
} else if ( (*p) >= 9 )
|
3241
3417
|
goto st1;
|
3242
3418
|
} else if ( (*p) > 63 ) {
|
3243
|
-
if ( (*p)
|
3419
|
+
if ( (*p) < 94 ) {
|
3420
|
+
if ( 65 <= (*p) && (*p) <= 92 )
|
3421
|
+
goto tr3;
|
3422
|
+
} else if ( (*p) > 95 ) {
|
3244
3423
|
if ( 97 <= (*p) && (*p) <= 123 )
|
3245
3424
|
goto tr3;
|
3246
|
-
} else
|
3425
|
+
} else
|
3247
3426
|
goto tr3;
|
3248
3427
|
} else
|
3249
3428
|
goto tr3;
|
@@ -3256,17 +3435,41 @@ tr6:
|
|
3256
3435
|
{ line_number++; }
|
3257
3436
|
goto st4;
|
3258
3437
|
tr3:
|
3259
|
-
#line
|
3260
|
-
{
|
3261
|
-
|
3262
|
-
|
3438
|
+
#line 1070 "edn_parser.rl"
|
3439
|
+
{
|
3440
|
+
// we won't know if we've parsed a discard or a metadata until
|
3441
|
+
// after parse_value() is done. Save the current number of
|
3442
|
+
// elements in the metadata sequence; then we can check if it
|
3443
|
+
// grew or if the discard sequence grew
|
3444
|
+
meta_size = metadata.size();
|
3445
|
+
|
3446
|
+
const char* np = parse_value(p, pe, value);
|
3447
|
+
|
3448
|
+
if (np == NULL) { p--; {p++; cs = 4; goto _out;} } else {
|
3449
|
+
if (metadata.size() > 0) {
|
3450
|
+
// was anotheran additional metadata entry read? if
|
3451
|
+
// so, don't return a value
|
3452
|
+
if (metadata.size() > meta_size) {
|
3453
|
+
is_value = false;
|
3454
|
+
}
|
3455
|
+
else {
|
3456
|
+
// a value was read and there's a pending metadata
|
3457
|
+
// sequence. Bind them.
|
3458
|
+
value = bind_meta_to_value(value);
|
3459
|
+
}
|
3460
|
+
} else if (!discard.empty()) {
|
3461
|
+
// a discard read. Don't return a value
|
3462
|
+
is_value = false;
|
3463
|
+
}
|
3464
|
+
{p = (( np))-1;}
|
3465
|
+
}
|
3263
3466
|
}
|
3264
3467
|
goto st4;
|
3265
3468
|
st4:
|
3266
3469
|
if ( ++p == pe )
|
3267
3470
|
goto _test_eof4;
|
3268
3471
|
case 4:
|
3269
|
-
#line
|
3472
|
+
#line 3473 "edn_parser.cc"
|
3270
3473
|
switch( (*p) ) {
|
3271
3474
|
case 10: goto tr6;
|
3272
3475
|
case 32: goto st4;
|
@@ -3300,11 +3503,14 @@ case 3:
|
|
3300
3503
|
_out: {}
|
3301
3504
|
}
|
3302
3505
|
|
3303
|
-
#line
|
3506
|
+
#line 1119 "edn_parser.rl"
|
3304
3507
|
|
3305
|
-
if (cs ==
|
3508
|
+
if (cs == EDN_parser_error) {
|
3509
|
+
value = EDNT_EOF;
|
3510
|
+
}
|
3511
|
+
else if (cs == EDN_tokens_en_main) {} // silence ragel warning
|
3306
3512
|
|
3307
|
-
return
|
3513
|
+
return is_value;
|
3308
3514
|
}
|
3309
3515
|
|
3310
3516
|
|