edn_turbo 0.3.1 → 0.3.2

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.
@@ -16,7 +16,7 @@
16
16
  //
17
17
 
18
18
 
19
- #line 59 "edn_parser.rl"
19
+ #line 54 "edn_parser.rl"
20
20
 
21
21
 
22
22
  // ============================================================
@@ -32,23 +32,24 @@ static const int EDN_value_error = 0;
32
32
  static const int EDN_value_en_main = 1;
33
33
 
34
34
 
35
- #line 175 "edn_parser.rl"
35
+ #line 170 "edn_parser.rl"
36
36
 
37
37
 
38
38
 
39
39
  const char *edn::Parser::parse_value(const char *p, const char *pe, VALUE& v)
40
40
  {
41
+ // std::cerr << __FUNCTION__ << "() p: \"" << p << "\"" << std::endl;
41
42
  int cs;
42
43
 
43
44
 
44
- #line 45 "edn_parser.cc"
45
+ #line 46 "edn_parser.cc"
45
46
  {
46
47
  cs = EDN_value_start;
47
48
  }
48
49
 
49
- #line 183 "edn_parser.rl"
50
+ #line 179 "edn_parser.rl"
50
51
 
51
- #line 52 "edn_parser.cc"
52
+ #line 53 "edn_parser.cc"
52
53
  {
53
54
  if ( p == pe )
54
55
  goto _test_eof;
@@ -68,7 +69,7 @@ case 1:
68
69
  }
69
70
  if ( (*p) < 48 ) {
70
71
  if ( (*p) < 42 ) {
71
- if ( 33 <= (*p) && (*p) <= 38 )
72
+ if ( 33 <= (*p) && (*p) <= 39 )
72
73
  goto tr0;
73
74
  } else if ( (*p) > 43 ) {
74
75
  if ( 45 <= (*p) && (*p) <= 47 )
@@ -91,7 +92,7 @@ st0:
91
92
  cs = 0;
92
93
  goto _out;
93
94
  tr0:
94
- #line 103 "edn_parser.rl"
95
+ #line 98 "edn_parser.rl"
95
96
  {
96
97
  // stand-alone operators *, +, -, etc.
97
98
  const char *np = parse_operator(p, pe, v);
@@ -99,7 +100,7 @@ tr0:
99
100
  }
100
101
  goto st2;
101
102
  tr2:
102
- #line 71 "edn_parser.rl"
103
+ #line 66 "edn_parser.rl"
103
104
  {
104
105
  // string types within double-quotes
105
106
  const char *np = parse_string(p, pe, v);
@@ -107,7 +108,7 @@ tr2:
107
108
  }
108
109
  goto st2;
109
110
  tr3:
110
- #line 155 "edn_parser.rl"
111
+ #line 150 "edn_parser.rl"
111
112
  {
112
113
  // handles tokens w/ leading # ("#_", "#{", and tagged elems)
113
114
  const char *np = parse_dispatch(p + 1, pe, v);
@@ -115,7 +116,7 @@ tr3:
115
116
  }
116
117
  goto st2;
117
118
  tr4:
118
- #line 137 "edn_parser.rl"
119
+ #line 132 "edn_parser.rl"
119
120
  {
120
121
  // (
121
122
  const char *np = parse_list(p, pe, v);
@@ -123,7 +124,7 @@ tr4:
123
124
  }
124
125
  goto st2;
125
126
  tr5:
126
- #line 83 "edn_parser.rl"
127
+ #line 78 "edn_parser.rl"
127
128
  {
128
129
  // tokens w/ leading digits: non-negative integers & decimals.
129
130
  // try to parse a decimal first
@@ -139,13 +140,13 @@ tr5:
139
140
  {p++; cs = 2; goto _out;}
140
141
  }
141
142
  else {
142
- error(__FUNCTION__, *p);
143
+ error(__FUNCTION__, "number format error", *p);
143
144
  {p = (( pe))-1;}
144
145
  }
145
146
  }
146
147
  goto st2;
147
148
  tr6:
148
- #line 77 "edn_parser.rl"
149
+ #line 72 "edn_parser.rl"
149
150
  {
150
151
  // tokens with a leading ':'
151
152
  const char *np = parse_keyword(p, pe, v);
@@ -153,25 +154,25 @@ tr6:
153
154
  }
154
155
  goto st2;
155
156
  tr7:
156
- #line 115 "edn_parser.rl"
157
+ #line 110 "edn_parser.rl"
157
158
  {
158
159
  // user identifiers and reserved keywords (true, false, nil)
159
160
  VALUE sym = Qnil;
160
161
  const char *np = parse_symbol(p, pe, sym);
161
- if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
162
+ if (np == NULL) { {p = (( pe))-1;} } else {
162
163
  // parse_symbol will make 'sym' a ruby string
163
164
  if (std::strcmp(RSTRING_PTR(sym), "true") == 0) { v = Qtrue; }
164
165
  else if (std::strcmp(RSTRING_PTR(sym), "false") == 0) { v = Qfalse; }
165
166
  else if (std::strcmp(RSTRING_PTR(sym), "nil") == 0) { v = Qnil; }
166
167
  else {
167
- v = Parser::make_edn_symbol(sym);
168
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
168
169
  }
169
170
  {p = (( np))-1;}
170
171
  }
171
172
  }
172
173
  goto st2;
173
174
  tr8:
174
- #line 131 "edn_parser.rl"
175
+ #line 126 "edn_parser.rl"
175
176
  {
176
177
  // [
177
178
  const char *np = parse_vector(p, pe, v);
@@ -179,7 +180,7 @@ tr8:
179
180
  }
180
181
  goto st2;
181
182
  tr9:
182
- #line 109 "edn_parser.rl"
183
+ #line 104 "edn_parser.rl"
183
184
  {
184
185
  // tokens w/ leading \ (escaped characters \newline, \c, etc.)
185
186
  const char *np = parse_esc_char(p, pe, v);
@@ -187,7 +188,7 @@ tr9:
187
188
  }
188
189
  goto st2;
189
190
  tr10:
190
- #line 149 "edn_parser.rl"
191
+ #line 144 "edn_parser.rl"
191
192
  {
192
193
  // ^
193
194
  const char *np = parse_meta(p, pe);
@@ -195,7 +196,7 @@ tr10:
195
196
  }
196
197
  goto st2;
197
198
  tr11:
198
- #line 143 "edn_parser.rl"
199
+ #line 138 "edn_parser.rl"
199
200
  {
200
201
  // {
201
202
  const char *np = parse_map(p, pe, v);
@@ -206,9 +207,9 @@ st2:
206
207
  if ( ++p == pe )
207
208
  goto _test_eof2;
208
209
  case 2:
209
- #line 58 "edn_parser.rl"
210
+ #line 53 "edn_parser.rl"
210
211
  { p--; {p++; cs = 2; goto _out;} }
211
- #line 212 "edn_parser.cc"
212
+ #line 213 "edn_parser.cc"
212
213
  goto st0;
213
214
  }
214
215
  _test_eof2: cs = 2; goto _test_eof;
@@ -217,13 +218,13 @@ case 2:
217
218
  _out: {}
218
219
  }
219
220
 
220
- #line 184 "edn_parser.rl"
221
+ #line 180 "edn_parser.rl"
221
222
 
222
223
  if (cs >= EDN_value_first_final) {
223
224
  return p;
224
225
  }
225
226
  else if (cs == EDN_value_error) {
226
- error(__FUNCTION__, *p);
227
+ error(__FUNCTION__, "token error", *p);
227
228
  return pe;
228
229
  }
229
230
  else if (cs == EDN_value_en_main) {} // silence ragel warning
@@ -239,7 +240,7 @@ case 2:
239
240
  // ascii range is found.
240
241
  //
241
242
 
242
- #line 243 "edn_parser.cc"
243
+ #line 244 "edn_parser.cc"
243
244
  static const int EDN_string_start = 1;
244
245
  static const int EDN_string_first_final = 8;
245
246
  static const int EDN_string_error = 0;
@@ -247,7 +248,7 @@ static const int EDN_string_error = 0;
247
248
  static const int EDN_string_en_main = 1;
248
249
 
249
250
 
250
- #line 229 "edn_parser.rl"
251
+ #line 225 "edn_parser.rl"
251
252
 
252
253
 
253
254
 
@@ -258,15 +259,15 @@ const char* edn::Parser::parse_string(const char *p, const char *pe, VALUE& v)
258
259
  bool encode = false;
259
260
 
260
261
 
261
- #line 262 "edn_parser.cc"
262
+ #line 263 "edn_parser.cc"
262
263
  {
263
264
  cs = EDN_string_start;
264
265
  }
265
266
 
266
- #line 239 "edn_parser.rl"
267
+ #line 235 "edn_parser.rl"
267
268
  const char* p_save = p;
268
269
 
269
- #line 270 "edn_parser.cc"
270
+ #line 271 "edn_parser.cc"
270
271
  {
271
272
  if ( p == pe )
272
273
  goto _test_eof;
@@ -276,21 +277,11 @@ case 1:
276
277
  if ( (*p) == 34 )
277
278
  goto st2;
278
279
  goto st0;
279
- tr3:
280
- #line 51 "edn_parser.rl"
281
- {
282
- std::stringstream s;
283
- s << "unterminated " << EDN_TYPE;
284
- error(__FUNCTION__, s.str());
285
- p--; {p++; cs = 0; goto _out;}
286
- }
287
- goto st0;
288
- #line 289 "edn_parser.cc"
289
280
  st0:
290
281
  cs = 0;
291
282
  goto _out;
292
283
  tr2:
293
- #line 218 "edn_parser.rl"
284
+ #line 214 "edn_parser.rl"
294
285
  {
295
286
  encode = true;
296
287
  }
@@ -299,19 +290,16 @@ st2:
299
290
  if ( ++p == pe )
300
291
  goto _test_eof2;
301
292
  case 2:
302
- #line 303 "edn_parser.cc"
293
+ #line 294 "edn_parser.cc"
303
294
  switch( (*p) ) {
304
- case 34: goto tr4;
305
- case 92: goto tr5;
295
+ case 34: goto tr3;
296
+ case 92: goto tr4;
306
297
  }
307
- if ( (*p) > -11 ) {
308
- if ( 0 <= (*p) && (*p) <= 31 )
309
- goto tr3;
310
- } else if ( (*p) >= -62 )
298
+ if ( -62 <= (*p) && (*p) <= -11 )
311
299
  goto tr2;
312
300
  goto st2;
313
- tr4:
314
- #line 210 "edn_parser.rl"
301
+ tr3:
302
+ #line 206 "edn_parser.rl"
315
303
  {
316
304
  if (Parser::parse_byte_stream(p_save + 1, p, v, encode)) {
317
305
  {p = (( p + 1))-1;}
@@ -319,17 +307,17 @@ tr4:
319
307
  p--; {p++; cs = 8; goto _out;}
320
308
  }
321
309
  }
322
- #line 58 "edn_parser.rl"
310
+ #line 53 "edn_parser.rl"
323
311
  { p--; {p++; cs = 8; goto _out;} }
324
312
  goto st8;
325
313
  st8:
326
314
  if ( ++p == pe )
327
315
  goto _test_eof8;
328
316
  case 8:
329
- #line 330 "edn_parser.cc"
317
+ #line 318 "edn_parser.cc"
330
318
  goto st0;
331
- tr5:
332
- #line 218 "edn_parser.rl"
319
+ tr4:
320
+ #line 214 "edn_parser.rl"
333
321
  {
334
322
  encode = true;
335
323
  }
@@ -338,7 +326,7 @@ st3:
338
326
  if ( ++p == pe )
339
327
  goto _test_eof3;
340
328
  case 3:
341
- #line 342 "edn_parser.cc"
329
+ #line 330 "edn_parser.cc"
342
330
  switch( (*p) ) {
343
331
  case 34: goto tr2;
344
332
  case 47: goto tr2;
@@ -348,13 +336,11 @@ case 3:
348
336
  case 110: goto tr2;
349
337
  case 114: goto tr2;
350
338
  case 116: goto tr2;
351
- case 117: goto tr6;
339
+ case 117: goto tr5;
352
340
  }
353
- if ( 0 <= (*p) && (*p) <= 31 )
354
- goto st0;
355
341
  goto st2;
356
- tr6:
357
- #line 218 "edn_parser.rl"
342
+ tr5:
343
+ #line 214 "edn_parser.rl"
358
344
  {
359
345
  encode = true;
360
346
  }
@@ -363,18 +349,18 @@ st4:
363
349
  if ( ++p == pe )
364
350
  goto _test_eof4;
365
351
  case 4:
366
- #line 367 "edn_parser.cc"
352
+ #line 353 "edn_parser.cc"
367
353
  if ( (*p) < 65 ) {
368
354
  if ( 48 <= (*p) && (*p) <= 57 )
369
- goto tr7;
355
+ goto tr6;
370
356
  } else if ( (*p) > 70 ) {
371
357
  if ( 97 <= (*p) && (*p) <= 102 )
372
- goto tr7;
358
+ goto tr6;
373
359
  } else
374
- goto tr7;
360
+ goto tr6;
375
361
  goto st0;
376
- tr7:
377
- #line 218 "edn_parser.rl"
362
+ tr6:
363
+ #line 214 "edn_parser.rl"
378
364
  {
379
365
  encode = true;
380
366
  }
@@ -383,18 +369,18 @@ st5:
383
369
  if ( ++p == pe )
384
370
  goto _test_eof5;
385
371
  case 5:
386
- #line 387 "edn_parser.cc"
372
+ #line 373 "edn_parser.cc"
387
373
  if ( (*p) < 65 ) {
388
374
  if ( 48 <= (*p) && (*p) <= 57 )
389
- goto tr8;
375
+ goto tr7;
390
376
  } else if ( (*p) > 70 ) {
391
377
  if ( 97 <= (*p) && (*p) <= 102 )
392
- goto tr8;
378
+ goto tr7;
393
379
  } else
394
- goto tr8;
380
+ goto tr7;
395
381
  goto st0;
396
- tr8:
397
- #line 218 "edn_parser.rl"
382
+ tr7:
383
+ #line 214 "edn_parser.rl"
398
384
  {
399
385
  encode = true;
400
386
  }
@@ -403,18 +389,18 @@ st6:
403
389
  if ( ++p == pe )
404
390
  goto _test_eof6;
405
391
  case 6:
406
- #line 407 "edn_parser.cc"
392
+ #line 393 "edn_parser.cc"
407
393
  if ( (*p) < 65 ) {
408
394
  if ( 48 <= (*p) && (*p) <= 57 )
409
- goto tr9;
395
+ goto tr8;
410
396
  } else if ( (*p) > 70 ) {
411
397
  if ( 97 <= (*p) && (*p) <= 102 )
412
- goto tr9;
398
+ goto tr8;
413
399
  } else
414
- goto tr9;
400
+ goto tr8;
415
401
  goto st0;
416
- tr9:
417
- #line 218 "edn_parser.rl"
402
+ tr8:
403
+ #line 214 "edn_parser.rl"
418
404
  {
419
405
  encode = true;
420
406
  }
@@ -423,7 +409,7 @@ st7:
423
409
  if ( ++p == pe )
424
410
  goto _test_eof7;
425
411
  case 7:
426
- #line 427 "edn_parser.cc"
412
+ #line 413 "edn_parser.cc"
427
413
  if ( (*p) < 65 ) {
428
414
  if ( 48 <= (*p) && (*p) <= 57 )
429
415
  goto tr2;
@@ -447,7 +433,7 @@ case 7:
447
433
  {
448
434
  switch ( cs ) {
449
435
  case 2:
450
- #line 51 "edn_parser.rl"
436
+ #line 46 "edn_parser.rl"
451
437
  {
452
438
  std::stringstream s;
453
439
  s << "unterminated " << EDN_TYPE;
@@ -455,14 +441,14 @@ case 7:
455
441
  p--; {p++; cs = 0; goto _out;}
456
442
  }
457
443
  break;
458
- #line 459 "edn_parser.cc"
444
+ #line 445 "edn_parser.cc"
459
445
  }
460
446
  }
461
447
 
462
448
  _out: {}
463
449
  }
464
450
 
465
- #line 241 "edn_parser.rl"
451
+ #line 237 "edn_parser.rl"
466
452
 
467
453
  if (cs >= EDN_string_first_final) {
468
454
  return p + 1;
@@ -480,7 +466,7 @@ case 7:
480
466
  // keyword parsing
481
467
  //
482
468
 
483
- #line 484 "edn_parser.cc"
469
+ #line 470 "edn_parser.cc"
484
470
  static const int EDN_keyword_start = 1;
485
471
  static const int EDN_keyword_first_final = 3;
486
472
  static const int EDN_keyword_error = 0;
@@ -488,7 +474,7 @@ static const int EDN_keyword_error = 0;
488
474
  static const int EDN_keyword_en_main = 1;
489
475
 
490
476
 
491
- #line 270 "edn_parser.rl"
477
+ #line 267 "edn_parser.rl"
492
478
 
493
479
 
494
480
 
@@ -497,15 +483,15 @@ const char* edn::Parser::parse_keyword(const char *p, const char *pe, VALUE& v)
497
483
  int cs;
498
484
 
499
485
 
500
- #line 501 "edn_parser.cc"
486
+ #line 487 "edn_parser.cc"
501
487
  {
502
488
  cs = EDN_keyword_start;
503
489
  }
504
490
 
505
- #line 278 "edn_parser.rl"
491
+ #line 275 "edn_parser.rl"
506
492
  const char* p_save = p;
507
493
 
508
- #line 509 "edn_parser.cc"
494
+ #line 495 "edn_parser.cc"
509
495
  {
510
496
  if ( p == pe )
511
497
  goto _test_eof;
@@ -522,13 +508,24 @@ st2:
522
508
  if ( ++p == pe )
523
509
  goto _test_eof2;
524
510
  case 2:
525
- if ( (*p) == 35 )
526
- goto st3;
527
- if ( (*p) < 65 ) {
528
- if ( 46 <= (*p) && (*p) <= 47 )
511
+ switch( (*p) ) {
512
+ case 33: goto st3;
513
+ case 95: goto st3;
514
+ }
515
+ if ( (*p) < 45 ) {
516
+ if ( (*p) > 39 ) {
517
+ if ( 42 <= (*p) && (*p) <= 43 )
518
+ goto st3;
519
+ } else if ( (*p) >= 35 )
529
520
  goto st3;
530
- } else if ( (*p) > 90 ) {
531
- if ( 97 <= (*p) && (*p) <= 122 )
521
+ } else if ( (*p) > 46 ) {
522
+ if ( (*p) < 65 ) {
523
+ if ( 60 <= (*p) && (*p) <= 63 )
524
+ goto st3;
525
+ } else if ( (*p) > 90 ) {
526
+ if ( 97 <= (*p) && (*p) <= 122 )
527
+ goto st3;
528
+ } else
532
529
  goto st3;
533
530
  } else
534
531
  goto st3;
@@ -539,6 +536,7 @@ st3:
539
536
  case 3:
540
537
  switch( (*p) ) {
541
538
  case 33: goto st3;
539
+ case 47: goto st5;
542
540
  case 95: goto st3;
543
541
  }
544
542
  if ( (*p) < 45 ) {
@@ -560,25 +558,53 @@ case 3:
560
558
  goto st3;
561
559
  goto tr3;
562
560
  tr3:
563
- #line 58 "edn_parser.rl"
561
+ #line 53 "edn_parser.rl"
564
562
  { p--; {p++; cs = 4; goto _out;} }
565
563
  goto st4;
566
564
  st4:
567
565
  if ( ++p == pe )
568
566
  goto _test_eof4;
569
567
  case 4:
570
- #line 571 "edn_parser.cc"
568
+ #line 569 "edn_parser.cc"
571
569
  goto st0;
570
+ st5:
571
+ if ( ++p == pe )
572
+ goto _test_eof5;
573
+ case 5:
574
+ switch( (*p) ) {
575
+ case 33: goto st5;
576
+ case 47: goto st0;
577
+ case 95: goto st5;
578
+ }
579
+ if ( (*p) < 45 ) {
580
+ if ( (*p) > 39 ) {
581
+ if ( 42 <= (*p) && (*p) <= 43 )
582
+ goto st5;
583
+ } else if ( (*p) >= 35 )
584
+ goto st5;
585
+ } else if ( (*p) > 58 ) {
586
+ if ( (*p) < 65 ) {
587
+ if ( 60 <= (*p) && (*p) <= 63 )
588
+ goto st5;
589
+ } else if ( (*p) > 90 ) {
590
+ if ( 97 <= (*p) && (*p) <= 122 )
591
+ goto st5;
592
+ } else
593
+ goto st5;
594
+ } else
595
+ goto st5;
596
+ goto tr3;
572
597
  }
573
598
  _test_eof2: cs = 2; goto _test_eof;
574
599
  _test_eof3: cs = 3; goto _test_eof;
575
600
  _test_eof4: cs = 4; goto _test_eof;
601
+ _test_eof5: cs = 5; goto _test_eof;
576
602
 
577
603
  _test_eof: {}
578
604
  _out: {}
579
605
  }
580
606
 
581
- #line 280 "edn_parser.rl"
607
+ #line 277 "edn_parser.rl"
582
608
 
583
609
  if (cs >= EDN_keyword_first_final) {
584
610
  std::string buf;
@@ -589,7 +615,7 @@ case 4:
589
615
  return p;
590
616
  }
591
617
  else if (cs == EDN_keyword_error) {
592
- error(__FUNCTION__, *p);
618
+ error(__FUNCTION__, "invalid keyword", *p);
593
619
  return pe;
594
620
  }
595
621
  else if (cs == EDN_keyword_en_main) {} // silence ragel warning
@@ -602,14 +628,14 @@ case 4:
602
628
  // decimal parsing machine
603
629
  //
604
630
 
605
- #line 606 "edn_parser.cc"
631
+ #line 632 "edn_parser.cc"
606
632
  static const int EDN_decimal_start = 1;
607
633
  static const int EDN_decimal_first_final = 9;
608
634
 
609
635
  static const int EDN_decimal_en_main = 1;
610
636
 
611
637
 
612
- #line 313 "edn_parser.rl"
638
+ #line 310 "edn_parser.rl"
613
639
 
614
640
 
615
641
 
@@ -618,15 +644,15 @@ const char* edn::Parser::parse_decimal(const char *p, const char *pe, VALUE& v)
618
644
  int cs;
619
645
 
620
646
 
621
- #line 622 "edn_parser.cc"
647
+ #line 648 "edn_parser.cc"
622
648
  {
623
649
  cs = EDN_decimal_start;
624
650
  }
625
651
 
626
- #line 321 "edn_parser.rl"
652
+ #line 318 "edn_parser.rl"
627
653
  const char* p_save = p;
628
654
 
629
- #line 630 "edn_parser.cc"
655
+ #line 656 "edn_parser.cc"
630
656
  {
631
657
  if ( p == pe )
632
658
  goto _test_eof;
@@ -680,14 +706,14 @@ case 9:
680
706
  goto st0;
681
707
  goto tr10;
682
708
  tr10:
683
- #line 58 "edn_parser.rl"
709
+ #line 53 "edn_parser.rl"
684
710
  { p--; {p++; cs = 10; goto _out;} }
685
711
  goto st10;
686
712
  st10:
687
713
  if ( ++p == pe )
688
714
  goto _test_eof10;
689
715
  case 10:
690
- #line 691 "edn_parser.cc"
716
+ #line 717 "edn_parser.cc"
691
717
  goto st0;
692
718
  st4:
693
719
  if ( ++p == pe )
@@ -803,7 +829,7 @@ case 8:
803
829
  _out: {}
804
830
  }
805
831
 
806
- #line 323 "edn_parser.rl"
832
+ #line 320 "edn_parser.rl"
807
833
 
808
834
  if (cs >= EDN_decimal_first_final) {
809
835
  v = Parser::float_to_ruby(p_save, p - p_save);
@@ -815,17 +841,17 @@ case 8:
815
841
 
816
842
 
817
843
  // ============================================================
818
- // integer parsing machine
844
+ // integer parsing machine - M suffix will return a BigNum
819
845
  //
820
846
 
821
- #line 822 "edn_parser.cc"
847
+ #line 848 "edn_parser.cc"
822
848
  static const int EDN_integer_start = 1;
823
849
  static const int EDN_integer_first_final = 3;
824
850
 
825
851
  static const int EDN_integer_en_main = 1;
826
852
 
827
853
 
828
- #line 346 "edn_parser.rl"
854
+ #line 343 "edn_parser.rl"
829
855
 
830
856
 
831
857
  const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
@@ -833,15 +859,15 @@ const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
833
859
  int cs;
834
860
 
835
861
 
836
- #line 837 "edn_parser.cc"
862
+ #line 863 "edn_parser.cc"
837
863
  {
838
864
  cs = EDN_integer_start;
839
865
  }
840
866
 
841
- #line 353 "edn_parser.rl"
867
+ #line 350 "edn_parser.rl"
842
868
  const char* p_save = p;
843
869
 
844
- #line 845 "edn_parser.cc"
870
+ #line 871 "edn_parser.cc"
845
871
  {
846
872
  if ( p == pe )
847
873
  goto _test_eof;
@@ -883,14 +909,14 @@ case 3:
883
909
  goto st0;
884
910
  goto tr4;
885
911
  tr4:
886
- #line 58 "edn_parser.rl"
912
+ #line 53 "edn_parser.rl"
887
913
  { p--; {p++; cs = 4; goto _out;} }
888
914
  goto st4;
889
915
  st4:
890
916
  if ( ++p == pe )
891
917
  goto _test_eof4;
892
918
  case 4:
893
- #line 894 "edn_parser.cc"
919
+ #line 920 "edn_parser.cc"
894
920
  goto st0;
895
921
  st5:
896
922
  if ( ++p == pe )
@@ -931,7 +957,7 @@ case 6:
931
957
  _out: {}
932
958
  }
933
959
 
934
- #line 355 "edn_parser.rl"
960
+ #line 352 "edn_parser.rl"
935
961
 
936
962
  if (cs >= EDN_integer_first_final) {
937
963
  v = Parser::integer_to_ruby(p_save, p - p_save);
@@ -951,7 +977,7 @@ case 6:
951
977
  // 3. stand-alone operators: +, -, /, *, etc.
952
978
  //
953
979
 
954
- #line 955 "edn_parser.cc"
980
+ #line 981 "edn_parser.cc"
955
981
  static const int EDN_operator_start = 1;
956
982
  static const int EDN_operator_first_final = 3;
957
983
  static const int EDN_operator_error = 0;
@@ -959,7 +985,7 @@ static const int EDN_operator_error = 0;
959
985
  static const int EDN_operator_en_main = 1;
960
986
 
961
987
 
962
- #line 425 "edn_parser.rl"
988
+ #line 426 "edn_parser.rl"
963
989
 
964
990
 
965
991
 
@@ -968,15 +994,15 @@ const char* edn::Parser::parse_operator(const char *p, const char *pe, VALUE& v)
968
994
  int cs;
969
995
 
970
996
 
971
- #line 972 "edn_parser.cc"
997
+ #line 998 "edn_parser.cc"
972
998
  {
973
999
  cs = EDN_operator_start;
974
1000
  }
975
1001
 
976
- #line 433 "edn_parser.rl"
1002
+ #line 434 "edn_parser.rl"
977
1003
  const char* p_save = p;
978
1004
 
979
- #line 980 "edn_parser.cc"
1005
+ #line 1006 "edn_parser.cc"
980
1006
  {
981
1007
  if ( p == pe )
982
1008
  goto _test_eof;
@@ -986,13 +1012,13 @@ case 1:
986
1012
  switch( (*p) ) {
987
1013
  case 33: goto st3;
988
1014
  case 42: goto st3;
989
- case 43: goto st7;
990
- case 45: goto st7;
991
- case 46: goto st9;
1015
+ case 43: goto st8;
1016
+ case 45: goto st8;
1017
+ case 46: goto st11;
992
1018
  case 47: goto st3;
993
1019
  case 95: goto st3;
994
1020
  }
995
- if ( (*p) > 38 ) {
1021
+ if ( (*p) > 39 ) {
996
1022
  if ( 60 <= (*p) && (*p) <= 63 )
997
1023
  goto st3;
998
1024
  } else if ( (*p) >= 36 )
@@ -1008,139 +1034,148 @@ case 3:
1008
1034
  switch( (*p) ) {
1009
1035
  case 10: goto tr8;
1010
1036
  case 32: goto tr7;
1011
- case 33: goto st0;
1037
+ case 33: goto tr9;
1012
1038
  case 44: goto tr7;
1013
- case 59: goto tr9;
1014
- case 95: goto st0;
1039
+ case 59: goto tr10;
1040
+ case 95: goto tr9;
1015
1041
  }
1016
1042
  if ( (*p) < 42 ) {
1017
1043
  if ( (*p) > 13 ) {
1018
- if ( 36 <= (*p) && (*p) <= 38 )
1019
- goto st0;
1044
+ if ( 35 <= (*p) && (*p) <= 39 )
1045
+ goto tr9;
1020
1046
  } else if ( (*p) >= 9 )
1021
1047
  goto tr7;
1022
- } else if ( (*p) > 57 ) {
1023
- if ( (*p) < 65 ) {
1024
- if ( 60 <= (*p) && (*p) <= 63 )
1025
- goto st0;
1026
- } else if ( (*p) > 90 ) {
1048
+ } else if ( (*p) > 63 ) {
1049
+ if ( (*p) > 90 ) {
1027
1050
  if ( 97 <= (*p) && (*p) <= 122 )
1028
- goto st0;
1029
- } else
1030
- goto st0;
1051
+ goto tr9;
1052
+ } else if ( (*p) >= 65 )
1053
+ goto tr9;
1031
1054
  } else
1032
- goto st0;
1055
+ goto tr9;
1033
1056
  goto tr6;
1034
1057
  tr6:
1035
- #line 412 "edn_parser.rl"
1058
+ #line 410 "edn_parser.rl"
1036
1059
  {
1037
1060
  // stand-alone operators (-, +, /, ... etc)
1038
1061
  char op[2] = { *p_save, 0 };
1039
1062
  VALUE sym = rb_str_new2(op);
1040
- v = Parser::make_edn_symbol(sym);
1063
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1041
1064
  }
1042
- #line 58 "edn_parser.rl"
1065
+ #line 53 "edn_parser.rl"
1043
1066
  { p--; {p++; cs = 4; goto _out;} }
1044
1067
  goto st4;
1045
- tr10:
1046
- #line 58 "edn_parser.rl"
1068
+ tr11:
1069
+ #line 53 "edn_parser.rl"
1070
+ { p--; {p++; cs = 4; goto _out;} }
1071
+ goto st4;
1072
+ tr17:
1073
+ #line 376 "edn_parser.rl"
1074
+ {
1075
+ // parse a symbol including the leading operator (-, +, .)
1076
+ VALUE sym = Qnil;
1077
+ const char *np = parse_symbol(p_save, pe, sym);
1078
+ if (np == NULL) { {p = (( pe))-1;} } else {
1079
+ if (sym != Qnil)
1080
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1081
+ {p = (( np))-1;}
1082
+ }
1083
+ }
1084
+ #line 53 "edn_parser.rl"
1047
1085
  { p--; {p++; cs = 4; goto _out;} }
1048
1086
  goto st4;
1049
1087
  st4:
1050
1088
  if ( ++p == pe )
1051
1089
  goto _test_eof4;
1052
1090
  case 4:
1053
- #line 1054 "edn_parser.cc"
1091
+ #line 1092 "edn_parser.cc"
1054
1092
  goto st0;
1055
1093
  tr5:
1056
1094
  #line 20 "edn_parser.rl"
1057
1095
  { line_number++; }
1058
1096
  goto st5;
1059
1097
  tr7:
1060
- #line 412 "edn_parser.rl"
1098
+ #line 410 "edn_parser.rl"
1061
1099
  {
1062
1100
  // stand-alone operators (-, +, /, ... etc)
1063
1101
  char op[2] = { *p_save, 0 };
1064
1102
  VALUE sym = rb_str_new2(op);
1065
- v = Parser::make_edn_symbol(sym);
1103
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1066
1104
  }
1067
- #line 58 "edn_parser.rl"
1105
+ #line 53 "edn_parser.rl"
1068
1106
  { p--; {p++; cs = 5; goto _out;} }
1069
1107
  goto st5;
1070
1108
  tr8:
1071
- #line 412 "edn_parser.rl"
1109
+ #line 410 "edn_parser.rl"
1072
1110
  {
1073
1111
  // stand-alone operators (-, +, /, ... etc)
1074
1112
  char op[2] = { *p_save, 0 };
1075
1113
  VALUE sym = rb_str_new2(op);
1076
- v = Parser::make_edn_symbol(sym);
1114
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1077
1115
  }
1078
1116
  #line 20 "edn_parser.rl"
1079
1117
  { line_number++; }
1080
- #line 58 "edn_parser.rl"
1118
+ #line 53 "edn_parser.rl"
1081
1119
  { p--; {p++; cs = 5; goto _out;} }
1082
1120
  goto st5;
1083
- tr11:
1084
- #line 58 "edn_parser.rl"
1121
+ tr12:
1122
+ #line 53 "edn_parser.rl"
1085
1123
  { p--; {p++; cs = 5; goto _out;} }
1086
1124
  goto st5;
1087
- tr12:
1125
+ tr13:
1088
1126
  #line 20 "edn_parser.rl"
1089
1127
  { line_number++; }
1090
- #line 58 "edn_parser.rl"
1128
+ #line 53 "edn_parser.rl"
1091
1129
  { p--; {p++; cs = 5; goto _out;} }
1092
1130
  goto st5;
1093
1131
  st5:
1094
1132
  if ( ++p == pe )
1095
1133
  goto _test_eof5;
1096
1134
  case 5:
1097
- #line 1098 "edn_parser.cc"
1135
+ #line 1136 "edn_parser.cc"
1098
1136
  switch( (*p) ) {
1099
- case 10: goto tr12;
1100
- case 32: goto tr11;
1137
+ case 10: goto tr13;
1138
+ case 32: goto tr12;
1101
1139
  case 33: goto st0;
1102
- case 44: goto tr11;
1103
- case 59: goto tr13;
1140
+ case 44: goto tr12;
1141
+ case 59: goto tr14;
1104
1142
  case 95: goto st0;
1105
1143
  }
1106
1144
  if ( (*p) < 42 ) {
1107
1145
  if ( (*p) > 13 ) {
1108
- if ( 36 <= (*p) && (*p) <= 38 )
1146
+ if ( 35 <= (*p) && (*p) <= 39 )
1109
1147
  goto st0;
1110
1148
  } else if ( (*p) >= 9 )
1111
- goto tr11;
1112
- } else if ( (*p) > 57 ) {
1113
- if ( (*p) < 65 ) {
1114
- if ( 60 <= (*p) && (*p) <= 63 )
1115
- goto st0;
1116
- } else if ( (*p) > 90 ) {
1149
+ goto tr12;
1150
+ } else if ( (*p) > 63 ) {
1151
+ if ( (*p) > 90 ) {
1117
1152
  if ( 97 <= (*p) && (*p) <= 122 )
1118
1153
  goto st0;
1119
- } else
1154
+ } else if ( (*p) >= 65 )
1120
1155
  goto st0;
1121
1156
  } else
1122
1157
  goto st0;
1123
- goto tr10;
1124
- tr9:
1125
- #line 412 "edn_parser.rl"
1158
+ goto tr11;
1159
+ tr10:
1160
+ #line 410 "edn_parser.rl"
1126
1161
  {
1127
1162
  // stand-alone operators (-, +, /, ... etc)
1128
1163
  char op[2] = { *p_save, 0 };
1129
1164
  VALUE sym = rb_str_new2(op);
1130
- v = Parser::make_edn_symbol(sym);
1165
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1131
1166
  }
1132
- #line 58 "edn_parser.rl"
1167
+ #line 53 "edn_parser.rl"
1133
1168
  { p--; {p++; cs = 6; goto _out;} }
1134
1169
  goto st6;
1135
- tr13:
1136
- #line 58 "edn_parser.rl"
1170
+ tr14:
1171
+ #line 53 "edn_parser.rl"
1137
1172
  { p--; {p++; cs = 6; goto _out;} }
1138
1173
  goto st6;
1139
1174
  st6:
1140
1175
  if ( ++p == pe )
1141
1176
  goto _test_eof6;
1142
1177
  case 6:
1143
- #line 1144 "edn_parser.cc"
1178
+ #line 1179 "edn_parser.cc"
1144
1179
  if ( (*p) == 10 )
1145
1180
  goto tr5;
1146
1181
  goto st2;
@@ -1151,41 +1186,21 @@ case 2:
1151
1186
  if ( (*p) == 10 )
1152
1187
  goto tr5;
1153
1188
  goto st2;
1154
- st7:
1155
- if ( ++p == pe )
1156
- goto _test_eof7;
1157
- case 7:
1158
- switch( (*p) ) {
1159
- case 10: goto tr8;
1160
- case 32: goto tr7;
1161
- case 33: goto st0;
1162
- case 44: goto tr7;
1163
- case 59: goto tr9;
1164
- case 95: goto st0;
1165
- }
1166
- if ( (*p) < 48 ) {
1167
- if ( (*p) < 36 ) {
1168
- if ( 9 <= (*p) && (*p) <= 13 )
1169
- goto tr7;
1170
- } else if ( (*p) > 38 ) {
1171
- if ( 42 <= (*p) && (*p) <= 47 )
1172
- goto st0;
1173
- } else
1174
- goto st0;
1175
- } else if ( (*p) > 57 ) {
1176
- if ( (*p) < 65 ) {
1177
- if ( 60 <= (*p) && (*p) <= 63 )
1178
- goto st0;
1179
- } else if ( (*p) > 90 ) {
1180
- if ( 97 <= (*p) && (*p) <= 122 )
1181
- goto tr15;
1182
- } else
1183
- goto tr15;
1184
- } else
1185
- goto tr14;
1186
- goto tr6;
1187
- tr14:
1188
- #line 389 "edn_parser.rl"
1189
+ tr9:
1190
+ #line 376 "edn_parser.rl"
1191
+ {
1192
+ // parse a symbol including the leading operator (-, +, .)
1193
+ VALUE sym = Qnil;
1194
+ const char *np = parse_symbol(p_save, pe, sym);
1195
+ if (np == NULL) { {p = (( pe))-1;} } else {
1196
+ if (sym != Qnil)
1197
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1198
+ {p = (( np))-1;}
1199
+ }
1200
+ }
1201
+ goto st7;
1202
+ tr16:
1203
+ #line 387 "edn_parser.rl"
1189
1204
  {
1190
1205
  // parse a number with the leading symbol - this is slightly
1191
1206
  // different than the one within EDN_value since it includes
@@ -1201,42 +1216,30 @@ tr14:
1201
1216
  if (np) {
1202
1217
  {p = (( np))-1;}
1203
1218
  p--;
1204
- {p++; cs = 8; goto _out;}
1219
+ {p++; cs = 7; goto _out;}
1205
1220
  }
1206
1221
  else {
1207
- error(__FUNCTION__, *p);
1222
+ error(__FUNCTION__, "number format error", *p);
1208
1223
  {p = (( pe))-1;}
1209
1224
  }
1210
1225
  }
1211
- goto st8;
1212
- tr15:
1213
- #line 379 "edn_parser.rl"
1214
- {
1215
- // parse a symbol including the leading operator (-, +, .)
1216
- VALUE sym = Qnil;
1217
- const char *np = parse_symbol(p_save, pe, sym);
1218
- if (np == NULL) { p--; {p++; cs = 8; goto _out;} } else {
1219
- v = Parser::make_edn_symbol(sym);
1220
- {p = (( np))-1;}
1221
- }
1222
- }
1223
- goto st8;
1224
- st8:
1226
+ goto st7;
1227
+ st7:
1225
1228
  if ( ++p == pe )
1226
- goto _test_eof8;
1227
- case 8:
1228
- #line 1229 "edn_parser.cc"
1229
+ goto _test_eof7;
1230
+ case 7:
1231
+ #line 1232 "edn_parser.cc"
1229
1232
  switch( (*p) ) {
1230
1233
  case 33: goto st0;
1231
1234
  case 95: goto st0;
1232
1235
  }
1233
1236
  if ( (*p) < 45 ) {
1234
- if ( (*p) > 38 ) {
1237
+ if ( (*p) > 39 ) {
1235
1238
  if ( 42 <= (*p) && (*p) <= 43 )
1236
1239
  goto st0;
1237
- } else if ( (*p) >= 36 )
1240
+ } else if ( (*p) >= 35 )
1238
1241
  goto st0;
1239
- } else if ( (*p) > 57 ) {
1242
+ } else if ( (*p) > 58 ) {
1240
1243
  if ( (*p) < 65 ) {
1241
1244
  if ( 60 <= (*p) && (*p) <= 63 )
1242
1245
  goto st0;
@@ -1247,76 +1250,193 @@ case 8:
1247
1250
  goto st0;
1248
1251
  } else
1249
1252
  goto st0;
1250
- goto tr10;
1251
- st9:
1253
+ goto tr11;
1254
+ st8:
1252
1255
  if ( ++p == pe )
1253
- goto _test_eof9;
1254
- case 9:
1256
+ goto _test_eof8;
1257
+ case 8:
1255
1258
  switch( (*p) ) {
1256
1259
  case 10: goto tr8;
1257
1260
  case 32: goto tr7;
1258
- case 33: goto st0;
1261
+ case 33: goto st9;
1259
1262
  case 44: goto tr7;
1260
- case 59: goto tr9;
1261
- case 95: goto st0;
1263
+ case 59: goto tr10;
1264
+ case 95: goto st9;
1262
1265
  }
1263
- if ( (*p) < 42 ) {
1264
- if ( (*p) > 13 ) {
1265
- if ( 36 <= (*p) && (*p) <= 38 )
1266
- goto st0;
1267
- } else if ( (*p) >= 9 )
1268
- goto tr7;
1266
+ if ( (*p) < 48 ) {
1267
+ if ( (*p) < 35 ) {
1268
+ if ( 9 <= (*p) && (*p) <= 13 )
1269
+ goto tr7;
1270
+ } else if ( (*p) > 39 ) {
1271
+ if ( 42 <= (*p) && (*p) <= 47 )
1272
+ goto st9;
1273
+ } else
1274
+ goto st9;
1269
1275
  } else if ( (*p) > 57 ) {
1270
1276
  if ( (*p) < 65 ) {
1271
- if ( 60 <= (*p) && (*p) <= 63 )
1272
- goto st0;
1277
+ if ( 58 <= (*p) && (*p) <= 63 )
1278
+ goto st9;
1273
1279
  } else if ( (*p) > 90 ) {
1274
1280
  if ( 97 <= (*p) && (*p) <= 122 )
1275
- goto tr15;
1281
+ goto st9;
1276
1282
  } else
1277
- goto tr15;
1283
+ goto st9;
1278
1284
  } else
1279
- goto st0;
1285
+ goto tr16;
1280
1286
  goto tr6;
1287
+ st9:
1288
+ if ( ++p == pe )
1289
+ goto _test_eof9;
1290
+ case 9:
1291
+ switch( (*p) ) {
1292
+ case 33: goto tr18;
1293
+ case 95: goto tr18;
1281
1294
  }
1282
- _test_eof3: cs = 3; goto _test_eof;
1283
- _test_eof4: cs = 4; goto _test_eof;
1284
- _test_eof5: cs = 5; goto _test_eof;
1285
- _test_eof6: cs = 6; goto _test_eof;
1286
- _test_eof2: cs = 2; goto _test_eof;
1287
- _test_eof7: cs = 7; goto _test_eof;
1288
- _test_eof8: cs = 8; goto _test_eof;
1289
- _test_eof9: cs = 9; goto _test_eof;
1290
-
1291
- _test_eof: {}
1292
- if ( p == eof )
1293
- {
1294
- switch ( cs ) {
1295
- case 3:
1296
- case 7:
1297
- case 9:
1298
- #line 412 "edn_parser.rl"
1299
- {
1300
- // stand-alone operators (-, +, /, ... etc)
1301
- char op[2] = { *p_save, 0 };
1302
- VALUE sym = rb_str_new2(op);
1303
- v = Parser::make_edn_symbol(sym);
1304
- }
1295
+ if ( (*p) < 45 ) {
1296
+ if ( (*p) > 39 ) {
1297
+ if ( 42 <= (*p) && (*p) <= 43 )
1298
+ goto tr18;
1299
+ } else if ( (*p) >= 35 )
1300
+ goto tr18;
1301
+ } else if ( (*p) > 58 ) {
1302
+ if ( (*p) < 65 ) {
1303
+ if ( 60 <= (*p) && (*p) <= 63 )
1304
+ goto tr18;
1305
+ } else if ( (*p) > 90 ) {
1306
+ if ( 97 <= (*p) && (*p) <= 122 )
1307
+ goto tr18;
1308
+ } else
1309
+ goto tr18;
1310
+ } else
1311
+ goto tr18;
1312
+ goto tr17;
1313
+ tr18:
1314
+ #line 376 "edn_parser.rl"
1315
+ {
1316
+ // parse a symbol including the leading operator (-, +, .)
1317
+ VALUE sym = Qnil;
1318
+ const char *np = parse_symbol(p_save, pe, sym);
1319
+ if (np == NULL) { {p = (( pe))-1;} } else {
1320
+ if (sym != Qnil)
1321
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1322
+ {p = (( np))-1;}
1323
+ }
1324
+ }
1325
+ goto st10;
1326
+ st10:
1327
+ if ( ++p == pe )
1328
+ goto _test_eof10;
1329
+ case 10:
1330
+ #line 1331 "edn_parser.cc"
1331
+ switch( (*p) ) {
1332
+ case 33: goto st10;
1333
+ case 95: goto st10;
1334
+ }
1335
+ if ( (*p) < 45 ) {
1336
+ if ( (*p) > 39 ) {
1337
+ if ( 42 <= (*p) && (*p) <= 43 )
1338
+ goto st10;
1339
+ } else if ( (*p) >= 35 )
1340
+ goto st10;
1341
+ } else if ( (*p) > 58 ) {
1342
+ if ( (*p) < 65 ) {
1343
+ if ( 60 <= (*p) && (*p) <= 63 )
1344
+ goto st10;
1345
+ } else if ( (*p) > 90 ) {
1346
+ if ( 97 <= (*p) && (*p) <= 122 )
1347
+ goto st10;
1348
+ } else
1349
+ goto st10;
1350
+ } else
1351
+ goto st10;
1352
+ goto tr11;
1353
+ st11:
1354
+ if ( ++p == pe )
1355
+ goto _test_eof11;
1356
+ case 11:
1357
+ switch( (*p) ) {
1358
+ case 10: goto tr8;
1359
+ case 32: goto tr7;
1360
+ case 33: goto st9;
1361
+ case 44: goto tr7;
1362
+ case 59: goto tr10;
1363
+ case 95: goto st9;
1364
+ }
1365
+ if ( (*p) < 48 ) {
1366
+ if ( (*p) < 35 ) {
1367
+ if ( 9 <= (*p) && (*p) <= 13 )
1368
+ goto tr7;
1369
+ } else if ( (*p) > 39 ) {
1370
+ if ( 42 <= (*p) && (*p) <= 47 )
1371
+ goto st9;
1372
+ } else
1373
+ goto st9;
1374
+ } else if ( (*p) > 57 ) {
1375
+ if ( (*p) < 65 ) {
1376
+ if ( 58 <= (*p) && (*p) <= 63 )
1377
+ goto st9;
1378
+ } else if ( (*p) > 90 ) {
1379
+ if ( 97 <= (*p) && (*p) <= 122 )
1380
+ goto st9;
1381
+ } else
1382
+ goto st9;
1383
+ } else
1384
+ goto st0;
1385
+ goto tr6;
1386
+ }
1387
+ _test_eof3: cs = 3; goto _test_eof;
1388
+ _test_eof4: cs = 4; goto _test_eof;
1389
+ _test_eof5: cs = 5; goto _test_eof;
1390
+ _test_eof6: cs = 6; goto _test_eof;
1391
+ _test_eof2: cs = 2; goto _test_eof;
1392
+ _test_eof7: cs = 7; goto _test_eof;
1393
+ _test_eof8: cs = 8; goto _test_eof;
1394
+ _test_eof9: cs = 9; goto _test_eof;
1395
+ _test_eof10: cs = 10; goto _test_eof;
1396
+ _test_eof11: cs = 11; goto _test_eof;
1397
+
1398
+ _test_eof: {}
1399
+ if ( p == eof )
1400
+ {
1401
+ switch ( cs ) {
1402
+ case 9:
1403
+ #line 376 "edn_parser.rl"
1404
+ {
1405
+ // parse a symbol including the leading operator (-, +, .)
1406
+ VALUE sym = Qnil;
1407
+ const char *np = parse_symbol(p_save, pe, sym);
1408
+ if (np == NULL) { {p = (( pe))-1;} } else {
1409
+ if (sym != Qnil)
1410
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1411
+ {p = (( np))-1;}
1412
+ }
1413
+ }
1414
+ break;
1415
+ case 3:
1416
+ case 8:
1417
+ case 11:
1418
+ #line 410 "edn_parser.rl"
1419
+ {
1420
+ // stand-alone operators (-, +, /, ... etc)
1421
+ char op[2] = { *p_save, 0 };
1422
+ VALUE sym = rb_str_new2(op);
1423
+ v = Parser::make_edn_type(EDNT_MAKE_SYMBOL_METHOD, sym);
1424
+ }
1305
1425
  break;
1306
- #line 1307 "edn_parser.cc"
1426
+ #line 1427 "edn_parser.cc"
1307
1427
  }
1308
1428
  }
1309
1429
 
1310
1430
  _out: {}
1311
1431
  }
1312
1432
 
1313
- #line 435 "edn_parser.rl"
1433
+ #line 436 "edn_parser.rl"
1314
1434
 
1315
1435
  if (cs >= EDN_operator_first_final) {
1316
1436
  return p;
1317
1437
  }
1318
1438
  else if (cs == EDN_operator_error) {
1319
- error(__FUNCTION__, *p);
1439
+ error(__FUNCTION__, "symbol syntax error", *p);
1320
1440
  return pe;
1321
1441
  }
1322
1442
  else if (cs == EDN_operator_en_main) {} // silence ragel warning
@@ -1329,15 +1449,15 @@ case 9:
1329
1449
  // escaped char parsing - handles \c, \newline, \formfeed, etc.
1330
1450
  //
1331
1451
 
1332
- #line 1333 "edn_parser.cc"
1452
+ #line 1453 "edn_parser.cc"
1333
1453
  static const int EDN_escaped_char_start = 1;
1334
- static const int EDN_escaped_char_first_final = 4;
1454
+ static const int EDN_escaped_char_first_final = 26;
1335
1455
  static const int EDN_escaped_char_error = 0;
1336
1456
 
1337
1457
  static const int EDN_escaped_char_en_main = 1;
1338
1458
 
1339
1459
 
1340
- #line 464 "edn_parser.rl"
1460
+ #line 466 "edn_parser.rl"
1341
1461
 
1342
1462
 
1343
1463
 
@@ -1346,15 +1466,15 @@ const char* edn::Parser::parse_esc_char(const char *p, const char *pe, VALUE& v)
1346
1466
  int cs;
1347
1467
 
1348
1468
 
1349
- #line 1350 "edn_parser.cc"
1469
+ #line 1470 "edn_parser.cc"
1350
1470
  {
1351
1471
  cs = EDN_escaped_char_start;
1352
1472
  }
1353
1473
 
1354
- #line 472 "edn_parser.rl"
1474
+ #line 474 "edn_parser.rl"
1355
1475
  const char* p_save = p;
1356
1476
 
1357
- #line 1358 "edn_parser.cc"
1477
+ #line 1478 "edn_parser.cc"
1358
1478
  {
1359
1479
  if ( p == pe )
1360
1480
  goto _test_eof;
@@ -1371,109 +1491,382 @@ st2:
1371
1491
  if ( ++p == pe )
1372
1492
  goto _test_eof2;
1373
1493
  case 2:
1374
- if ( (*p) > 90 ) {
1375
- if ( 97 <= (*p) && (*p) <= 122 )
1376
- goto st4;
1377
- } else if ( (*p) >= 65 )
1378
- goto st4;
1494
+ switch( (*p) ) {
1495
+ case 98: goto st29;
1496
+ case 102: goto st30;
1497
+ case 110: goto st31;
1498
+ case 114: goto st32;
1499
+ case 115: goto st33;
1500
+ case 116: goto st34;
1501
+ }
1502
+ goto st26;
1503
+ st26:
1504
+ if ( ++p == pe )
1505
+ goto _test_eof26;
1506
+ case 26:
1507
+ switch( (*p) ) {
1508
+ case 10: goto tr10;
1509
+ case 32: goto tr28;
1510
+ case 41: goto tr29;
1511
+ case 44: goto tr28;
1512
+ case 59: goto st3;
1513
+ case 125: goto tr29;
1514
+ }
1515
+ if ( (*p) > 13 ) {
1516
+ if ( 92 <= (*p) && (*p) <= 93 )
1517
+ goto tr29;
1518
+ } else if ( (*p) >= 9 )
1519
+ goto tr28;
1520
+ goto st0;
1521
+ tr10:
1522
+ #line 20 "edn_parser.rl"
1523
+ { line_number++; }
1524
+ #line 53 "edn_parser.rl"
1525
+ { p--; {p++; cs = 27; goto _out;} }
1526
+ goto st27;
1527
+ tr28:
1528
+ #line 53 "edn_parser.rl"
1529
+ { p--; {p++; cs = 27; goto _out;} }
1530
+ goto st27;
1531
+ st27:
1532
+ if ( ++p == pe )
1533
+ goto _test_eof27;
1534
+ case 27:
1535
+ #line 1536 "edn_parser.cc"
1536
+ switch( (*p) ) {
1537
+ case 10: goto tr10;
1538
+ case 32: goto tr28;
1539
+ case 44: goto tr28;
1540
+ case 59: goto st3;
1541
+ }
1542
+ if ( 9 <= (*p) && (*p) <= 13 )
1543
+ goto tr28;
1544
+ goto st0;
1545
+ st3:
1546
+ if ( ++p == pe )
1547
+ goto _test_eof3;
1548
+ case 3:
1549
+ if ( (*p) == 10 )
1550
+ goto tr10;
1551
+ goto st3;
1552
+ tr29:
1553
+ #line 53 "edn_parser.rl"
1554
+ { p--; {p++; cs = 28; goto _out;} }
1555
+ goto st28;
1556
+ st28:
1557
+ if ( ++p == pe )
1558
+ goto _test_eof28;
1559
+ case 28:
1560
+ #line 1561 "edn_parser.cc"
1561
+ goto st0;
1562
+ st29:
1563
+ if ( ++p == pe )
1564
+ goto _test_eof29;
1565
+ case 29:
1566
+ switch( (*p) ) {
1567
+ case 10: goto tr10;
1568
+ case 32: goto tr28;
1569
+ case 41: goto tr29;
1570
+ case 44: goto tr28;
1571
+ case 59: goto st3;
1572
+ case 97: goto st4;
1573
+ case 125: goto tr29;
1574
+ }
1575
+ if ( (*p) > 13 ) {
1576
+ if ( 92 <= (*p) && (*p) <= 93 )
1577
+ goto tr29;
1578
+ } else if ( (*p) >= 9 )
1579
+ goto tr28;
1379
1580
  goto st0;
1380
1581
  st4:
1381
1582
  if ( ++p == pe )
1382
1583
  goto _test_eof4;
1383
1584
  case 4:
1384
- switch( (*p) ) {
1385
- case 10: goto tr7;
1386
- case 32: goto tr6;
1387
- case 44: goto tr6;
1388
- case 59: goto tr8;
1389
- case 92: goto st0;
1390
- }
1391
- if ( (*p) < 65 ) {
1392
- if ( 9 <= (*p) && (*p) <= 13 )
1393
- goto tr6;
1394
- } else if ( (*p) > 90 ) {
1395
- if ( 97 <= (*p) && (*p) <= 122 )
1396
- goto st4;
1397
- } else
1398
- goto st4;
1399
- goto tr5;
1400
- tr5:
1401
- #line 58 "edn_parser.rl"
1402
- { p--; {p++; cs = 5; goto _out;} }
1403
- goto st5;
1585
+ if ( (*p) == 99 )
1586
+ goto st5;
1587
+ goto st0;
1404
1588
  st5:
1405
1589
  if ( ++p == pe )
1406
1590
  goto _test_eof5;
1407
1591
  case 5:
1408
- #line 1409 "edn_parser.cc"
1592
+ if ( (*p) == 107 )
1593
+ goto st6;
1409
1594
  goto st0;
1410
- tr4:
1411
- #line 20 "edn_parser.rl"
1412
- { line_number++; }
1413
- goto st6;
1414
- tr6:
1415
- #line 58 "edn_parser.rl"
1416
- { p--; {p++; cs = 6; goto _out;} }
1417
- goto st6;
1418
- tr7:
1419
- #line 20 "edn_parser.rl"
1420
- { line_number++; }
1421
- #line 58 "edn_parser.rl"
1422
- { p--; {p++; cs = 6; goto _out;} }
1423
- goto st6;
1424
1595
  st6:
1425
1596
  if ( ++p == pe )
1426
1597
  goto _test_eof6;
1427
1598
  case 6:
1428
- #line 1429 "edn_parser.cc"
1429
- switch( (*p) ) {
1430
- case 10: goto tr7;
1431
- case 32: goto tr6;
1432
- case 44: goto tr6;
1433
- case 59: goto tr8;
1434
- case 92: goto st0;
1435
- }
1436
- if ( (*p) < 65 ) {
1437
- if ( 9 <= (*p) && (*p) <= 13 )
1438
- goto tr6;
1439
- } else if ( (*p) > 90 ) {
1440
- if ( 97 <= (*p) && (*p) <= 122 )
1441
- goto st0;
1442
- } else
1443
- goto st0;
1444
- goto tr5;
1445
- tr8:
1446
- #line 58 "edn_parser.rl"
1447
- { p--; {p++; cs = 7; goto _out;} }
1448
- goto st7;
1599
+ if ( (*p) == 115 )
1600
+ goto st7;
1601
+ goto st0;
1449
1602
  st7:
1450
1603
  if ( ++p == pe )
1451
1604
  goto _test_eof7;
1452
1605
  case 7:
1453
- #line 1454 "edn_parser.cc"
1454
- if ( (*p) == 10 )
1455
- goto tr4;
1456
- goto st3;
1457
- st3:
1606
+ if ( (*p) == 112 )
1607
+ goto st8;
1608
+ goto st0;
1609
+ st8:
1458
1610
  if ( ++p == pe )
1459
- goto _test_eof3;
1460
- case 3:
1461
- if ( (*p) == 10 )
1462
- goto tr4;
1463
- goto st3;
1611
+ goto _test_eof8;
1612
+ case 8:
1613
+ if ( (*p) == 97 )
1614
+ goto st9;
1615
+ goto st0;
1616
+ st9:
1617
+ if ( ++p == pe )
1618
+ goto _test_eof9;
1619
+ case 9:
1620
+ if ( (*p) == 99 )
1621
+ goto st10;
1622
+ goto st0;
1623
+ st10:
1624
+ if ( ++p == pe )
1625
+ goto _test_eof10;
1626
+ case 10:
1627
+ if ( (*p) == 101 )
1628
+ goto st26;
1629
+ goto st0;
1630
+ st30:
1631
+ if ( ++p == pe )
1632
+ goto _test_eof30;
1633
+ case 30:
1634
+ switch( (*p) ) {
1635
+ case 10: goto tr10;
1636
+ case 32: goto tr28;
1637
+ case 41: goto tr29;
1638
+ case 44: goto tr28;
1639
+ case 59: goto st3;
1640
+ case 111: goto st11;
1641
+ case 125: goto tr29;
1642
+ }
1643
+ if ( (*p) > 13 ) {
1644
+ if ( 92 <= (*p) && (*p) <= 93 )
1645
+ goto tr29;
1646
+ } else if ( (*p) >= 9 )
1647
+ goto tr28;
1648
+ goto st0;
1649
+ st11:
1650
+ if ( ++p == pe )
1651
+ goto _test_eof11;
1652
+ case 11:
1653
+ if ( (*p) == 114 )
1654
+ goto st12;
1655
+ goto st0;
1656
+ st12:
1657
+ if ( ++p == pe )
1658
+ goto _test_eof12;
1659
+ case 12:
1660
+ if ( (*p) == 109 )
1661
+ goto st13;
1662
+ goto st0;
1663
+ st13:
1664
+ if ( ++p == pe )
1665
+ goto _test_eof13;
1666
+ case 13:
1667
+ if ( (*p) == 102 )
1668
+ goto st14;
1669
+ goto st0;
1670
+ st14:
1671
+ if ( ++p == pe )
1672
+ goto _test_eof14;
1673
+ case 14:
1674
+ if ( (*p) == 101 )
1675
+ goto st15;
1676
+ goto st0;
1677
+ st15:
1678
+ if ( ++p == pe )
1679
+ goto _test_eof15;
1680
+ case 15:
1681
+ if ( (*p) == 101 )
1682
+ goto st16;
1683
+ goto st0;
1684
+ st16:
1685
+ if ( ++p == pe )
1686
+ goto _test_eof16;
1687
+ case 16:
1688
+ if ( (*p) == 100 )
1689
+ goto st26;
1690
+ goto st0;
1691
+ st31:
1692
+ if ( ++p == pe )
1693
+ goto _test_eof31;
1694
+ case 31:
1695
+ switch( (*p) ) {
1696
+ case 10: goto tr10;
1697
+ case 32: goto tr28;
1698
+ case 41: goto tr29;
1699
+ case 44: goto tr28;
1700
+ case 59: goto st3;
1701
+ case 101: goto st17;
1702
+ case 125: goto tr29;
1703
+ }
1704
+ if ( (*p) > 13 ) {
1705
+ if ( 92 <= (*p) && (*p) <= 93 )
1706
+ goto tr29;
1707
+ } else if ( (*p) >= 9 )
1708
+ goto tr28;
1709
+ goto st0;
1710
+ st17:
1711
+ if ( ++p == pe )
1712
+ goto _test_eof17;
1713
+ case 17:
1714
+ if ( (*p) == 119 )
1715
+ goto st18;
1716
+ goto st0;
1717
+ st18:
1718
+ if ( ++p == pe )
1719
+ goto _test_eof18;
1720
+ case 18:
1721
+ if ( (*p) == 108 )
1722
+ goto st19;
1723
+ goto st0;
1724
+ st19:
1725
+ if ( ++p == pe )
1726
+ goto _test_eof19;
1727
+ case 19:
1728
+ if ( (*p) == 105 )
1729
+ goto st20;
1730
+ goto st0;
1731
+ st20:
1732
+ if ( ++p == pe )
1733
+ goto _test_eof20;
1734
+ case 20:
1735
+ if ( (*p) == 110 )
1736
+ goto st10;
1737
+ goto st0;
1738
+ st32:
1739
+ if ( ++p == pe )
1740
+ goto _test_eof32;
1741
+ case 32:
1742
+ switch( (*p) ) {
1743
+ case 10: goto tr10;
1744
+ case 32: goto tr28;
1745
+ case 41: goto tr29;
1746
+ case 44: goto tr28;
1747
+ case 59: goto st3;
1748
+ case 101: goto st21;
1749
+ case 125: goto tr29;
1750
+ }
1751
+ if ( (*p) > 13 ) {
1752
+ if ( 92 <= (*p) && (*p) <= 93 )
1753
+ goto tr29;
1754
+ } else if ( (*p) >= 9 )
1755
+ goto tr28;
1756
+ goto st0;
1757
+ st21:
1758
+ if ( ++p == pe )
1759
+ goto _test_eof21;
1760
+ case 21:
1761
+ if ( (*p) == 116 )
1762
+ goto st22;
1763
+ goto st0;
1764
+ st22:
1765
+ if ( ++p == pe )
1766
+ goto _test_eof22;
1767
+ case 22:
1768
+ if ( (*p) == 117 )
1769
+ goto st23;
1770
+ goto st0;
1771
+ st23:
1772
+ if ( ++p == pe )
1773
+ goto _test_eof23;
1774
+ case 23:
1775
+ if ( (*p) == 114 )
1776
+ goto st24;
1777
+ goto st0;
1778
+ st24:
1779
+ if ( ++p == pe )
1780
+ goto _test_eof24;
1781
+ case 24:
1782
+ if ( (*p) == 110 )
1783
+ goto st26;
1784
+ goto st0;
1785
+ st33:
1786
+ if ( ++p == pe )
1787
+ goto _test_eof33;
1788
+ case 33:
1789
+ switch( (*p) ) {
1790
+ case 10: goto tr10;
1791
+ case 32: goto tr28;
1792
+ case 41: goto tr29;
1793
+ case 44: goto tr28;
1794
+ case 59: goto st3;
1795
+ case 112: goto st8;
1796
+ case 125: goto tr29;
1797
+ }
1798
+ if ( (*p) > 13 ) {
1799
+ if ( 92 <= (*p) && (*p) <= 93 )
1800
+ goto tr29;
1801
+ } else if ( (*p) >= 9 )
1802
+ goto tr28;
1803
+ goto st0;
1804
+ st34:
1805
+ if ( ++p == pe )
1806
+ goto _test_eof34;
1807
+ case 34:
1808
+ switch( (*p) ) {
1809
+ case 10: goto tr10;
1810
+ case 32: goto tr28;
1811
+ case 41: goto tr29;
1812
+ case 44: goto tr28;
1813
+ case 59: goto st3;
1814
+ case 97: goto st25;
1815
+ case 125: goto tr29;
1816
+ }
1817
+ if ( (*p) > 13 ) {
1818
+ if ( 92 <= (*p) && (*p) <= 93 )
1819
+ goto tr29;
1820
+ } else if ( (*p) >= 9 )
1821
+ goto tr28;
1822
+ goto st0;
1823
+ st25:
1824
+ if ( ++p == pe )
1825
+ goto _test_eof25;
1826
+ case 25:
1827
+ if ( (*p) == 98 )
1828
+ goto st26;
1829
+ goto st0;
1464
1830
  }
1465
1831
  _test_eof2: cs = 2; goto _test_eof;
1832
+ _test_eof26: cs = 26; goto _test_eof;
1833
+ _test_eof27: cs = 27; goto _test_eof;
1834
+ _test_eof3: cs = 3; goto _test_eof;
1835
+ _test_eof28: cs = 28; goto _test_eof;
1836
+ _test_eof29: cs = 29; goto _test_eof;
1466
1837
  _test_eof4: cs = 4; goto _test_eof;
1467
1838
  _test_eof5: cs = 5; goto _test_eof;
1468
1839
  _test_eof6: cs = 6; goto _test_eof;
1469
1840
  _test_eof7: cs = 7; goto _test_eof;
1470
- _test_eof3: cs = 3; goto _test_eof;
1841
+ _test_eof8: cs = 8; goto _test_eof;
1842
+ _test_eof9: cs = 9; goto _test_eof;
1843
+ _test_eof10: cs = 10; goto _test_eof;
1844
+ _test_eof30: cs = 30; goto _test_eof;
1845
+ _test_eof11: cs = 11; goto _test_eof;
1846
+ _test_eof12: cs = 12; goto _test_eof;
1847
+ _test_eof13: cs = 13; goto _test_eof;
1848
+ _test_eof14: cs = 14; goto _test_eof;
1849
+ _test_eof15: cs = 15; goto _test_eof;
1850
+ _test_eof16: cs = 16; goto _test_eof;
1851
+ _test_eof31: cs = 31; goto _test_eof;
1852
+ _test_eof17: cs = 17; goto _test_eof;
1853
+ _test_eof18: cs = 18; goto _test_eof;
1854
+ _test_eof19: cs = 19; goto _test_eof;
1855
+ _test_eof20: cs = 20; goto _test_eof;
1856
+ _test_eof32: cs = 32; goto _test_eof;
1857
+ _test_eof21: cs = 21; goto _test_eof;
1858
+ _test_eof22: cs = 22; goto _test_eof;
1859
+ _test_eof23: cs = 23; goto _test_eof;
1860
+ _test_eof24: cs = 24; goto _test_eof;
1861
+ _test_eof33: cs = 33; goto _test_eof;
1862
+ _test_eof34: cs = 34; goto _test_eof;
1863
+ _test_eof25: cs = 25; goto _test_eof;
1471
1864
 
1472
1865
  _test_eof: {}
1473
1866
  _out: {}
1474
1867
  }
1475
1868
 
1476
- #line 474 "edn_parser.rl"
1869
+ #line 476 "edn_parser.rl"
1477
1870
 
1478
1871
  if (cs >= EDN_escaped_char_first_final) {
1479
1872
  // convert the escaped value to a character
@@ -1483,7 +1876,7 @@ case 3:
1483
1876
  return p;
1484
1877
  }
1485
1878
  else if (cs == EDN_escaped_char_error) {
1486
- error(__FUNCTION__, *p);
1879
+ error(__FUNCTION__, "unexpected value", *p);
1487
1880
  return pe;
1488
1881
  }
1489
1882
  else if (cs == EDN_escaped_char_en_main) {} // silence ragel warning
@@ -1500,15 +1893,15 @@ case 3:
1500
1893
  //
1501
1894
  //
1502
1895
 
1503
- #line 1504 "edn_parser.cc"
1896
+ #line 1897 "edn_parser.cc"
1504
1897
  static const int EDN_symbol_start = 1;
1505
- static const int EDN_symbol_first_final = 5;
1898
+ static const int EDN_symbol_first_final = 4;
1506
1899
  static const int EDN_symbol_error = 0;
1507
1900
 
1508
1901
  static const int EDN_symbol_en_main = 1;
1509
1902
 
1510
1903
 
1511
- #line 509 "edn_parser.rl"
1904
+ #line 527 "edn_parser.rl"
1512
1905
 
1513
1906
 
1514
1907
 
@@ -1517,127 +1910,110 @@ const char* edn::Parser::parse_symbol(const char *p, const char *pe, VALUE& s)
1517
1910
  int cs;
1518
1911
 
1519
1912
 
1520
- #line 1521 "edn_parser.cc"
1913
+ #line 1914 "edn_parser.cc"
1521
1914
  {
1522
1915
  cs = EDN_symbol_start;
1523
1916
  }
1524
1917
 
1525
- #line 517 "edn_parser.rl"
1918
+ #line 535 "edn_parser.rl"
1526
1919
  const char* p_save = p;
1527
1920
 
1528
- #line 1529 "edn_parser.cc"
1921
+ #line 1922 "edn_parser.cc"
1529
1922
  {
1530
1923
  if ( p == pe )
1531
1924
  goto _test_eof;
1532
- switch ( cs )
1533
- {
1534
- case 1:
1535
- switch( (*p) ) {
1536
- case 33: goto st2;
1537
- case 95: goto st2;
1538
- }
1539
- if ( (*p) < 45 ) {
1540
- if ( (*p) > 38 ) {
1541
- if ( 42 <= (*p) && (*p) <= 43 )
1542
- goto st2;
1543
- } else if ( (*p) >= 36 )
1544
- goto st2;
1545
- } else if ( (*p) > 47 ) {
1546
- if ( (*p) < 65 ) {
1547
- if ( 60 <= (*p) && (*p) <= 63 )
1548
- goto st2;
1549
- } else if ( (*p) > 90 ) {
1550
- if ( 97 <= (*p) && (*p) <= 122 )
1551
- goto st5;
1552
- } else
1553
- goto st5;
1554
- } else
1555
- goto st2;
1556
- goto st0;
1557
- st0:
1558
- cs = 0;
1559
- goto _out;
1560
- st2:
1561
- if ( ++p == pe )
1562
- goto _test_eof2;
1563
- case 2:
1564
- if ( (*p) > 90 ) {
1565
- if ( 97 <= (*p) && (*p) <= 122 )
1566
- goto st5;
1567
- } else if ( (*p) >= 65 )
1568
- goto st5;
1569
- goto st0;
1570
- st5:
1571
- if ( ++p == pe )
1572
- goto _test_eof5;
1573
- case 5:
1925
+ switch ( cs )
1926
+ {
1927
+ case 1:
1574
1928
  switch( (*p) ) {
1575
- case 10: goto tr8;
1576
- case 32: goto tr7;
1577
- case 33: goto st0;
1578
- case 35: goto st5;
1579
- case 39: goto st5;
1580
- case 44: goto tr7;
1581
- case 47: goto st4;
1582
- case 59: goto tr10;
1583
- case 95: goto st5;
1929
+ case 33: goto st4;
1930
+ case 47: goto st9;
1931
+ case 95: goto st4;
1584
1932
  }
1585
1933
  if ( (*p) < 45 ) {
1586
- if ( (*p) < 36 ) {
1587
- if ( 9 <= (*p) && (*p) <= 13 )
1588
- goto tr7;
1589
- } else if ( (*p) > 38 ) {
1934
+ if ( (*p) > 39 ) {
1590
1935
  if ( 42 <= (*p) && (*p) <= 43 )
1591
- goto st0;
1592
- } else
1593
- goto st0;
1594
- } else if ( (*p) > 58 ) {
1936
+ goto st4;
1937
+ } else if ( (*p) >= 36 )
1938
+ goto st4;
1939
+ } else if ( (*p) > 46 ) {
1595
1940
  if ( (*p) < 65 ) {
1596
1941
  if ( 60 <= (*p) && (*p) <= 63 )
1597
- goto st0;
1942
+ goto st4;
1598
1943
  } else if ( (*p) > 90 ) {
1599
1944
  if ( 97 <= (*p) && (*p) <= 122 )
1600
- goto st5;
1945
+ goto st4;
1601
1946
  } else
1602
- goto st5;
1947
+ goto st4;
1603
1948
  } else
1604
- goto st5;
1605
- goto tr6;
1606
- tr6:
1607
- #line 58 "edn_parser.rl"
1608
- { p--; {p++; cs = 6; goto _out;} }
1609
- goto st6;
1610
- st6:
1949
+ goto st4;
1950
+ goto st0;
1951
+ st0:
1952
+ cs = 0;
1953
+ goto _out;
1954
+ st4:
1611
1955
  if ( ++p == pe )
1612
- goto _test_eof6;
1613
- case 6:
1614
- #line 1615 "edn_parser.cc"
1956
+ goto _test_eof4;
1957
+ case 4:
1958
+ switch( (*p) ) {
1959
+ case 10: goto tr9;
1960
+ case 32: goto tr8;
1961
+ case 33: goto st4;
1962
+ case 44: goto tr8;
1963
+ case 47: goto st3;
1964
+ case 59: goto tr11;
1965
+ case 95: goto st4;
1966
+ }
1967
+ if ( (*p) < 42 ) {
1968
+ if ( (*p) > 13 ) {
1969
+ if ( 35 <= (*p) && (*p) <= 39 )
1970
+ goto st4;
1971
+ } else if ( (*p) >= 9 )
1972
+ goto tr8;
1973
+ } else if ( (*p) > 63 ) {
1974
+ if ( (*p) > 90 ) {
1975
+ if ( 97 <= (*p) && (*p) <= 122 )
1976
+ goto st4;
1977
+ } else if ( (*p) >= 65 )
1978
+ goto st4;
1979
+ } else
1980
+ goto st4;
1981
+ goto tr7;
1982
+ tr7:
1983
+ #line 53 "edn_parser.rl"
1984
+ { p--; {p++; cs = 5; goto _out;} }
1985
+ goto st5;
1986
+ st5:
1987
+ if ( ++p == pe )
1988
+ goto _test_eof5;
1989
+ case 5:
1990
+ #line 1991 "edn_parser.cc"
1615
1991
  goto st0;
1616
1992
  tr4:
1617
1993
  #line 20 "edn_parser.rl"
1618
1994
  { line_number++; }
1619
- goto st7;
1620
- tr7:
1621
- #line 58 "edn_parser.rl"
1622
- { p--; {p++; cs = 7; goto _out;} }
1623
- goto st7;
1995
+ goto st6;
1624
1996
  tr8:
1997
+ #line 53 "edn_parser.rl"
1998
+ { p--; {p++; cs = 6; goto _out;} }
1999
+ goto st6;
2000
+ tr9:
1625
2001
  #line 20 "edn_parser.rl"
1626
2002
  { line_number++; }
1627
- #line 58 "edn_parser.rl"
1628
- { p--; {p++; cs = 7; goto _out;} }
1629
- goto st7;
1630
- st7:
2003
+ #line 53 "edn_parser.rl"
2004
+ { p--; {p++; cs = 6; goto _out;} }
2005
+ goto st6;
2006
+ st6:
1631
2007
  if ( ++p == pe )
1632
- goto _test_eof7;
1633
- case 7:
1634
- #line 1635 "edn_parser.cc"
2008
+ goto _test_eof6;
2009
+ case 6:
2010
+ #line 2011 "edn_parser.cc"
1635
2011
  switch( (*p) ) {
1636
- case 10: goto tr8;
1637
- case 32: goto tr7;
2012
+ case 10: goto tr9;
2013
+ case 32: goto tr8;
1638
2014
  case 33: goto st0;
1639
- case 44: goto tr7;
1640
- case 59: goto tr10;
2015
+ case 44: goto tr8;
2016
+ case 59: goto tr11;
1641
2017
  case 95: goto st0;
1642
2018
  }
1643
2019
  if ( (*p) < 42 ) {
@@ -1645,7 +2021,7 @@ case 7:
1645
2021
  if ( 35 <= (*p) && (*p) <= 39 )
1646
2022
  goto st0;
1647
2023
  } else if ( (*p) >= 9 )
1648
- goto tr7;
2024
+ goto tr8;
1649
2025
  } else if ( (*p) > 63 ) {
1650
2026
  if ( (*p) > 90 ) {
1651
2027
  if ( 97 <= (*p) && (*p) <= 122 )
@@ -1654,87 +2030,124 @@ case 7:
1654
2030
  goto st0;
1655
2031
  } else
1656
2032
  goto st0;
1657
- goto tr6;
1658
- tr10:
1659
- #line 58 "edn_parser.rl"
1660
- { p--; {p++; cs = 8; goto _out;} }
1661
- goto st8;
1662
- st8:
2033
+ goto tr7;
2034
+ tr11:
2035
+ #line 53 "edn_parser.rl"
2036
+ { p--; {p++; cs = 7; goto _out;} }
2037
+ goto st7;
2038
+ st7:
1663
2039
  if ( ++p == pe )
1664
- goto _test_eof8;
1665
- case 8:
1666
- #line 1667 "edn_parser.cc"
2040
+ goto _test_eof7;
2041
+ case 7:
2042
+ #line 2043 "edn_parser.cc"
1667
2043
  if ( (*p) == 10 )
1668
2044
  goto tr4;
1669
- goto st3;
1670
- st3:
2045
+ goto st2;
2046
+ st2:
1671
2047
  if ( ++p == pe )
1672
- goto _test_eof3;
1673
- case 3:
2048
+ goto _test_eof2;
2049
+ case 2:
1674
2050
  if ( (*p) == 10 )
1675
2051
  goto tr4;
1676
- goto st3;
1677
- st4:
2052
+ goto st2;
2053
+ st3:
1678
2054
  if ( ++p == pe )
1679
- goto _test_eof4;
1680
- case 4:
1681
- if ( (*p) > 90 ) {
1682
- if ( 97 <= (*p) && (*p) <= 122 )
1683
- goto st9;
1684
- } else if ( (*p) >= 65 )
1685
- goto st9;
2055
+ goto _test_eof3;
2056
+ case 3:
2057
+ switch( (*p) ) {
2058
+ case 33: goto st8;
2059
+ case 47: goto st6;
2060
+ case 95: goto st8;
2061
+ }
2062
+ if ( (*p) < 45 ) {
2063
+ if ( (*p) > 39 ) {
2064
+ if ( 42 <= (*p) && (*p) <= 43 )
2065
+ goto st8;
2066
+ } else if ( (*p) >= 36 )
2067
+ goto st8;
2068
+ } else if ( (*p) > 46 ) {
2069
+ if ( (*p) < 65 ) {
2070
+ if ( 60 <= (*p) && (*p) <= 63 )
2071
+ goto st8;
2072
+ } else if ( (*p) > 90 ) {
2073
+ if ( 97 <= (*p) && (*p) <= 122 )
2074
+ goto st8;
2075
+ } else
2076
+ goto st8;
2077
+ } else
2078
+ goto st8;
1686
2079
  goto st0;
2080
+ st8:
2081
+ if ( ++p == pe )
2082
+ goto _test_eof8;
2083
+ case 8:
2084
+ switch( (*p) ) {
2085
+ case 10: goto tr9;
2086
+ case 32: goto tr8;
2087
+ case 33: goto st8;
2088
+ case 44: goto tr8;
2089
+ case 47: goto st0;
2090
+ case 59: goto tr11;
2091
+ case 95: goto st8;
2092
+ }
2093
+ if ( (*p) < 42 ) {
2094
+ if ( (*p) > 13 ) {
2095
+ if ( 35 <= (*p) && (*p) <= 39 )
2096
+ goto st8;
2097
+ } else if ( (*p) >= 9 )
2098
+ goto tr8;
2099
+ } else if ( (*p) > 63 ) {
2100
+ if ( (*p) > 90 ) {
2101
+ if ( 97 <= (*p) && (*p) <= 122 )
2102
+ goto st8;
2103
+ } else if ( (*p) >= 65 )
2104
+ goto st8;
2105
+ } else
2106
+ goto st8;
2107
+ goto tr7;
1687
2108
  st9:
1688
2109
  if ( ++p == pe )
1689
2110
  goto _test_eof9;
1690
2111
  case 9:
1691
2112
  switch( (*p) ) {
1692
- case 10: goto tr8;
1693
- case 32: goto tr7;
2113
+ case 10: goto tr9;
2114
+ case 32: goto tr8;
1694
2115
  case 33: goto st0;
1695
- case 35: goto st9;
1696
- case 39: goto st9;
1697
- case 44: goto tr7;
1698
- case 47: goto st0;
1699
- case 59: goto tr10;
1700
- case 95: goto st9;
2116
+ case 44: goto tr8;
2117
+ case 47: goto st3;
2118
+ case 59: goto tr11;
2119
+ case 95: goto st0;
1701
2120
  }
1702
- if ( (*p) < 45 ) {
1703
- if ( (*p) < 36 ) {
1704
- if ( 9 <= (*p) && (*p) <= 13 )
1705
- goto tr7;
1706
- } else if ( (*p) > 38 ) {
1707
- if ( 42 <= (*p) && (*p) <= 43 )
1708
- goto st0;
1709
- } else
1710
- goto st0;
1711
- } else if ( (*p) > 58 ) {
1712
- if ( (*p) < 65 ) {
1713
- if ( 60 <= (*p) && (*p) <= 63 )
2121
+ if ( (*p) < 42 ) {
2122
+ if ( (*p) > 13 ) {
2123
+ if ( 35 <= (*p) && (*p) <= 39 )
1714
2124
  goto st0;
1715
- } else if ( (*p) > 90 ) {
2125
+ } else if ( (*p) >= 9 )
2126
+ goto tr8;
2127
+ } else if ( (*p) > 63 ) {
2128
+ if ( (*p) > 90 ) {
1716
2129
  if ( 97 <= (*p) && (*p) <= 122 )
1717
- goto st9;
1718
- } else
1719
- goto st9;
2130
+ goto st0;
2131
+ } else if ( (*p) >= 65 )
2132
+ goto st0;
1720
2133
  } else
1721
- goto st9;
1722
- goto tr6;
2134
+ goto st0;
2135
+ goto tr7;
1723
2136
  }
1724
- _test_eof2: cs = 2; goto _test_eof;
2137
+ _test_eof4: cs = 4; goto _test_eof;
1725
2138
  _test_eof5: cs = 5; goto _test_eof;
1726
2139
  _test_eof6: cs = 6; goto _test_eof;
1727
2140
  _test_eof7: cs = 7; goto _test_eof;
1728
- _test_eof8: cs = 8; goto _test_eof;
2141
+ _test_eof2: cs = 2; goto _test_eof;
1729
2142
  _test_eof3: cs = 3; goto _test_eof;
1730
- _test_eof4: cs = 4; goto _test_eof;
2143
+ _test_eof8: cs = 8; goto _test_eof;
1731
2144
  _test_eof9: cs = 9; goto _test_eof;
1732
2145
 
1733
2146
  _test_eof: {}
1734
2147
  _out: {}
1735
2148
  }
1736
2149
 
1737
- #line 519 "edn_parser.rl"
2150
+ #line 537 "edn_parser.rl"
1738
2151
 
1739
2152
  if (cs >= EDN_symbol_first_final) {
1740
2153
  // copy the symbol text
@@ -1744,8 +2157,7 @@ case 9:
1744
2157
  return p;
1745
2158
  }
1746
2159
  else if (cs == EDN_symbol_error) {
1747
- error(__FUNCTION__, *p);
1748
- return pe;
2160
+ error(__FUNCTION__, "invalid symbol sequence", *p);
1749
2161
  }
1750
2162
  else if (cs == EDN_symbol_en_main) {} // silence ragel warning
1751
2163
  return NULL;
@@ -1760,13 +2172,13 @@ case 9:
1760
2172
  // sets the same array is used)
1761
2173
  //
1762
2174
 
1763
- #line 575 "edn_parser.rl"
2175
+ #line 615 "edn_parser.rl"
1764
2176
 
1765
2177
 
1766
2178
  //
1767
2179
  // vector-specific machine
1768
2180
 
1769
- #line 1770 "edn_parser.cc"
2181
+ #line 2182 "edn_parser.cc"
1770
2182
  static const int EDN_vector_start = 1;
1771
2183
  static const int EDN_vector_first_final = 4;
1772
2184
  static const int EDN_vector_error = 0;
@@ -1774,7 +2186,7 @@ static const int EDN_vector_error = 0;
1774
2186
  static const int EDN_vector_en_main = 1;
1775
2187
 
1776
2188
 
1777
- #line 591 "edn_parser.rl"
2189
+ #line 630 "edn_parser.rl"
1778
2190
 
1779
2191
 
1780
2192
 
@@ -1786,17 +2198,17 @@ const char* edn::Parser::parse_vector(const char *p, const char *pe, VALUE& v)
1786
2198
  static const char* EDN_TYPE = "vector";
1787
2199
 
1788
2200
  int cs;
1789
- VALUE elems = rb_ary_new(); // will store the vector's elements
2201
+ VALUE elems; // will store the vector's elements - allocated in @open_seq
1790
2202
 
1791
2203
 
1792
- #line 1793 "edn_parser.cc"
2204
+ #line 2205 "edn_parser.cc"
1793
2205
  {
1794
2206
  cs = EDN_vector_start;
1795
2207
  }
1796
2208
 
1797
- #line 605 "edn_parser.rl"
2209
+ #line 644 "edn_parser.rl"
1798
2210
 
1799
- #line 1800 "edn_parser.cc"
2211
+ #line 2212 "edn_parser.cc"
1800
2212
  {
1801
2213
  if ( p == pe )
1802
2214
  goto _test_eof;
@@ -1804,10 +2216,10 @@ const char* edn::Parser::parse_vector(const char *p, const char *pe, VALUE& v)
1804
2216
  {
1805
2217
  case 1:
1806
2218
  if ( (*p) == 91 )
1807
- goto st2;
2219
+ goto tr0;
1808
2220
  goto st0;
1809
2221
  tr2:
1810
- #line 51 "edn_parser.rl"
2222
+ #line 46 "edn_parser.rl"
1811
2223
  {
1812
2224
  std::stringstream s;
1813
2225
  s << "unterminated " << EDN_TYPE;
@@ -1815,35 +2227,55 @@ tr2:
1815
2227
  p--; {p++; cs = 0; goto _out;}
1816
2228
  }
1817
2229
  goto st0;
1818
- #line 1819 "edn_parser.cc"
2230
+ #line 2231 "edn_parser.cc"
1819
2231
  st0:
1820
2232
  cs = 0;
1821
2233
  goto _out;
1822
- tr3:
2234
+ tr0:
2235
+ #line 564 "edn_parser.rl"
2236
+ {
2237
+ // sequences store elements in an array, then process it to
2238
+ // convert it to a list, set, or map as needed once the
2239
+ // sequence end is reached
2240
+ elems = rb_ary_new();
2241
+ // additionally, metadata for elements in the sequence may be
2242
+ // carried so we must push a new level in the metadata stack
2243
+ new_meta_list();
2244
+ }
2245
+ goto st2;
2246
+ tr4:
1823
2247
  #line 20 "edn_parser.rl"
1824
2248
  { line_number++; }
1825
2249
  goto st2;
1826
- tr4:
1827
- #line 547 "edn_parser.rl"
2250
+ tr5:
2251
+ #line 579 "edn_parser.rl"
1828
2252
  {
1829
2253
  // reads an item within a sequence (vector, list, map, or
1830
2254
  // set). Regardless of the sequence type, an array of the
1831
2255
  // items is built. Once done, the sequence parser will convert
1832
2256
  // if needed
1833
2257
  VALUE e;
2258
+ std::size_t meta_sz = meta_size();
1834
2259
  const char *np = parse_value(p, pe, e);
1835
- if (np == NULL) {
1836
- p--; {p++; cs = 2; goto _out;}
1837
- } else {
2260
+ if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
1838
2261
  // if there's an entry in the discard list, the current
1839
2262
  // object is not meant to be kept due to a #_ so don't
1840
2263
  // push it into the list of elements
1841
2264
  if (!discard.empty()) {
1842
2265
  discard.pop_back();
1843
2266
  }
1844
- else {
1845
- // otherwise we add it to the list of elements for the
1846
- // corresponding container
2267
+ else if (!meta_empty()) {
2268
+ // check if parse_value added metadata
2269
+ if (meta_size() == meta_sz) {
2270
+ // there's metadata and it didn't increase so
2271
+ // parse_value() read an element we care
2272
+ // about. Bind the metadata to it and add it to
2273
+ // the sequence
2274
+ e = Parser::make_edn_type(EDNT_EXTENDED_VALUE_METHOD, e, ruby_meta());
2275
+ rb_ary_push(elems, e);
2276
+ }
2277
+ } else {
2278
+ // no metadata.. just push it
1847
2279
  rb_ary_push(elems, e);
1848
2280
  }
1849
2281
  {p = (( np))-1;}
@@ -1854,46 +2286,50 @@ st2:
1854
2286
  if ( ++p == pe )
1855
2287
  goto _test_eof2;
1856
2288
  case 2:
1857
- #line 1858 "edn_parser.cc"
2289
+ #line 2290 "edn_parser.cc"
1858
2290
  switch( (*p) ) {
1859
- case 10: goto tr3;
2291
+ case 10: goto tr4;
1860
2292
  case 32: goto st2;
1861
- case 40: goto tr4;
1862
2293
  case 44: goto st2;
1863
2294
  case 59: goto st3;
1864
- case 93: goto tr6;
2295
+ case 93: goto tr7;
1865
2296
  }
1866
2297
  if ( (*p) < 42 ) {
1867
2298
  if ( (*p) > 13 ) {
1868
- if ( 33 <= (*p) && (*p) <= 38 )
1869
- goto tr4;
2299
+ if ( 33 <= (*p) && (*p) <= 40 )
2300
+ goto tr5;
1870
2301
  } else if ( (*p) >= 9 )
1871
2302
  goto st2;
1872
2303
  } else if ( (*p) > 63 ) {
1873
2304
  if ( (*p) > 95 ) {
1874
2305
  if ( 97 <= (*p) && (*p) <= 123 )
1875
- goto tr4;
2306
+ goto tr5;
1876
2307
  } else if ( (*p) >= 65 )
1877
- goto tr4;
2308
+ goto tr5;
1878
2309
  } else
1879
- goto tr4;
2310
+ goto tr5;
1880
2311
  goto tr2;
1881
2312
  st3:
1882
2313
  if ( ++p == pe )
1883
2314
  goto _test_eof3;
1884
2315
  case 3:
1885
2316
  if ( (*p) == 10 )
1886
- goto tr3;
2317
+ goto tr4;
1887
2318
  goto st3;
1888
- tr6:
1889
- #line 58 "edn_parser.rl"
2319
+ tr7:
2320
+ #line 574 "edn_parser.rl"
2321
+ {
2322
+ // remove the current metadata level
2323
+ del_top_meta_list();
2324
+ }
2325
+ #line 53 "edn_parser.rl"
1890
2326
  { p--; {p++; cs = 4; goto _out;} }
1891
2327
  goto st4;
1892
2328
  st4:
1893
2329
  if ( ++p == pe )
1894
2330
  goto _test_eof4;
1895
2331
  case 4:
1896
- #line 1897 "edn_parser.cc"
2332
+ #line 2333 "edn_parser.cc"
1897
2333
  goto st0;
1898
2334
  }
1899
2335
  _test_eof2: cs = 2; goto _test_eof;
@@ -1906,7 +2342,7 @@ case 4:
1906
2342
  switch ( cs ) {
1907
2343
  case 2:
1908
2344
  case 3:
1909
- #line 51 "edn_parser.rl"
2345
+ #line 46 "edn_parser.rl"
1910
2346
  {
1911
2347
  std::stringstream s;
1912
2348
  s << "unterminated " << EDN_TYPE;
@@ -1914,21 +2350,21 @@ case 4:
1914
2350
  p--; {p++; cs = 0; goto _out;}
1915
2351
  }
1916
2352
  break;
1917
- #line 1918 "edn_parser.cc"
2353
+ #line 2354 "edn_parser.cc"
1918
2354
  }
1919
2355
  }
1920
2356
 
1921
2357
  _out: {}
1922
2358
  }
1923
2359
 
1924
- #line 606 "edn_parser.rl"
2360
+ #line 645 "edn_parser.rl"
1925
2361
 
1926
2362
  if (cs >= EDN_vector_first_final) {
1927
2363
  v = elems;
1928
2364
  return p + 1;
1929
2365
  }
1930
2366
  else if (cs == EDN_vector_error) {
1931
- error(__FUNCTION__, *p);
2367
+ error(__FUNCTION__, "vector format error", *p);
1932
2368
  return pe;
1933
2369
  }
1934
2370
  else if (cs == EDN_vector_en_main) {} // silence ragel warning
@@ -1941,7 +2377,7 @@ case 4:
1941
2377
  // list parsing machine
1942
2378
  //
1943
2379
 
1944
- #line 1945 "edn_parser.cc"
2380
+ #line 2381 "edn_parser.cc"
1945
2381
  static const int EDN_list_start = 1;
1946
2382
  static const int EDN_list_first_final = 4;
1947
2383
  static const int EDN_list_error = 0;
@@ -1949,7 +2385,7 @@ static const int EDN_list_error = 0;
1949
2385
  static const int EDN_list_en_main = 1;
1950
2386
 
1951
2387
 
1952
- #line 635 "edn_parser.rl"
2388
+ #line 674 "edn_parser.rl"
1953
2389
 
1954
2390
 
1955
2391
  //
@@ -1960,17 +2396,17 @@ const char* edn::Parser::parse_list(const char *p, const char *pe, VALUE& v)
1960
2396
  static const char* EDN_TYPE = "list";
1961
2397
 
1962
2398
  int cs;
1963
- VALUE elems = rb_ary_new();
2399
+ VALUE elems; // stores the list's elements - allocated in @open_seq
1964
2400
 
1965
2401
 
1966
- #line 1967 "edn_parser.cc"
2402
+ #line 2403 "edn_parser.cc"
1967
2403
  {
1968
2404
  cs = EDN_list_start;
1969
2405
  }
1970
2406
 
1971
- #line 648 "edn_parser.rl"
2407
+ #line 687 "edn_parser.rl"
1972
2408
 
1973
- #line 1974 "edn_parser.cc"
2409
+ #line 2410 "edn_parser.cc"
1974
2410
  {
1975
2411
  if ( p == pe )
1976
2412
  goto _test_eof;
@@ -1978,10 +2414,10 @@ const char* edn::Parser::parse_list(const char *p, const char *pe, VALUE& v)
1978
2414
  {
1979
2415
  case 1:
1980
2416
  if ( (*p) == 40 )
1981
- goto st2;
2417
+ goto tr0;
1982
2418
  goto st0;
1983
2419
  tr2:
1984
- #line 51 "edn_parser.rl"
2420
+ #line 46 "edn_parser.rl"
1985
2421
  {
1986
2422
  std::stringstream s;
1987
2423
  s << "unterminated " << EDN_TYPE;
@@ -1989,35 +2425,55 @@ tr2:
1989
2425
  p--; {p++; cs = 0; goto _out;}
1990
2426
  }
1991
2427
  goto st0;
1992
- #line 1993 "edn_parser.cc"
2428
+ #line 2429 "edn_parser.cc"
1993
2429
  st0:
1994
2430
  cs = 0;
1995
2431
  goto _out;
1996
- tr3:
2432
+ tr0:
2433
+ #line 564 "edn_parser.rl"
2434
+ {
2435
+ // sequences store elements in an array, then process it to
2436
+ // convert it to a list, set, or map as needed once the
2437
+ // sequence end is reached
2438
+ elems = rb_ary_new();
2439
+ // additionally, metadata for elements in the sequence may be
2440
+ // carried so we must push a new level in the metadata stack
2441
+ new_meta_list();
2442
+ }
2443
+ goto st2;
2444
+ tr4:
1997
2445
  #line 20 "edn_parser.rl"
1998
2446
  { line_number++; }
1999
2447
  goto st2;
2000
- tr4:
2001
- #line 547 "edn_parser.rl"
2448
+ tr5:
2449
+ #line 579 "edn_parser.rl"
2002
2450
  {
2003
2451
  // reads an item within a sequence (vector, list, map, or
2004
2452
  // set). Regardless of the sequence type, an array of the
2005
2453
  // items is built. Once done, the sequence parser will convert
2006
2454
  // if needed
2007
2455
  VALUE e;
2456
+ std::size_t meta_sz = meta_size();
2008
2457
  const char *np = parse_value(p, pe, e);
2009
- if (np == NULL) {
2010
- p--; {p++; cs = 2; goto _out;}
2011
- } else {
2458
+ if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
2012
2459
  // if there's an entry in the discard list, the current
2013
2460
  // object is not meant to be kept due to a #_ so don't
2014
2461
  // push it into the list of elements
2015
2462
  if (!discard.empty()) {
2016
2463
  discard.pop_back();
2017
2464
  }
2018
- else {
2019
- // otherwise we add it to the list of elements for the
2020
- // corresponding container
2465
+ else if (!meta_empty()) {
2466
+ // check if parse_value added metadata
2467
+ if (meta_size() == meta_sz) {
2468
+ // there's metadata and it didn't increase so
2469
+ // parse_value() read an element we care
2470
+ // about. Bind the metadata to it and add it to
2471
+ // the sequence
2472
+ e = Parser::make_edn_type(EDNT_EXTENDED_VALUE_METHOD, e, ruby_meta());
2473
+ rb_ary_push(elems, e);
2474
+ }
2475
+ } else {
2476
+ // no metadata.. just push it
2021
2477
  rb_ary_push(elems, e);
2022
2478
  }
2023
2479
  {p = (( np))-1;}
@@ -2028,48 +2484,50 @@ st2:
2028
2484
  if ( ++p == pe )
2029
2485
  goto _test_eof2;
2030
2486
  case 2:
2031
- #line 2032 "edn_parser.cc"
2487
+ #line 2488 "edn_parser.cc"
2032
2488
  switch( (*p) ) {
2033
- case 10: goto tr3;
2489
+ case 10: goto tr4;
2034
2490
  case 32: goto st2;
2035
- case 41: goto tr5;
2491
+ case 41: goto tr6;
2036
2492
  case 44: goto st2;
2037
2493
  case 59: goto st3;
2038
2494
  }
2039
- if ( (*p) < 40 ) {
2495
+ if ( (*p) < 65 ) {
2040
2496
  if ( (*p) > 13 ) {
2041
- if ( 33 <= (*p) && (*p) <= 38 )
2042
- goto tr4;
2497
+ if ( 33 <= (*p) && (*p) <= 63 )
2498
+ goto tr5;
2043
2499
  } else if ( (*p) >= 9 )
2044
2500
  goto st2;
2045
- } else if ( (*p) > 63 ) {
2046
- if ( (*p) < 94 ) {
2047
- if ( 65 <= (*p) && (*p) <= 92 )
2048
- goto tr4;
2049
- } else if ( (*p) > 95 ) {
2501
+ } else if ( (*p) > 92 ) {
2502
+ if ( (*p) > 95 ) {
2050
2503
  if ( 97 <= (*p) && (*p) <= 123 )
2051
- goto tr4;
2052
- } else
2053
- goto tr4;
2504
+ goto tr5;
2505
+ } else if ( (*p) >= 94 )
2506
+ goto tr5;
2054
2507
  } else
2055
- goto tr4;
2508
+ goto tr5;
2056
2509
  goto tr2;
2057
- tr5:
2058
- #line 58 "edn_parser.rl"
2510
+ tr6:
2511
+ #line 574 "edn_parser.rl"
2512
+ {
2513
+ // remove the current metadata level
2514
+ del_top_meta_list();
2515
+ }
2516
+ #line 53 "edn_parser.rl"
2059
2517
  { p--; {p++; cs = 4; goto _out;} }
2060
2518
  goto st4;
2061
2519
  st4:
2062
2520
  if ( ++p == pe )
2063
2521
  goto _test_eof4;
2064
2522
  case 4:
2065
- #line 2066 "edn_parser.cc"
2523
+ #line 2524 "edn_parser.cc"
2066
2524
  goto st0;
2067
2525
  st3:
2068
2526
  if ( ++p == pe )
2069
2527
  goto _test_eof3;
2070
2528
  case 3:
2071
2529
  if ( (*p) == 10 )
2072
- goto tr3;
2530
+ goto tr4;
2073
2531
  goto st3;
2074
2532
  }
2075
2533
  _test_eof2: cs = 2; goto _test_eof;
@@ -2082,7 +2540,7 @@ case 3:
2082
2540
  switch ( cs ) {
2083
2541
  case 2:
2084
2542
  case 3:
2085
- #line 51 "edn_parser.rl"
2543
+ #line 46 "edn_parser.rl"
2086
2544
  {
2087
2545
  std::stringstream s;
2088
2546
  s << "unterminated " << EDN_TYPE;
@@ -2090,17 +2548,19 @@ case 3:
2090
2548
  p--; {p++; cs = 0; goto _out;}
2091
2549
  }
2092
2550
  break;
2093
- #line 2094 "edn_parser.cc"
2551
+ #line 2552 "edn_parser.cc"
2094
2552
  }
2095
2553
  }
2096
2554
 
2097
2555
  _out: {}
2098
2556
  }
2099
2557
 
2100
- #line 649 "edn_parser.rl"
2558
+ #line 688 "edn_parser.rl"
2101
2559
 
2102
2560
  if (cs >= EDN_list_first_final) {
2103
2561
  v = elems;
2562
+ // TODO: replace with this but first figure out why array is not unrolled by EDN::list()
2563
+ // v = Parser::make_edn_type(EDNT_MAKE_LIST_METHOD, elems);
2104
2564
  return p + 1;
2105
2565
  }
2106
2566
  else if (cs == EDN_list_error) {
@@ -2117,7 +2577,7 @@ case 3:
2117
2577
  // hash parsing
2118
2578
  //
2119
2579
 
2120
- #line 2121 "edn_parser.cc"
2580
+ #line 2581 "edn_parser.cc"
2121
2581
  static const int EDN_map_start = 1;
2122
2582
  static const int EDN_map_first_final = 4;
2123
2583
  static const int EDN_map_error = 0;
@@ -2125,7 +2585,7 @@ static const int EDN_map_error = 0;
2125
2585
  static const int EDN_map_en_main = 1;
2126
2586
 
2127
2587
 
2128
- #line 679 "edn_parser.rl"
2588
+ #line 720 "edn_parser.rl"
2129
2589
 
2130
2590
 
2131
2591
 
@@ -2135,18 +2595,18 @@ const char* edn::Parser::parse_map(const char *p, const char *pe, VALUE& v)
2135
2595
 
2136
2596
  int cs;
2137
2597
  // since we don't know whether we're looking at a key or value,
2138
- // initially store all elements in a list
2139
- VALUE elems = rb_ary_new();
2598
+ // initially store all elements in an array (allocated in @open_seq)
2599
+ VALUE elems;
2140
2600
 
2141
2601
 
2142
- #line 2143 "edn_parser.cc"
2602
+ #line 2603 "edn_parser.cc"
2143
2603
  {
2144
2604
  cs = EDN_map_start;
2145
2605
  }
2146
2606
 
2147
- #line 692 "edn_parser.rl"
2607
+ #line 733 "edn_parser.rl"
2148
2608
 
2149
- #line 2150 "edn_parser.cc"
2609
+ #line 2610 "edn_parser.cc"
2150
2610
  {
2151
2611
  if ( p == pe )
2152
2612
  goto _test_eof;
@@ -2154,10 +2614,10 @@ const char* edn::Parser::parse_map(const char *p, const char *pe, VALUE& v)
2154
2614
  {
2155
2615
  case 1:
2156
2616
  if ( (*p) == 123 )
2157
- goto st2;
2617
+ goto tr0;
2158
2618
  goto st0;
2159
2619
  tr2:
2160
- #line 51 "edn_parser.rl"
2620
+ #line 46 "edn_parser.rl"
2161
2621
  {
2162
2622
  std::stringstream s;
2163
2623
  s << "unterminated " << EDN_TYPE;
@@ -2165,35 +2625,55 @@ tr2:
2165
2625
  p--; {p++; cs = 0; goto _out;}
2166
2626
  }
2167
2627
  goto st0;
2168
- #line 2169 "edn_parser.cc"
2628
+ #line 2629 "edn_parser.cc"
2169
2629
  st0:
2170
2630
  cs = 0;
2171
2631
  goto _out;
2172
- tr3:
2632
+ tr0:
2633
+ #line 564 "edn_parser.rl"
2634
+ {
2635
+ // sequences store elements in an array, then process it to
2636
+ // convert it to a list, set, or map as needed once the
2637
+ // sequence end is reached
2638
+ elems = rb_ary_new();
2639
+ // additionally, metadata for elements in the sequence may be
2640
+ // carried so we must push a new level in the metadata stack
2641
+ new_meta_list();
2642
+ }
2643
+ goto st2;
2644
+ tr4:
2173
2645
  #line 20 "edn_parser.rl"
2174
2646
  { line_number++; }
2175
2647
  goto st2;
2176
- tr4:
2177
- #line 547 "edn_parser.rl"
2648
+ tr5:
2649
+ #line 579 "edn_parser.rl"
2178
2650
  {
2179
2651
  // reads an item within a sequence (vector, list, map, or
2180
2652
  // set). Regardless of the sequence type, an array of the
2181
2653
  // items is built. Once done, the sequence parser will convert
2182
2654
  // if needed
2183
2655
  VALUE e;
2656
+ std::size_t meta_sz = meta_size();
2184
2657
  const char *np = parse_value(p, pe, e);
2185
- if (np == NULL) {
2186
- p--; {p++; cs = 2; goto _out;}
2187
- } else {
2658
+ if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
2188
2659
  // if there's an entry in the discard list, the current
2189
2660
  // object is not meant to be kept due to a #_ so don't
2190
2661
  // push it into the list of elements
2191
2662
  if (!discard.empty()) {
2192
2663
  discard.pop_back();
2193
2664
  }
2194
- else {
2195
- // otherwise we add it to the list of elements for the
2196
- // corresponding container
2665
+ else if (!meta_empty()) {
2666
+ // check if parse_value added metadata
2667
+ if (meta_size() == meta_sz) {
2668
+ // there's metadata and it didn't increase so
2669
+ // parse_value() read an element we care
2670
+ // about. Bind the metadata to it and add it to
2671
+ // the sequence
2672
+ e = Parser::make_edn_type(EDNT_EXTENDED_VALUE_METHOD, e, ruby_meta());
2673
+ rb_ary_push(elems, e);
2674
+ }
2675
+ } else {
2676
+ // no metadata.. just push it
2197
2677
  rb_ary_push(elems, e);
2198
2678
  }
2199
2679
  {p = (( np))-1;}
@@ -2204,49 +2684,53 @@ st2:
2204
2684
  if ( ++p == pe )
2205
2685
  goto _test_eof2;
2206
2686
  case 2:
2207
- #line 2208 "edn_parser.cc"
2687
+ #line 2688 "edn_parser.cc"
2208
2688
  switch( (*p) ) {
2209
- case 10: goto tr3;
2689
+ case 10: goto tr4;
2210
2690
  case 32: goto st2;
2211
- case 40: goto tr4;
2212
2691
  case 44: goto st2;
2213
2692
  case 59: goto st3;
2214
- case 125: goto tr6;
2693
+ case 125: goto tr7;
2215
2694
  }
2216
2695
  if ( (*p) < 42 ) {
2217
2696
  if ( (*p) > 13 ) {
2218
- if ( 33 <= (*p) && (*p) <= 38 )
2219
- goto tr4;
2697
+ if ( 33 <= (*p) && (*p) <= 40 )
2698
+ goto tr5;
2220
2699
  } else if ( (*p) >= 9 )
2221
2700
  goto st2;
2222
2701
  } else if ( (*p) > 63 ) {
2223
2702
  if ( (*p) < 94 ) {
2224
2703
  if ( 65 <= (*p) && (*p) <= 92 )
2225
- goto tr4;
2704
+ goto tr5;
2226
2705
  } else if ( (*p) > 95 ) {
2227
2706
  if ( 97 <= (*p) && (*p) <= 123 )
2228
- goto tr4;
2707
+ goto tr5;
2229
2708
  } else
2230
- goto tr4;
2709
+ goto tr5;
2231
2710
  } else
2232
- goto tr4;
2711
+ goto tr5;
2233
2712
  goto tr2;
2234
2713
  st3:
2235
2714
  if ( ++p == pe )
2236
2715
  goto _test_eof3;
2237
2716
  case 3:
2238
2717
  if ( (*p) == 10 )
2239
- goto tr3;
2718
+ goto tr4;
2240
2719
  goto st3;
2241
- tr6:
2242
- #line 58 "edn_parser.rl"
2720
+ tr7:
2721
+ #line 574 "edn_parser.rl"
2722
+ {
2723
+ // remove the current metadata level
2724
+ del_top_meta_list();
2725
+ }
2726
+ #line 53 "edn_parser.rl"
2243
2727
  { p--; {p++; cs = 4; goto _out;} }
2244
2728
  goto st4;
2245
2729
  st4:
2246
2730
  if ( ++p == pe )
2247
2731
  goto _test_eof4;
2248
2732
  case 4:
2249
- #line 2250 "edn_parser.cc"
2733
+ #line 2734 "edn_parser.cc"
2250
2734
  goto st0;
2251
2735
  }
2252
2736
  _test_eof2: cs = 2; goto _test_eof;
@@ -2259,7 +2743,7 @@ case 4:
2259
2743
  switch ( cs ) {
2260
2744
  case 2:
2261
2745
  case 3:
2262
- #line 51 "edn_parser.rl"
2746
+ #line 46 "edn_parser.rl"
2263
2747
  {
2264
2748
  std::stringstream s;
2265
2749
  s << "unterminated " << EDN_TYPE;
@@ -2267,14 +2751,14 @@ case 4:
2267
2751
  p--; {p++; cs = 0; goto _out;}
2268
2752
  }
2269
2753
  break;
2270
- #line 2271 "edn_parser.cc"
2754
+ #line 2755 "edn_parser.cc"
2271
2755
  }
2272
2756
  }
2273
2757
 
2274
2758
  _out: {}
2275
2759
  }
2276
2760
 
2277
- #line 693 "edn_parser.rl"
2761
+ #line 734 "edn_parser.rl"
2278
2762
 
2279
2763
  if (cs >= EDN_map_first_final) {
2280
2764
 
@@ -2310,7 +2794,7 @@ case 4:
2310
2794
  // the remaining data to the correct parser
2311
2795
  //
2312
2796
 
2313
- #line 2314 "edn_parser.cc"
2797
+ #line 2798 "edn_parser.cc"
2314
2798
  static const int EDN_dispatch_start = 1;
2315
2799
  static const int EDN_dispatch_first_final = 2;
2316
2800
  static const int EDN_dispatch_error = 0;
@@ -2318,7 +2802,7 @@ static const int EDN_dispatch_error = 0;
2318
2802
  static const int EDN_dispatch_en_main = 1;
2319
2803
 
2320
2804
 
2321
- #line 757 "edn_parser.rl"
2805
+ #line 798 "edn_parser.rl"
2322
2806
 
2323
2807
 
2324
2808
 
@@ -2327,14 +2811,14 @@ const char* edn::Parser::parse_dispatch(const char *p, const char *pe, VALUE& v)
2327
2811
  int cs;
2328
2812
 
2329
2813
 
2330
- #line 2331 "edn_parser.cc"
2814
+ #line 2815 "edn_parser.cc"
2331
2815
  {
2332
2816
  cs = EDN_dispatch_start;
2333
2817
  }
2334
2818
 
2335
- #line 765 "edn_parser.rl"
2819
+ #line 806 "edn_parser.rl"
2336
2820
 
2337
- #line 2338 "edn_parser.cc"
2821
+ #line 2822 "edn_parser.cc"
2338
2822
  {
2339
2823
  if ( p == pe )
2340
2824
  goto _test_eof;
@@ -2355,40 +2839,40 @@ st0:
2355
2839
  cs = 0;
2356
2840
  goto _out;
2357
2841
  tr0:
2358
- #line 745 "edn_parser.rl"
2842
+ #line 786 "edn_parser.rl"
2359
2843
  {
2360
2844
  // #inst, #uuid, or #user/tag
2361
2845
  const char *np = parse_tagged(p, pe, v);
2362
2846
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
2363
2847
  }
2364
- #line 58 "edn_parser.rl"
2848
+ #line 53 "edn_parser.rl"
2365
2849
  { p--; {p++; cs = 2; goto _out;} }
2366
2850
  goto st2;
2367
2851
  tr2:
2368
- #line 739 "edn_parser.rl"
2852
+ #line 780 "edn_parser.rl"
2369
2853
  {
2370
2854
  // discard token #_
2371
2855
  const char *np = parse_discard(p, pe);
2372
2856
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
2373
2857
  }
2374
- #line 58 "edn_parser.rl"
2858
+ #line 53 "edn_parser.rl"
2375
2859
  { p--; {p++; cs = 2; goto _out;} }
2376
2860
  goto st2;
2377
2861
  tr3:
2378
- #line 733 "edn_parser.rl"
2862
+ #line 774 "edn_parser.rl"
2379
2863
  {
2380
2864
  // #{ }
2381
2865
  const char *np = parse_set(p, pe, v);
2382
2866
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
2383
2867
  }
2384
- #line 58 "edn_parser.rl"
2868
+ #line 53 "edn_parser.rl"
2385
2869
  { p--; {p++; cs = 2; goto _out;} }
2386
2870
  goto st2;
2387
2871
  st2:
2388
2872
  if ( ++p == pe )
2389
2873
  goto _test_eof2;
2390
2874
  case 2:
2391
- #line 2392 "edn_parser.cc"
2875
+ #line 2876 "edn_parser.cc"
2392
2876
  goto st0;
2393
2877
  }
2394
2878
  _test_eof2: cs = 2; goto _test_eof;
@@ -2397,13 +2881,13 @@ case 2:
2397
2881
  _out: {}
2398
2882
  }
2399
2883
 
2400
- #line 766 "edn_parser.rl"
2884
+ #line 807 "edn_parser.rl"
2401
2885
 
2402
2886
  if (cs >= EDN_dispatch_first_final) {
2403
2887
  return p + 1;
2404
2888
  }
2405
2889
  else if (cs == EDN_dispatch_error) {
2406
- error(__FUNCTION__, *p);
2890
+ error(__FUNCTION__, "dispatch extend error", *p);
2407
2891
  return pe;
2408
2892
  }
2409
2893
  else if (cs == EDN_dispatch_en_main) {} // silence ragel warning
@@ -2416,7 +2900,7 @@ case 2:
2416
2900
  // set parsing machine
2417
2901
  //
2418
2902
 
2419
- #line 2420 "edn_parser.cc"
2903
+ #line 2904 "edn_parser.cc"
2420
2904
  static const int EDN_set_start = 1;
2421
2905
  static const int EDN_set_first_final = 4;
2422
2906
  static const int EDN_set_error = 0;
@@ -2424,7 +2908,7 @@ static const int EDN_set_error = 0;
2424
2908
  static const int EDN_set_en_main = 1;
2425
2909
 
2426
2910
 
2427
- #line 795 "edn_parser.rl"
2911
+ #line 836 "edn_parser.rl"
2428
2912
 
2429
2913
 
2430
2914
  //
@@ -2435,17 +2919,17 @@ const char* edn::Parser::parse_set(const char *p, const char *pe, VALUE& v)
2435
2919
  static const char* EDN_TYPE = "set";
2436
2920
 
2437
2921
  int cs;
2438
- VALUE elems = rb_ary_new(); // stored as an array
2922
+ VALUE elems; // holds the set's elements as an array allocated in @open_seq
2439
2923
 
2440
2924
 
2441
- #line 2442 "edn_parser.cc"
2925
+ #line 2926 "edn_parser.cc"
2442
2926
  {
2443
2927
  cs = EDN_set_start;
2444
2928
  }
2445
2929
 
2446
- #line 808 "edn_parser.rl"
2930
+ #line 849 "edn_parser.rl"
2447
2931
 
2448
- #line 2449 "edn_parser.cc"
2932
+ #line 2933 "edn_parser.cc"
2449
2933
  {
2450
2934
  if ( p == pe )
2451
2935
  goto _test_eof;
@@ -2453,10 +2937,10 @@ const char* edn::Parser::parse_set(const char *p, const char *pe, VALUE& v)
2453
2937
  {
2454
2938
  case 1:
2455
2939
  if ( (*p) == 123 )
2456
- goto st2;
2940
+ goto tr0;
2457
2941
  goto st0;
2458
2942
  tr2:
2459
- #line 51 "edn_parser.rl"
2943
+ #line 46 "edn_parser.rl"
2460
2944
  {
2461
2945
  std::stringstream s;
2462
2946
  s << "unterminated " << EDN_TYPE;
@@ -2464,35 +2948,55 @@ tr2:
2464
2948
  p--; {p++; cs = 0; goto _out;}
2465
2949
  }
2466
2950
  goto st0;
2467
- #line 2468 "edn_parser.cc"
2951
+ #line 2952 "edn_parser.cc"
2468
2952
  st0:
2469
2953
  cs = 0;
2470
2954
  goto _out;
2471
- tr3:
2955
+ tr0:
2956
+ #line 564 "edn_parser.rl"
2957
+ {
2958
+ // sequences store elements in an array, then process it to
2959
+ // convert it to a list, set, or map as needed once the
2960
+ // sequence end is reached
2961
+ elems = rb_ary_new();
2962
+ // additionally, metadata for elements in the sequence may be
2963
+ // carried so we must push a new level in the metadata stack
2964
+ new_meta_list();
2965
+ }
2966
+ goto st2;
2967
+ tr4:
2472
2968
  #line 20 "edn_parser.rl"
2473
2969
  { line_number++; }
2474
2970
  goto st2;
2475
- tr4:
2476
- #line 547 "edn_parser.rl"
2971
+ tr5:
2972
+ #line 579 "edn_parser.rl"
2477
2973
  {
2478
2974
  // reads an item within a sequence (vector, list, map, or
2479
2975
  // set). Regardless of the sequence type, an array of the
2480
2976
  // items is built. Once done, the sequence parser will convert
2481
2977
  // if needed
2482
2978
  VALUE e;
2979
+ std::size_t meta_sz = meta_size();
2483
2980
  const char *np = parse_value(p, pe, e);
2484
- if (np == NULL) {
2485
- p--; {p++; cs = 2; goto _out;}
2486
- } else {
2981
+ if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
2487
2982
  // if there's an entry in the discard list, the current
2488
2983
  // object is not meant to be kept due to a #_ so don't
2489
2984
  // push it into the list of elements
2490
2985
  if (!discard.empty()) {
2491
2986
  discard.pop_back();
2492
2987
  }
2493
- else {
2494
- // otherwise we add it to the list of elements for the
2495
- // corresponding container
2988
+ else if (!meta_empty()) {
2989
+ // check if parse_value added metadata
2990
+ if (meta_size() == meta_sz) {
2991
+ // there's metadata and it didn't increase so
2992
+ // parse_value() read an element we care
2993
+ // about. Bind the metadata to it and add it to
2994
+ // the sequence
2995
+ e = Parser::make_edn_type(EDNT_EXTENDED_VALUE_METHOD, e, ruby_meta());
2996
+ rb_ary_push(elems, e);
2997
+ }
2998
+ } else {
2999
+ // no metadata.. just push it
2496
3000
  rb_ary_push(elems, e);
2497
3001
  }
2498
3002
  {p = (( np))-1;}
@@ -2503,49 +3007,53 @@ st2:
2503
3007
  if ( ++p == pe )
2504
3008
  goto _test_eof2;
2505
3009
  case 2:
2506
- #line 2507 "edn_parser.cc"
3010
+ #line 3011 "edn_parser.cc"
2507
3011
  switch( (*p) ) {
2508
- case 10: goto tr3;
3012
+ case 10: goto tr4;
2509
3013
  case 32: goto st2;
2510
- case 40: goto tr4;
2511
3014
  case 44: goto st2;
2512
3015
  case 59: goto st3;
2513
- case 125: goto tr6;
3016
+ case 125: goto tr7;
2514
3017
  }
2515
3018
  if ( (*p) < 42 ) {
2516
3019
  if ( (*p) > 13 ) {
2517
- if ( 33 <= (*p) && (*p) <= 38 )
2518
- goto tr4;
3020
+ if ( 33 <= (*p) && (*p) <= 40 )
3021
+ goto tr5;
2519
3022
  } else if ( (*p) >= 9 )
2520
3023
  goto st2;
2521
3024
  } else if ( (*p) > 63 ) {
2522
3025
  if ( (*p) < 94 ) {
2523
3026
  if ( 65 <= (*p) && (*p) <= 92 )
2524
- goto tr4;
3027
+ goto tr5;
2525
3028
  } else if ( (*p) > 95 ) {
2526
3029
  if ( 97 <= (*p) && (*p) <= 123 )
2527
- goto tr4;
3030
+ goto tr5;
2528
3031
  } else
2529
- goto tr4;
3032
+ goto tr5;
2530
3033
  } else
2531
- goto tr4;
3034
+ goto tr5;
2532
3035
  goto tr2;
2533
3036
  st3:
2534
3037
  if ( ++p == pe )
2535
3038
  goto _test_eof3;
2536
3039
  case 3:
2537
3040
  if ( (*p) == 10 )
2538
- goto tr3;
3041
+ goto tr4;
2539
3042
  goto st3;
2540
- tr6:
2541
- #line 58 "edn_parser.rl"
3043
+ tr7:
3044
+ #line 574 "edn_parser.rl"
3045
+ {
3046
+ // remove the current metadata level
3047
+ del_top_meta_list();
3048
+ }
3049
+ #line 53 "edn_parser.rl"
2542
3050
  { p--; {p++; cs = 4; goto _out;} }
2543
3051
  goto st4;
2544
3052
  st4:
2545
3053
  if ( ++p == pe )
2546
3054
  goto _test_eof4;
2547
3055
  case 4:
2548
- #line 2549 "edn_parser.cc"
3056
+ #line 3057 "edn_parser.cc"
2549
3057
  goto st0;
2550
3058
  }
2551
3059
  _test_eof2: cs = 2; goto _test_eof;
@@ -2558,7 +3066,7 @@ case 4:
2558
3066
  switch ( cs ) {
2559
3067
  case 2:
2560
3068
  case 3:
2561
- #line 51 "edn_parser.rl"
3069
+ #line 46 "edn_parser.rl"
2562
3070
  {
2563
3071
  std::stringstream s;
2564
3072
  s << "unterminated " << EDN_TYPE;
@@ -2566,18 +3074,18 @@ case 4:
2566
3074
  p--; {p++; cs = 0; goto _out;}
2567
3075
  }
2568
3076
  break;
2569
- #line 2570 "edn_parser.cc"
3077
+ #line 3078 "edn_parser.cc"
2570
3078
  }
2571
3079
  }
2572
3080
 
2573
3081
  _out: {}
2574
3082
  }
2575
3083
 
2576
- #line 809 "edn_parser.rl"
3084
+ #line 850 "edn_parser.rl"
2577
3085
 
2578
3086
  if (cs >= EDN_set_first_final) {
2579
3087
  // all elements collected; now convert to a set
2580
- v = Parser::make_ruby_set(elems);
3088
+ v = Parser::make_edn_type(EDNT_MAKE_SET_METHOD, elems);
2581
3089
  return p + 1;
2582
3090
  }
2583
3091
  else if (cs == EDN_set_error) {
@@ -2596,7 +3104,7 @@ case 4:
2596
3104
  // defining a machine to consume items within container delimiters
2597
3105
  //
2598
3106
 
2599
- #line 2600 "edn_parser.cc"
3107
+ #line 3108 "edn_parser.cc"
2600
3108
  static const int EDN_discard_start = 1;
2601
3109
  static const int EDN_discard_first_final = 4;
2602
3110
  static const int EDN_discard_error = 0;
@@ -2604,7 +3112,7 @@ static const int EDN_discard_error = 0;
2604
3112
  static const int EDN_discard_en_main = 1;
2605
3113
 
2606
3114
 
2607
- #line 861 "edn_parser.rl"
3115
+ #line 900 "edn_parser.rl"
2608
3116
 
2609
3117
 
2610
3118
 
@@ -2614,14 +3122,14 @@ const char* edn::Parser::parse_discard(const char *p, const char *pe)
2614
3122
  VALUE v;
2615
3123
 
2616
3124
 
2617
- #line 2618 "edn_parser.cc"
3125
+ #line 3126 "edn_parser.cc"
2618
3126
  {
2619
3127
  cs = EDN_discard_start;
2620
3128
  }
2621
3129
 
2622
- #line 870 "edn_parser.rl"
3130
+ #line 909 "edn_parser.rl"
2623
3131
 
2624
- #line 2625 "edn_parser.cc"
3132
+ #line 3133 "edn_parser.cc"
2625
3133
  {
2626
3134
  if ( p == pe )
2627
3135
  goto _test_eof;
@@ -2632,7 +3140,7 @@ case 1:
2632
3140
  goto st2;
2633
3141
  goto st0;
2634
3142
  tr2:
2635
- #line 851 "edn_parser.rl"
3143
+ #line 890 "edn_parser.rl"
2636
3144
  {
2637
3145
  std::stringstream s;
2638
3146
  s << "discard sequence without element to discard";
@@ -2640,7 +3148,7 @@ tr2:
2640
3148
  p--; {p++; cs = 0; goto _out;}
2641
3149
  }
2642
3150
  goto st0;
2643
- #line 2644 "edn_parser.cc"
3151
+ #line 3152 "edn_parser.cc"
2644
3152
  st0:
2645
3153
  cs = 0;
2646
3154
  goto _out;
@@ -2652,17 +3160,16 @@ st2:
2652
3160
  if ( ++p == pe )
2653
3161
  goto _test_eof2;
2654
3162
  case 2:
2655
- #line 2656 "edn_parser.cc"
3163
+ #line 3164 "edn_parser.cc"
2656
3164
  switch( (*p) ) {
2657
3165
  case 10: goto tr3;
2658
3166
  case 32: goto st2;
2659
- case 40: goto tr4;
2660
3167
  case 44: goto st2;
2661
3168
  case 59: goto st3;
2662
3169
  }
2663
3170
  if ( (*p) < 42 ) {
2664
3171
  if ( (*p) > 13 ) {
2665
- if ( 33 <= (*p) && (*p) <= 38 )
3172
+ if ( 33 <= (*p) && (*p) <= 40 )
2666
3173
  goto tr4;
2667
3174
  } else if ( (*p) >= 9 )
2668
3175
  goto st2;
@@ -2679,27 +3186,25 @@ case 2:
2679
3186
  goto tr4;
2680
3187
  goto tr2;
2681
3188
  tr4:
2682
- #line 838 "edn_parser.rl"
3189
+ #line 879 "edn_parser.rl"
2683
3190
  {
2684
3191
  const char *np = parse_value(p, pe, v);
2685
- if (np) {
2686
- // this token is to be discard it so store it in the
3192
+ if (np == NULL) { p--; {p++; cs = 4; goto _out;} } else {
3193
+ // this token is to be discarded so store it in the
2687
3194
  // discard stack - we really don't need to save it so this
2688
3195
  // could be simplified
2689
3196
  discard.push_back(v);
2690
3197
  {p = (( np))-1;}
2691
- } else {
2692
- p--; {p++; cs = 4; goto _out;}
2693
3198
  }
2694
3199
  }
2695
- #line 58 "edn_parser.rl"
3200
+ #line 53 "edn_parser.rl"
2696
3201
  { p--; {p++; cs = 4; goto _out;} }
2697
3202
  goto st4;
2698
3203
  st4:
2699
3204
  if ( ++p == pe )
2700
3205
  goto _test_eof4;
2701
3206
  case 4:
2702
- #line 2703 "edn_parser.cc"
3207
+ #line 3208 "edn_parser.cc"
2703
3208
  goto st0;
2704
3209
  st3:
2705
3210
  if ( ++p == pe )
@@ -2718,7 +3223,7 @@ case 3:
2718
3223
  {
2719
3224
  switch ( cs ) {
2720
3225
  case 2:
2721
- #line 851 "edn_parser.rl"
3226
+ #line 890 "edn_parser.rl"
2722
3227
  {
2723
3228
  std::stringstream s;
2724
3229
  s << "discard sequence without element to discard";
@@ -2726,14 +3231,14 @@ case 3:
2726
3231
  p--; {p++; cs = 0; goto _out;}
2727
3232
  }
2728
3233
  break;
2729
- #line 2730 "edn_parser.cc"
3234
+ #line 3235 "edn_parser.cc"
2730
3235
  }
2731
3236
  }
2732
3237
 
2733
3238
  _out: {}
2734
3239
  }
2735
3240
 
2736
- #line 871 "edn_parser.rl"
3241
+ #line 910 "edn_parser.rl"
2737
3242
 
2738
3243
  if (cs >= EDN_discard_first_final) {
2739
3244
  return p + 1;
@@ -2764,15 +3269,15 @@ case 3:
2764
3269
  // 2. add parse checks for uuid and inst for better error reporting
2765
3270
  //
2766
3271
 
2767
- #line 2768 "edn_parser.cc"
3272
+ #line 3273 "edn_parser.cc"
2768
3273
  static const int EDN_tagged_start = 1;
2769
- static const int EDN_tagged_first_final = 6;
3274
+ static const int EDN_tagged_first_final = 7;
2770
3275
  static const int EDN_tagged_error = 0;
2771
3276
 
2772
3277
  static const int EDN_tagged_en_main = 1;
2773
3278
 
2774
3279
 
2775
- #line 922 "edn_parser.rl"
3280
+ #line 978 "edn_parser.rl"
2776
3281
 
2777
3282
 
2778
3283
 
@@ -2780,18 +3285,20 @@ const char* edn::Parser::parse_tagged(const char *p, const char *pe, VALUE& v)
2780
3285
  {
2781
3286
  VALUE sym_name = Qnil;
2782
3287
  VALUE data = Qnil;
3288
+ bool sym_ok = false;
3289
+ bool data_ok = false;
2783
3290
 
2784
3291
  int cs;
2785
3292
 
2786
3293
 
2787
- #line 2788 "edn_parser.cc"
3294
+ #line 3295 "edn_parser.cc"
2788
3295
  {
2789
3296
  cs = EDN_tagged_start;
2790
3297
  }
2791
3298
 
2792
- #line 933 "edn_parser.rl"
3299
+ #line 991 "edn_parser.rl"
2793
3300
 
2794
- #line 2795 "edn_parser.cc"
3301
+ #line 3302 "edn_parser.cc"
2795
3302
  {
2796
3303
  if ( p == pe )
2797
3304
  goto _test_eof;
@@ -2808,53 +3315,44 @@ st0:
2808
3315
  cs = 0;
2809
3316
  goto _out;
2810
3317
  tr0:
2811
- #line 909 "edn_parser.rl"
3318
+ #line 957 "edn_parser.rl"
2812
3319
  {
2813
3320
  // parses the symbol portion of the pair
2814
3321
  const char *np = parse_symbol(p, pe, sym_name);
2815
- if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else { {p = (( np))-1;} }
3322
+ if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
3323
+ sym_ok = true;
3324
+ {p = (( np))-1;}
3325
+ }
2816
3326
  }
2817
3327
  goto st2;
2818
3328
  st2:
2819
3329
  if ( ++p == pe )
2820
3330
  goto _test_eof2;
2821
3331
  case 2:
2822
- #line 2823 "edn_parser.cc"
3332
+ #line 3333 "edn_parser.cc"
2823
3333
  switch( (*p) ) {
2824
3334
  case 10: goto tr3;
2825
3335
  case 32: goto st3;
2826
- case 35: goto tr5;
2827
- case 39: goto st2;
3336
+ case 33: goto st2;
2828
3337
  case 44: goto st3;
2829
- case 47: goto tr7;
3338
+ case 47: goto st5;
2830
3339
  case 59: goto st4;
2831
- case 94: goto tr4;
2832
- case 95: goto tr5;
2833
- case 123: goto tr4;
3340
+ case 95: goto st2;
2834
3341
  }
2835
- if ( (*p) < 45 ) {
2836
- if ( (*p) < 33 ) {
2837
- if ( 9 <= (*p) && (*p) <= 13 )
2838
- goto st3;
2839
- } else if ( (*p) > 40 ) {
2840
- if ( 42 <= (*p) && (*p) <= 43 )
2841
- goto tr4;
2842
- } else
2843
- goto tr4;
2844
- } else if ( (*p) > 58 ) {
2845
- if ( (*p) < 65 ) {
2846
- if ( 60 <= (*p) && (*p) <= 63 )
2847
- goto tr4;
2848
- } else if ( (*p) > 90 ) {
2849
- if ( (*p) > 92 ) {
2850
- if ( 97 <= (*p) && (*p) <= 122 )
2851
- goto tr5;
2852
- } else if ( (*p) >= 91 )
2853
- goto tr4;
2854
- } else
2855
- goto tr5;
3342
+ if ( (*p) < 42 ) {
3343
+ if ( (*p) > 13 ) {
3344
+ if ( 35 <= (*p) && (*p) <= 39 )
3345
+ goto st2;
3346
+ } else if ( (*p) >= 9 )
3347
+ goto st3;
3348
+ } else if ( (*p) > 63 ) {
3349
+ if ( (*p) > 90 ) {
3350
+ if ( 97 <= (*p) && (*p) <= 122 )
3351
+ goto st2;
3352
+ } else if ( (*p) >= 65 )
3353
+ goto st2;
2856
3354
  } else
2857
- goto tr5;
3355
+ goto st2;
2858
3356
  goto st0;
2859
3357
  tr3:
2860
3358
  #line 20 "edn_parser.rl"
@@ -2864,47 +3362,49 @@ st3:
2864
3362
  if ( ++p == pe )
2865
3363
  goto _test_eof3;
2866
3364
  case 3:
2867
- #line 2868 "edn_parser.cc"
3365
+ #line 3366 "edn_parser.cc"
2868
3366
  switch( (*p) ) {
2869
3367
  case 10: goto tr3;
2870
3368
  case 32: goto st3;
2871
- case 40: goto tr4;
2872
3369
  case 44: goto st3;
2873
3370
  case 59: goto st4;
2874
3371
  }
2875
3372
  if ( (*p) < 42 ) {
2876
3373
  if ( (*p) > 13 ) {
2877
- if ( 33 <= (*p) && (*p) <= 38 )
2878
- goto tr4;
3374
+ if ( 33 <= (*p) && (*p) <= 40 )
3375
+ goto tr7;
2879
3376
  } else if ( (*p) >= 9 )
2880
3377
  goto st3;
2881
3378
  } else if ( (*p) > 63 ) {
2882
3379
  if ( (*p) < 94 ) {
2883
3380
  if ( 65 <= (*p) && (*p) <= 92 )
2884
- goto tr4;
3381
+ goto tr7;
2885
3382
  } else if ( (*p) > 95 ) {
2886
3383
  if ( 97 <= (*p) && (*p) <= 123 )
2887
- goto tr4;
3384
+ goto tr7;
2888
3385
  } else
2889
- goto tr4;
3386
+ goto tr7;
2890
3387
  } else
2891
- goto tr4;
3388
+ goto tr7;
2892
3389
  goto st0;
2893
- tr4:
2894
- #line 914 "edn_parser.rl"
3390
+ tr7:
3391
+ #line 965 "edn_parser.rl"
2895
3392
  {
2896
3393
  // parses the value portion
2897
3394
  const char *np = parse_value(p, pe, data);
2898
- if (np == NULL) { p--; {p++; cs = 6; goto _out;} } else { {p = (( np))-1;} }
3395
+ if (np == NULL) { p--; {p++; cs = 7; goto _out;} } else {
3396
+ data_ok = true;
3397
+ {p = (( np))-1;}
3398
+ }
2899
3399
  }
2900
- #line 58 "edn_parser.rl"
2901
- { p--; {p++; cs = 6; goto _out;} }
2902
- goto st6;
2903
- st6:
3400
+ #line 53 "edn_parser.rl"
3401
+ { p--; {p++; cs = 7; goto _out;} }
3402
+ goto st7;
3403
+ st7:
2904
3404
  if ( ++p == pe )
2905
- goto _test_eof6;
2906
- case 6:
2907
- #line 2908 "edn_parser.cc"
3405
+ goto _test_eof7;
3406
+ case 7:
3407
+ #line 3408 "edn_parser.cc"
2908
3408
  goto st0;
2909
3409
  st4:
2910
3410
  if ( ++p == pe )
@@ -2913,202 +3413,101 @@ case 4:
2913
3413
  if ( (*p) == 10 )
2914
3414
  goto tr3;
2915
3415
  goto st4;
2916
- tr5:
2917
- #line 914 "edn_parser.rl"
2918
- {
2919
- // parses the value portion
2920
- const char *np = parse_value(p, pe, data);
2921
- if (np == NULL) { p--; {p++; cs = 7; goto _out;} } else { {p = (( np))-1;} }
2922
- }
2923
- #line 58 "edn_parser.rl"
2924
- { p--; {p++; cs = 7; goto _out;} }
2925
- goto st7;
2926
- st7:
2927
- if ( ++p == pe )
2928
- goto _test_eof7;
2929
- case 7:
2930
- #line 2931 "edn_parser.cc"
2931
- switch( (*p) ) {
2932
- case 10: goto tr3;
2933
- case 32: goto st3;
2934
- case 35: goto tr5;
2935
- case 39: goto st2;
2936
- case 44: goto st3;
2937
- case 47: goto tr7;
2938
- case 59: goto st4;
2939
- case 94: goto tr4;
2940
- case 95: goto tr5;
2941
- case 123: goto tr4;
2942
- }
2943
- if ( (*p) < 45 ) {
2944
- if ( (*p) < 33 ) {
2945
- if ( 9 <= (*p) && (*p) <= 13 )
2946
- goto st3;
2947
- } else if ( (*p) > 40 ) {
2948
- if ( 42 <= (*p) && (*p) <= 43 )
2949
- goto tr4;
2950
- } else
2951
- goto tr4;
2952
- } else if ( (*p) > 58 ) {
2953
- if ( (*p) < 65 ) {
2954
- if ( 60 <= (*p) && (*p) <= 63 )
2955
- goto tr4;
2956
- } else if ( (*p) > 90 ) {
2957
- if ( (*p) > 92 ) {
2958
- if ( 97 <= (*p) && (*p) <= 122 )
2959
- goto tr5;
2960
- } else if ( (*p) >= 91 )
2961
- goto tr4;
2962
- } else
2963
- goto tr5;
2964
- } else
2965
- goto tr5;
2966
- goto st0;
2967
- tr7:
2968
- #line 914 "edn_parser.rl"
2969
- {
2970
- // parses the value portion
2971
- const char *np = parse_value(p, pe, data);
2972
- if (np == NULL) { p--; {p++; cs = 8; goto _out;} } else { {p = (( np))-1;} }
2973
- }
2974
- #line 58 "edn_parser.rl"
2975
- { p--; {p++; cs = 8; goto _out;} }
2976
- goto st8;
2977
- st8:
2978
- if ( ++p == pe )
2979
- goto _test_eof8;
2980
- case 8:
2981
- #line 2982 "edn_parser.cc"
2982
- if ( (*p) > 90 ) {
2983
- if ( 97 <= (*p) && (*p) <= 122 )
2984
- goto st5;
2985
- } else if ( (*p) >= 65 )
2986
- goto st5;
2987
- goto st0;
2988
3416
  st5:
2989
3417
  if ( ++p == pe )
2990
3418
  goto _test_eof5;
2991
3419
  case 5:
2992
3420
  switch( (*p) ) {
2993
- case 10: goto tr3;
2994
- case 32: goto st3;
2995
- case 35: goto tr9;
2996
- case 39: goto st5;
2997
- case 44: goto st3;
2998
- case 47: goto tr4;
2999
- case 59: goto st4;
3000
- case 94: goto tr4;
3001
- case 95: goto tr9;
3002
- case 123: goto tr4;
3421
+ case 33: goto st6;
3422
+ case 58: goto st6;
3423
+ case 95: goto st6;
3003
3424
  }
3004
3425
  if ( (*p) < 45 ) {
3005
- if ( (*p) < 33 ) {
3006
- if ( 9 <= (*p) && (*p) <= 13 )
3007
- goto st3;
3008
- } else if ( (*p) > 40 ) {
3426
+ if ( (*p) > 39 ) {
3009
3427
  if ( 42 <= (*p) && (*p) <= 43 )
3010
- goto tr4;
3011
- } else
3012
- goto tr4;
3013
- } else if ( (*p) > 58 ) {
3428
+ goto st6;
3429
+ } else if ( (*p) >= 35 )
3430
+ goto st6;
3431
+ } else if ( (*p) > 46 ) {
3014
3432
  if ( (*p) < 65 ) {
3015
3433
  if ( 60 <= (*p) && (*p) <= 63 )
3016
- goto tr4;
3434
+ goto st6;
3017
3435
  } else if ( (*p) > 90 ) {
3018
- if ( (*p) > 92 ) {
3019
- if ( 97 <= (*p) && (*p) <= 122 )
3020
- goto tr9;
3021
- } else if ( (*p) >= 91 )
3022
- goto tr4;
3436
+ if ( 97 <= (*p) && (*p) <= 122 )
3437
+ goto st6;
3023
3438
  } else
3024
- goto tr9;
3439
+ goto st6;
3025
3440
  } else
3026
- goto tr9;
3441
+ goto st6;
3027
3442
  goto st0;
3028
- tr9:
3029
- #line 914 "edn_parser.rl"
3030
- {
3031
- // parses the value portion
3032
- const char *np = parse_value(p, pe, data);
3033
- if (np == NULL) { p--; {p++; cs = 9; goto _out;} } else { {p = (( np))-1;} }
3034
- }
3035
- #line 58 "edn_parser.rl"
3036
- { p--; {p++; cs = 9; goto _out;} }
3037
- goto st9;
3038
- st9:
3443
+ st6:
3039
3444
  if ( ++p == pe )
3040
- goto _test_eof9;
3041
- case 9:
3042
- #line 3043 "edn_parser.cc"
3445
+ goto _test_eof6;
3446
+ case 6:
3043
3447
  switch( (*p) ) {
3044
3448
  case 10: goto tr3;
3045
3449
  case 32: goto st3;
3046
- case 35: goto tr9;
3047
- case 39: goto st5;
3450
+ case 33: goto st6;
3048
3451
  case 44: goto st3;
3049
- case 47: goto tr4;
3050
3452
  case 59: goto st4;
3051
- case 94: goto tr4;
3052
- case 95: goto tr9;
3053
- case 123: goto tr4;
3453
+ case 95: goto st6;
3054
3454
  }
3055
- if ( (*p) < 45 ) {
3056
- if ( (*p) < 33 ) {
3057
- if ( 9 <= (*p) && (*p) <= 13 )
3058
- goto st3;
3059
- } else if ( (*p) > 40 ) {
3060
- if ( 42 <= (*p) && (*p) <= 43 )
3061
- goto tr4;
3062
- } else
3063
- goto tr4;
3064
- } else if ( (*p) > 58 ) {
3455
+ if ( (*p) < 42 ) {
3456
+ if ( (*p) > 13 ) {
3457
+ if ( 35 <= (*p) && (*p) <= 39 )
3458
+ goto st6;
3459
+ } else if ( (*p) >= 9 )
3460
+ goto st3;
3461
+ } else if ( (*p) > 46 ) {
3065
3462
  if ( (*p) < 65 ) {
3066
- if ( 60 <= (*p) && (*p) <= 63 )
3067
- goto tr4;
3463
+ if ( 48 <= (*p) && (*p) <= 63 )
3464
+ goto st6;
3068
3465
  } else if ( (*p) > 90 ) {
3069
- if ( (*p) > 92 ) {
3070
- if ( 97 <= (*p) && (*p) <= 122 )
3071
- goto tr9;
3072
- } else if ( (*p) >= 91 )
3073
- goto tr4;
3466
+ if ( 97 <= (*p) && (*p) <= 122 )
3467
+ goto st6;
3074
3468
  } else
3075
- goto tr9;
3469
+ goto st6;
3076
3470
  } else
3077
- goto tr9;
3471
+ goto st6;
3078
3472
  goto st0;
3079
3473
  }
3080
3474
  _test_eof2: cs = 2; goto _test_eof;
3081
3475
  _test_eof3: cs = 3; goto _test_eof;
3082
- _test_eof6: cs = 6; goto _test_eof;
3083
- _test_eof4: cs = 4; goto _test_eof;
3084
3476
  _test_eof7: cs = 7; goto _test_eof;
3085
- _test_eof8: cs = 8; goto _test_eof;
3477
+ _test_eof4: cs = 4; goto _test_eof;
3086
3478
  _test_eof5: cs = 5; goto _test_eof;
3087
- _test_eof9: cs = 9; goto _test_eof;
3479
+ _test_eof6: cs = 6; goto _test_eof;
3088
3480
 
3089
3481
  _test_eof: {}
3090
3482
  _out: {}
3091
3483
  }
3092
3484
 
3093
- #line 934 "edn_parser.rl"
3485
+ #line 992 "edn_parser.rl"
3094
3486
 
3095
3487
  if (cs >= EDN_tagged_first_final) {
3096
3488
  //std::cerr << __FUNCTION__ << " parse symbol name as '" << sym_name << "', value is: " << data << std::endl;
3097
3489
 
3490
+ if (!sym_ok || !data_ok) {
3491
+ error(__FUNCTION__, "tagged element symbol error", *p);
3492
+ v = EDNT_EOF_CONST;
3493
+ return NULL;
3494
+ }
3495
+
3098
3496
  try {
3099
3497
  // tagged_element makes a call to ruby which may throw an
3100
3498
  // exception when parsing the data
3101
- v = Parser::tagged_element(sym_name, data);
3499
+ v = Parser::make_edn_type(EDNT_TAGGED_ELEM_METHOD, sym_name, data);
3500
+ return p + 1;
3102
3501
  } catch (std::exception& e) {
3103
3502
  error(__FUNCTION__, e.what());
3104
3503
  return pe;
3105
3504
  }
3106
- return p + 1;
3107
3505
  }
3108
3506
  else if (cs == EDN_tagged_error) {
3109
- return pe;
3507
+ error(__FUNCTION__, "tagged element symbol error", *p);
3110
3508
  }
3111
3509
  else if (cs == EDN_tagged_en_main) {} // silence ragel warning
3510
+ v = EDNT_EOF_CONST;
3112
3511
  return NULL;
3113
3512
  }
3114
3513
 
@@ -3121,7 +3520,7 @@ case 9:
3121
3520
  // useful?
3122
3521
  //
3123
3522
 
3124
- #line 3125 "edn_parser.cc"
3523
+ #line 3524 "edn_parser.cc"
3125
3524
  static const int EDN_meta_start = 1;
3126
3525
  static const int EDN_meta_first_final = 3;
3127
3526
  static const int EDN_meta_error = 0;
@@ -3129,7 +3528,7 @@ static const int EDN_meta_error = 0;
3129
3528
  static const int EDN_meta_en_main = 1;
3130
3529
 
3131
3530
 
3132
- #line 977 "edn_parser.rl"
3531
+ #line 1042 "edn_parser.rl"
3133
3532
 
3134
3533
 
3135
3534
 
@@ -3139,14 +3538,14 @@ const char* edn::Parser::parse_meta(const char *p, const char *pe)
3139
3538
  VALUE v;
3140
3539
 
3141
3540
 
3142
- #line 3143 "edn_parser.cc"
3541
+ #line 3542 "edn_parser.cc"
3143
3542
  {
3144
3543
  cs = EDN_meta_start;
3145
3544
  }
3146
3545
 
3147
- #line 986 "edn_parser.rl"
3546
+ #line 1051 "edn_parser.rl"
3148
3547
 
3149
- #line 3150 "edn_parser.cc"
3548
+ #line 3549 "edn_parser.cc"
3150
3549
  {
3151
3550
  if ( p == pe )
3152
3551
  goto _test_eof;
@@ -3163,11 +3562,9 @@ st2:
3163
3562
  if ( ++p == pe )
3164
3563
  goto _test_eof2;
3165
3564
  case 2:
3166
- if ( (*p) == 40 )
3167
- goto tr2;
3168
3565
  if ( (*p) < 60 ) {
3169
3566
  if ( (*p) < 42 ) {
3170
- if ( 33 <= (*p) && (*p) <= 38 )
3567
+ if ( 33 <= (*p) && (*p) <= 40 )
3171
3568
  goto tr2;
3172
3569
  } else if ( (*p) > 43 ) {
3173
3570
  if ( 45 <= (*p) && (*p) <= 58 )
@@ -3187,19 +3584,19 @@ case 2:
3187
3584
  goto tr2;
3188
3585
  goto st0;
3189
3586
  tr2:
3190
- #line 969 "edn_parser.rl"
3587
+ #line 1034 "edn_parser.rl"
3191
3588
  {
3192
3589
  const char *np = parse_value(p, pe, v);
3193
- if (np) { {p = (( np))-1;} } else { p--; {p++; cs = 3; goto _out;} }
3590
+ if (np == NULL) { p--; {p++; cs = 3; goto _out;} } else { {p = (( np))-1;} }
3194
3591
  }
3195
- #line 58 "edn_parser.rl"
3592
+ #line 53 "edn_parser.rl"
3196
3593
  { p--; {p++; cs = 3; goto _out;} }
3197
3594
  goto st3;
3198
3595
  st3:
3199
3596
  if ( ++p == pe )
3200
3597
  goto _test_eof3;
3201
3598
  case 3:
3202
- #line 3203 "edn_parser.cc"
3599
+ #line 3600 "edn_parser.cc"
3203
3600
  goto st0;
3204
3601
  }
3205
3602
  _test_eof2: cs = 2; goto _test_eof;
@@ -3209,10 +3606,10 @@ case 3:
3209
3606
  _out: {}
3210
3607
  }
3211
3608
 
3212
- #line 987 "edn_parser.rl"
3609
+ #line 1052 "edn_parser.rl"
3213
3610
 
3214
3611
  if (cs >= EDN_meta_first_final) {
3215
- metadata.push_back(v);
3612
+ append_to_meta(v);
3216
3613
  return p + 1;
3217
3614
  }
3218
3615
  else if (cs == EDN_meta_error) {
@@ -3231,7 +3628,7 @@ case 3:
3231
3628
  // top-level, therefore, does not tokenize source stream
3232
3629
  //
3233
3630
 
3234
- #line 3235 "edn_parser.cc"
3631
+ #line 3632 "edn_parser.cc"
3235
3632
  static const int EDN_parser_start = 2;
3236
3633
  static const int EDN_parser_first_final = 2;
3237
3634
  static const int EDN_parser_error = 0;
@@ -3239,25 +3636,25 @@ static const int EDN_parser_error = 0;
3239
3636
  static const int EDN_parser_en_main = 2;
3240
3637
 
3241
3638
 
3242
- #line 1036 "edn_parser.rl"
3639
+ #line 1101 "edn_parser.rl"
3243
3640
 
3244
3641
 
3245
3642
 
3246
3643
  VALUE edn::Parser::parse(const char* src, std::size_t len)
3247
3644
  {
3248
3645
  int cs;
3249
- VALUE result = Qnil;
3646
+ VALUE result = EDNT_EOF_CONST;
3250
3647
 
3251
3648
 
3252
- #line 3253 "edn_parser.cc"
3649
+ #line 3650 "edn_parser.cc"
3253
3650
  {
3254
3651
  cs = EDN_parser_start;
3255
3652
  }
3256
3653
 
3257
- #line 1045 "edn_parser.rl"
3654
+ #line 1110 "edn_parser.rl"
3258
3655
  set_source(src, len);
3259
3656
 
3260
- #line 3261 "edn_parser.cc"
3657
+ #line 3658 "edn_parser.cc"
3261
3658
  {
3262
3659
  if ( p == pe )
3263
3660
  goto _test_eof;
@@ -3268,20 +3665,20 @@ tr1:
3268
3665
  { line_number++; }
3269
3666
  goto st2;
3270
3667
  tr4:
3271
- #line 1013 "edn_parser.rl"
3668
+ #line 1078 "edn_parser.rl"
3272
3669
  {
3273
3670
  // save the count of metadata items before we parse this value
3274
3671
  // so we can determine if we've read another metadata value or
3275
3672
  // an actual data item
3276
- std::size_t meta_size = metadata.size();
3673
+ std::size_t meta_sz = meta_size();
3277
3674
  const char* np = parse_value(p, pe, result);
3278
3675
  if (np == NULL) { {p = (( pe))-1;} {p++; cs = 2; goto _out;} } else {
3279
3676
  // if we have metadata saved and it matches the count we
3280
3677
  // saved before we parsed a value, then we must bind the
3281
3678
  // metadata sequence to it
3282
- if (!metadata.empty() && metadata.size() == meta_size) {
3679
+ if (!meta_empty() && meta_size() == meta_sz) {
3283
3680
  // this will empty the metadata sequence too
3284
- result = bind_meta_to_value(result);
3681
+ result = Parser::make_edn_type(EDNT_EXTENDED_VALUE_METHOD, result, ruby_meta());
3285
3682
  }
3286
3683
  {p = (( np))-1;}
3287
3684
  }
@@ -3291,17 +3688,16 @@ st2:
3291
3688
  if ( ++p == pe )
3292
3689
  goto _test_eof2;
3293
3690
  case 2:
3294
- #line 3295 "edn_parser.cc"
3691
+ #line 3692 "edn_parser.cc"
3295
3692
  switch( (*p) ) {
3296
3693
  case 10: goto tr1;
3297
3694
  case 32: goto st2;
3298
- case 40: goto tr4;
3299
3695
  case 44: goto st2;
3300
3696
  case 59: goto st1;
3301
3697
  }
3302
3698
  if ( (*p) < 42 ) {
3303
3699
  if ( (*p) > 13 ) {
3304
- if ( 33 <= (*p) && (*p) <= 38 )
3700
+ if ( 33 <= (*p) && (*p) <= 40 )
3305
3701
  goto tr4;
3306
3702
  } else if ( (*p) >= 9 )
3307
3703
  goto st2;
@@ -3335,12 +3731,11 @@ case 1:
3335
3731
  _out: {}
3336
3732
  }
3337
3733
 
3338
- #line 1047 "edn_parser.rl"
3734
+ #line 1112 "edn_parser.rl"
3339
3735
 
3340
3736
  if (cs == EDN_parser_error) {
3341
- if (p)
3342
- error(__FUNCTION__, *p);
3343
- return EDNT_EOF;
3737
+ error(__FUNCTION__, *p);
3738
+ return EDNT_EOF_CONST;
3344
3739
  }
3345
3740
  else if (cs == EDN_parser_first_final) {
3346
3741
  p = pe = eof = NULL;
@@ -3354,40 +3749,39 @@ case 1:
3354
3749
  // token-by-token machine
3355
3750
  //
3356
3751
 
3357
- #line 3358 "edn_parser.cc"
3752
+ #line 3753 "edn_parser.cc"
3358
3753
  static const int EDN_tokens_start = 1;
3359
- static const int EDN_tokens_error = 0;
3360
3754
 
3361
3755
  static const int EDN_tokens_en_main = 1;
3362
3756
 
3363
3757
 
3364
- #line 1100 "edn_parser.rl"
3758
+ #line 1166 "edn_parser.rl"
3365
3759
 
3366
3760
 
3367
3761
 
3368
3762
  //
3369
3763
  //
3370
- bool edn::Parser::parse_next(VALUE& value)
3764
+ edn::Parser::eTokenState edn::Parser::parse_next(VALUE& value)
3371
3765
  {
3372
3766
  int cs;
3373
- bool is_value = true;
3767
+ eTokenState state = TOKEN_ERROR;
3374
3768
  // need to track metadada read and bind it to the next value read
3375
3769
  // - but must account for sequences of metadata values
3376
- std::size_t meta_size;
3770
+ std::size_t meta_sz;
3377
3771
 
3378
3772
  // clear any previously saved discards; only track if read during
3379
3773
  // this op
3380
3774
  discard.clear();
3381
3775
 
3382
3776
 
3383
- #line 3384 "edn_parser.cc"
3777
+ #line 3778 "edn_parser.cc"
3384
3778
  {
3385
3779
  cs = EDN_tokens_start;
3386
3780
  }
3387
3781
 
3388
- #line 1118 "edn_parser.rl"
3782
+ #line 1184 "edn_parser.rl"
3389
3783
 
3390
- #line 3391 "edn_parser.cc"
3784
+ #line 3785 "edn_parser.cc"
3391
3785
  {
3392
3786
  if ( p == pe )
3393
3787
  goto _test_eof;
@@ -3401,17 +3795,16 @@ st1:
3401
3795
  if ( ++p == pe )
3402
3796
  goto _test_eof1;
3403
3797
  case 1:
3404
- #line 3405 "edn_parser.cc"
3798
+ #line 3799 "edn_parser.cc"
3405
3799
  switch( (*p) ) {
3406
3800
  case 10: goto tr2;
3407
3801
  case 32: goto st1;
3408
- case 40: goto tr3;
3409
3802
  case 44: goto st1;
3410
3803
  case 59: goto st3;
3411
3804
  }
3412
3805
  if ( (*p) < 42 ) {
3413
3806
  if ( (*p) > 13 ) {
3414
- if ( 33 <= (*p) && (*p) <= 38 )
3807
+ if ( 33 <= (*p) && (*p) <= 40 )
3415
3808
  goto tr3;
3416
3809
  } else if ( (*p) >= 9 )
3417
3810
  goto st1;
@@ -3435,31 +3828,33 @@ tr6:
3435
3828
  { line_number++; }
3436
3829
  goto st4;
3437
3830
  tr3:
3438
- #line 1070 "edn_parser.rl"
3831
+ #line 1134 "edn_parser.rl"
3439
3832
  {
3440
3833
  // we won't know if we've parsed a discard or a metadata until
3441
3834
  // after parse_value() is done. Save the current number of
3442
3835
  // elements in the metadata sequence; then we can check if it
3443
3836
  // grew or if the discard sequence grew
3444
- meta_size = metadata.size();
3837
+ meta_sz = meta_size();
3445
3838
 
3446
3839
  const char* np = parse_value(p, pe, value);
3447
-
3448
3840
  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;
3841
+ if (!meta_empty()) {
3842
+ // was an additional metadata entry read? if so, don't
3843
+ // return a value
3844
+ if (meta_size() > meta_sz) {
3845
+ state = TOKEN_IS_META;
3454
3846
  }
3455
3847
  else {
3456
3848
  // a value was read and there's a pending metadata
3457
3849
  // sequence. Bind them.
3458
- value = bind_meta_to_value(value);
3850
+ value = Parser::make_edn_type(EDNT_EXTENDED_VALUE_METHOD, value, ruby_meta());
3851
+ state = TOKEN_OK;
3459
3852
  }
3460
3853
  } else if (!discard.empty()) {
3461
3854
  // a discard read. Don't return a value
3462
- is_value = false;
3855
+ state = TOKEN_IS_DISCARD;
3856
+ } else {
3857
+ state = TOKEN_OK;
3463
3858
  }
3464
3859
  {p = (( np))-1;}
3465
3860
  }
@@ -3469,7 +3864,7 @@ st4:
3469
3864
  if ( ++p == pe )
3470
3865
  goto _test_eof4;
3471
3866
  case 4:
3472
- #line 3473 "edn_parser.cc"
3867
+ #line 3868 "edn_parser.cc"
3473
3868
  switch( (*p) ) {
3474
3869
  case 10: goto tr6;
3475
3870
  case 32: goto st4;
@@ -3503,14 +3898,10 @@ case 3:
3503
3898
  _out: {}
3504
3899
  }
3505
3900
 
3506
- #line 1119 "edn_parser.rl"
3507
-
3508
- if (cs == EDN_parser_error) {
3509
- value = EDNT_EOF;
3510
- }
3511
- else if (cs == EDN_tokens_en_main) {} // silence ragel warning
3901
+ #line 1185 "edn_parser.rl"
3512
3902
 
3513
- return is_value;
3903
+ if (cs == EDN_tokens_en_main) {} // silence ragel warning
3904
+ return state;
3514
3905
  }
3515
3906
 
3516
3907