edn_turbo 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a70e4427453a794f2ccaac6034998708b9784a7d
4
- data.tar.gz: d7fe39621793765d1aabe054d68fe11ecaf39efa
3
+ metadata.gz: 3bedae4e49919f1fb8b5eb7ac3438288353ba840
4
+ data.tar.gz: a1685384d17a698d5ea050aa5557e7106be81c21
5
5
  SHA512:
6
- metadata.gz: dbe5d42a67406237809cae635bd33d036a33fdf936fce7e2d80e767f4094ad7e056d5a4e6097c723a7177156e1064aed090b862985d319111bda1a613b585d14
7
- data.tar.gz: c8dd167e57663ab45837b89dd6034b8e151f5d1b18d6abd853fb1dc842473a1267bdadc3c01aa8a9063fd9aa43df50dfd568088aef12844e3f103ccdfb214f52
6
+ metadata.gz: 762c77382240141aaab80528a5fae3865d789a7740401215320b9416d078df72acaea10512fe0a9967307ab997ed4c68a0fb9bcf2d71248bac8155811ddfcea0
7
+ data.tar.gz: 644544230a2dcceb3139fedf9d83071c13b653746f40e041a512bdf8de5797d35890516aeaa15ae6059322c960038eabce3636e332ccefe8c9403e9abfc563c5
data/README.md CHANGED
@@ -18,13 +18,13 @@ and `edn_turbo` (see [issue 12](https://github.com/relevance/edn-ruby/issues/12)
18
18
  irb(main):004:0> s = "[{\"x\" {\"id\" \"/model/952\", \"model_name\" \"person\", \"ancestors\" [\"record\" \"asset\"], \"format\" \"edn\"}, \"id\" 952, \"name\" nil, \"model_name\" \"person\", \"rel\" {}, \"description\" nil, \"age\" nil, \"updated_at\" nil, \"created_at\" nil, \"anniversary\" nil, \"job\" nil, \"start_date\" nil, \"username\" nil, \"vacation_start\" nil, \"vacation_end\" nil, \"expenses\" nil, \"rate\" nil, \"display_name\" nil, \"gross_profit_per_month\" nil}]"
19
19
  => "[{\"x\" {\"id\" \"/model/952\", \"model_name\" \"person\", \"ancestors\" [\"record\" \"asset\"], \"format\" \"edn\"}, \"id\" 952, \"name\" nil, \"model_name\" \"person\", \"rel\" {}, \"description\" nil, \"age\" nil, \"updated_at\" nil, \"created_at\" nil, \"anniversary\" nil, \"job\" nil, \"start_date\" nil, \"username\" nil, \"vacation_start\" nil, \"vacation_end\" nil, \"expenses\" nil, \"rate\" nil, \"display_name\" nil, \"gross_profit_per_month\" nil}]"
20
20
  irb(main):005:0> Benchmark.realtime { 100.times { EDN::read(s) } }
21
- => 0.08602
21
+ => 0.078503
22
22
  irb(main):006:0> Benchmark.realtime { 100.times { EDNT::read(s) } }
23
- => 0.005923
23
+ => 0.002669
24
24
  irb(main):007:0> Benchmark.realtime { 100000.times { EDN::read(s) } }
25
- => 81.185499
25
+ => 75.219344
26
26
  irb(main):008:0> Benchmark.realtime { 100000.times { EDNT::read(s) } }
27
- => 3.929506
27
+ => 2.560593
28
28
  ```
29
29
 
30
30
  Dependencies
@@ -33,15 +33,25 @@ Dependencies
33
33
  - ruby gems:
34
34
  - [rake 10.3.2](http://rake.rubyforge.org)
35
35
  - [rake-compiler 0.9.2](http://rake-compiler.rubyforge.org)
36
- - [rice 1.7.0](http://rice.rubyforge.org)
37
36
  - [edn 1.0.7](https://github.com/relevance/edn-ruby)
38
37
  - [icu4c](http://icu-project.org/apiref/icu4c/)
39
38
 
40
- `edn_turbo` uses a ragel-based parser but the generated .cc file is
41
- bundled so ragel should not need to be installed.
39
+
40
+ Notes:
41
+ ------
42
+
43
+ - `edn_turbo` uses a ragel-based parser but the generated .cc file is
44
+ bundled so ragel should not need to be installed.
45
+
46
+ - As of 0.3.0, [rice](http://rice.rubyforge.org) is no longer
47
+ required.
48
+
42
49
 
43
50
  Usage
44
51
  =====
52
+
53
+ Simlar to `edn-ruby`:
54
+
45
55
  ```ruby
46
56
  require 'edn_turbo'
47
57
 
@@ -49,10 +59,45 @@ Usage
49
59
  output = EDNT.read(file)
50
60
  pp output if output != nil
51
61
  end
62
+
63
+ # also accepts a string
64
+ pp EDNT.read("[ 1 2 3 abc ]")
65
+
66
+ ```
67
+
68
+ Or instantiate and reuse an instance of a parser:
69
+
70
+ ```ruby
71
+ require 'edn_turbo'
72
+
73
+ p = EDNT::Parser.new
74
+ File.open(filename) do |file|
75
+ output = p.parse(file)
76
+ pp output if output != nil
77
+ end
78
+
79
+ # with a string
80
+ pp p.parse("[ 1 2 3 abc ]")
81
+
82
+
83
+ # set new input
84
+ s = "(1) :abc { 1 2 }"
85
+ p.set_input(s)
86
+
87
+ # parse token by token
88
+ loop do
89
+ t = p.read
90
+ break if t == EDNT::EOF
91
+
92
+ pp t
93
+ end
52
94
  ```
53
95
 
96
+
54
97
  Known problems
55
98
  ==============
56
- v0.2.2:
99
+ v0.3.0:
57
100
 
58
- - Need to emulate EDN::Reader.each
101
+ - No checks for valid characters in #uuid or #inst are performed by
102
+ the parser. However, DateTime will throw an error if the date can't
103
+ be parsed and this is reported.
@@ -3,11 +3,7 @@
3
3
  #include <iostream>
4
4
  #include <string>
5
5
  #include <stack>
6
-
7
- #include <rice/Hash.hpp>
8
- #include <rice/Array.hpp>
9
- #include <rice/to_from_ruby.hpp>
10
- #include <rice/Exception.hpp>
6
+ #include <exception>
11
7
 
12
8
  #include "edn_parser.h"
13
9
 
@@ -20,7 +16,7 @@
20
16
  //
21
17
 
22
18
 
23
- #line 62 "edn_parser.rl"
19
+ #line 58 "edn_parser.rl"
24
20
 
25
21
 
26
22
  // ============================================================
@@ -28,7 +24,7 @@
28
24
  //
29
25
 
30
26
 
31
- #line 32 "edn_parser.cc"
27
+ #line 28 "edn_parser.cc"
32
28
  static const int EDN_value_start = 1;
33
29
  static const int EDN_value_first_final = 2;
34
30
  static const int EDN_value_error = 0;
@@ -36,23 +32,23 @@ static const int EDN_value_error = 0;
36
32
  static const int EDN_value_en_main = 1;
37
33
 
38
34
 
39
- #line 170 "edn_parser.rl"
35
+ #line 167 "edn_parser.rl"
40
36
 
41
37
 
42
38
 
43
- const char *edn::Parser::parse_value(const char *p, const char *pe, Rice::Object& o)
39
+ const char *edn::Parser::parse_value(const char *p, const char *pe, VALUE& v)
44
40
  {
45
41
  int cs;
46
42
 
47
43
 
48
- #line 49 "edn_parser.cc"
44
+ #line 45 "edn_parser.cc"
49
45
  {
50
46
  cs = EDN_value_start;
51
47
  }
52
48
 
53
- #line 178 "edn_parser.rl"
49
+ #line 175 "edn_parser.rl"
54
50
 
55
- #line 56 "edn_parser.cc"
51
+ #line 52 "edn_parser.cc"
56
52
  {
57
53
  if ( p == pe )
58
54
  goto _test_eof;
@@ -94,46 +90,46 @@ st0:
94
90
  cs = 0;
95
91
  goto _out;
96
92
  tr0:
97
- #line 106 "edn_parser.rl"
93
+ #line 102 "edn_parser.rl"
98
94
  {
99
95
  // stand-alone operators *, +, -, etc.
100
- const char *np = parse_operator(p, pe, o);
96
+ const char *np = parse_operator(p, pe, v);
101
97
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
102
98
  }
103
99
  goto st2;
104
100
  tr2:
105
- #line 74 "edn_parser.rl"
101
+ #line 70 "edn_parser.rl"
106
102
  {
107
103
  // string types within double-quotes
108
- const char *np = parse_string(p, pe, o);
104
+ const char *np = parse_string(p, pe, v);
109
105
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
110
106
  }
111
107
  goto st2;
112
108
  tr3:
113
- #line 151 "edn_parser.rl"
109
+ #line 148 "edn_parser.rl"
114
110
  {
115
111
  // handles tokens w/ leading # ("#_", "#{", and tagged elems)
116
- const char *np = parse_dispatch(p + 1, pe, o);
112
+ const char *np = parse_dispatch(p + 1, pe, v);
117
113
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
118
114
  }
119
115
  goto st2;
120
116
  tr4:
121
- #line 139 "edn_parser.rl"
117
+ #line 136 "edn_parser.rl"
122
118
  {
123
119
  // (
124
- const char *np = parse_list(p, pe, o);
120
+ const char *np = parse_list(p, pe, v);
125
121
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
126
122
  }
127
123
  goto st2;
128
124
  tr5:
129
- #line 86 "edn_parser.rl"
125
+ #line 82 "edn_parser.rl"
130
126
  {
131
127
  // tokens w/ leading digits: non-negative integers & decimals.
132
128
  // try to parse a decimal first
133
- const char *np = parse_decimal(p, pe, o);
129
+ const char *np = parse_decimal(p, pe, v);
134
130
  if (np == NULL) {
135
131
  // if we can't, try to parse it as an int
136
- np = parse_integer(p, pe, o);
132
+ np = parse_integer(p, pe, v);
137
133
  }
138
134
 
139
135
  if (np) {
@@ -148,51 +144,52 @@ tr5:
148
144
  }
149
145
  goto st2;
150
146
  tr6:
151
- #line 80 "edn_parser.rl"
147
+ #line 76 "edn_parser.rl"
152
148
  {
153
149
  // tokens with a leading ':'
154
- const char *np = parse_keyword(p, pe, o);
150
+ const char *np = parse_keyword(p, pe, v);
155
151
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
156
152
  }
157
153
  goto st2;
158
154
  tr7:
159
- #line 118 "edn_parser.rl"
155
+ #line 114 "edn_parser.rl"
160
156
  {
161
157
  // user identifiers and reserved keywords (true, false, nil)
162
- std::string sym;
158
+ VALUE sym = Qnil;
163
159
  const char *np = parse_symbol(p, pe, sym);
164
160
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {
165
- if (sym == "true") { o = Qtrue; }
166
- else if (sym == "false") { o = Qfalse; }
167
- else if (sym == "nil") { o = Qnil; }
161
+ // parse_symbol will make 'sym' a ruby string
162
+ if (std::strcmp(RSTRING_PTR(sym), "true") == 0) { v = Qtrue; }
163
+ else if (std::strcmp(RSTRING_PTR(sym), "false") == 0) { v = Qfalse; }
164
+ else if (std::strcmp(RSTRING_PTR(sym), "nil") == 0) { v = Qnil; }
168
165
  else {
169
- o = Parser::make_edn_symbol(sym);
166
+ v = Parser::make_edn_symbol(sym);
170
167
  }
171
168
  {p = (( np))-1;}
172
169
  }
173
170
  }
174
171
  goto st2;
175
172
  tr8:
176
- #line 133 "edn_parser.rl"
173
+ #line 130 "edn_parser.rl"
177
174
  {
178
175
  // [
179
- const char *np = parse_vector(p, pe, o);
176
+ const char *np = parse_vector(p, pe, v);
180
177
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
181
178
  }
182
179
  goto st2;
183
180
  tr9:
184
- #line 112 "edn_parser.rl"
181
+ #line 108 "edn_parser.rl"
185
182
  {
186
183
  // tokens w/ leading \ (escaped characters \newline, \c, etc.)
187
- const char *np = parse_esc_char(p, pe, o);
184
+ const char *np = parse_esc_char(p, pe, v);
188
185
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
189
186
  }
190
187
  goto st2;
191
188
  tr10:
192
- #line 145 "edn_parser.rl"
189
+ #line 142 "edn_parser.rl"
193
190
  {
194
191
  // {
195
- const char *np = parse_map(p, pe, o);
192
+ const char *np = parse_map(p, pe, v);
196
193
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
197
194
  }
198
195
  goto st2;
@@ -200,9 +197,9 @@ st2:
200
197
  if ( ++p == pe )
201
198
  goto _test_eof2;
202
199
  case 2:
203
- #line 61 "edn_parser.rl"
200
+ #line 57 "edn_parser.rl"
204
201
  { p--; {p++; cs = 2; goto _out;} }
205
- #line 206 "edn_parser.cc"
202
+ #line 203 "edn_parser.cc"
206
203
  goto st0;
207
204
  }
208
205
  _test_eof2: cs = 2; goto _test_eof;
@@ -211,7 +208,7 @@ case 2:
211
208
  _out: {}
212
209
  }
213
210
 
214
- #line 179 "edn_parser.rl"
211
+ #line 176 "edn_parser.rl"
215
212
 
216
213
  if (cs >= EDN_value_first_final) {
217
214
  return p;
@@ -233,7 +230,7 @@ case 2:
233
230
  // ascii range is found.
234
231
  //
235
232
 
236
- #line 237 "edn_parser.cc"
233
+ #line 234 "edn_parser.cc"
237
234
  static const int EDN_string_start = 1;
238
235
  static const int EDN_string_first_final = 8;
239
236
  static const int EDN_string_error = 0;
@@ -241,29 +238,27 @@ static const int EDN_string_error = 0;
241
238
  static const int EDN_string_en_main = 1;
242
239
 
243
240
 
244
- #line 224 "edn_parser.rl"
241
+ #line 221 "edn_parser.rl"
245
242
 
246
243
 
247
244
 
248
- const char* edn::Parser::parse_string(const char *p, const char *pe, Rice::Object& o)
245
+ const char* edn::Parser::parse_string(const char *p, const char *pe, VALUE& v)
249
246
  {
250
247
  // std::cerr << __FUNCTION__ << " - p: '" << p << "'" << std::endl;
251
248
  static const char* EDN_TYPE = "string";
252
249
  int cs;
253
250
  bool encode = false;
254
- const char *eof = pe;
255
- Rice::String s;
256
251
 
257
252
 
258
- #line 259 "edn_parser.cc"
253
+ #line 254 "edn_parser.cc"
259
254
  {
260
255
  cs = EDN_string_start;
261
256
  }
262
257
 
263
- #line 237 "edn_parser.rl"
264
- p_save = p;
258
+ #line 232 "edn_parser.rl"
259
+ const char* p_save = p;
265
260
 
266
- #line 267 "edn_parser.cc"
261
+ #line 262 "edn_parser.cc"
267
262
  {
268
263
  if ( p == pe )
269
264
  goto _test_eof;
@@ -274,7 +269,7 @@ case 1:
274
269
  goto st2;
275
270
  goto st0;
276
271
  tr3:
277
- #line 54 "edn_parser.rl"
272
+ #line 50 "edn_parser.rl"
278
273
  {
279
274
  std::stringstream s;
280
275
  s << "unterminated " << EDN_TYPE;
@@ -282,12 +277,12 @@ tr3:
282
277
  p--; {p++; cs = 0; goto _out;}
283
278
  }
284
279
  goto st0;
285
- #line 286 "edn_parser.cc"
280
+ #line 281 "edn_parser.cc"
286
281
  st0:
287
282
  cs = 0;
288
283
  goto _out;
289
284
  tr2:
290
- #line 213 "edn_parser.rl"
285
+ #line 210 "edn_parser.rl"
291
286
  {
292
287
  encode = true;
293
288
  }
@@ -296,7 +291,7 @@ st2:
296
291
  if ( ++p == pe )
297
292
  goto _test_eof2;
298
293
  case 2:
299
- #line 300 "edn_parser.cc"
294
+ #line 295 "edn_parser.cc"
300
295
  switch( (*p) ) {
301
296
  case 34: goto tr4;
302
297
  case 92: goto tr5;
@@ -308,25 +303,25 @@ case 2:
308
303
  goto tr2;
309
304
  goto st2;
310
305
  tr4:
311
- #line 205 "edn_parser.rl"
306
+ #line 202 "edn_parser.rl"
312
307
  {
313
- if (Parser::parse_byte_stream(p_save + 1, p, s, encode)) {
308
+ if (Parser::parse_byte_stream(p_save + 1, p, v, encode)) {
314
309
  {p = (( p + 1))-1;}
315
310
  } else {
316
311
  p--; {p++; cs = 8; goto _out;}
317
312
  }
318
313
  }
319
- #line 61 "edn_parser.rl"
314
+ #line 57 "edn_parser.rl"
320
315
  { p--; {p++; cs = 8; goto _out;} }
321
316
  goto st8;
322
317
  st8:
323
318
  if ( ++p == pe )
324
319
  goto _test_eof8;
325
320
  case 8:
326
- #line 327 "edn_parser.cc"
321
+ #line 322 "edn_parser.cc"
327
322
  goto st0;
328
323
  tr5:
329
- #line 213 "edn_parser.rl"
324
+ #line 210 "edn_parser.rl"
330
325
  {
331
326
  encode = true;
332
327
  }
@@ -335,7 +330,7 @@ st3:
335
330
  if ( ++p == pe )
336
331
  goto _test_eof3;
337
332
  case 3:
338
- #line 339 "edn_parser.cc"
333
+ #line 334 "edn_parser.cc"
339
334
  switch( (*p) ) {
340
335
  case 34: goto tr2;
341
336
  case 47: goto tr2;
@@ -351,7 +346,7 @@ case 3:
351
346
  goto st0;
352
347
  goto st2;
353
348
  tr6:
354
- #line 213 "edn_parser.rl"
349
+ #line 210 "edn_parser.rl"
355
350
  {
356
351
  encode = true;
357
352
  }
@@ -360,7 +355,7 @@ st4:
360
355
  if ( ++p == pe )
361
356
  goto _test_eof4;
362
357
  case 4:
363
- #line 364 "edn_parser.cc"
358
+ #line 359 "edn_parser.cc"
364
359
  if ( (*p) < 65 ) {
365
360
  if ( 48 <= (*p) && (*p) <= 57 )
366
361
  goto tr7;
@@ -371,7 +366,7 @@ case 4:
371
366
  goto tr7;
372
367
  goto st0;
373
368
  tr7:
374
- #line 213 "edn_parser.rl"
369
+ #line 210 "edn_parser.rl"
375
370
  {
376
371
  encode = true;
377
372
  }
@@ -380,7 +375,7 @@ st5:
380
375
  if ( ++p == pe )
381
376
  goto _test_eof5;
382
377
  case 5:
383
- #line 384 "edn_parser.cc"
378
+ #line 379 "edn_parser.cc"
384
379
  if ( (*p) < 65 ) {
385
380
  if ( 48 <= (*p) && (*p) <= 57 )
386
381
  goto tr8;
@@ -391,7 +386,7 @@ case 5:
391
386
  goto tr8;
392
387
  goto st0;
393
388
  tr8:
394
- #line 213 "edn_parser.rl"
389
+ #line 210 "edn_parser.rl"
395
390
  {
396
391
  encode = true;
397
392
  }
@@ -400,7 +395,7 @@ st6:
400
395
  if ( ++p == pe )
401
396
  goto _test_eof6;
402
397
  case 6:
403
- #line 404 "edn_parser.cc"
398
+ #line 399 "edn_parser.cc"
404
399
  if ( (*p) < 65 ) {
405
400
  if ( 48 <= (*p) && (*p) <= 57 )
406
401
  goto tr9;
@@ -411,7 +406,7 @@ case 6:
411
406
  goto tr9;
412
407
  goto st0;
413
408
  tr9:
414
- #line 213 "edn_parser.rl"
409
+ #line 210 "edn_parser.rl"
415
410
  {
416
411
  encode = true;
417
412
  }
@@ -420,7 +415,7 @@ st7:
420
415
  if ( ++p == pe )
421
416
  goto _test_eof7;
422
417
  case 7:
423
- #line 424 "edn_parser.cc"
418
+ #line 419 "edn_parser.cc"
424
419
  if ( (*p) < 65 ) {
425
420
  if ( 48 <= (*p) && (*p) <= 57 )
426
421
  goto tr2;
@@ -444,7 +439,7 @@ case 7:
444
439
  {
445
440
  switch ( cs ) {
446
441
  case 2:
447
- #line 54 "edn_parser.rl"
442
+ #line 50 "edn_parser.rl"
448
443
  {
449
444
  std::stringstream s;
450
445
  s << "unterminated " << EDN_TYPE;
@@ -452,17 +447,16 @@ case 7:
452
447
  p--; {p++; cs = 0; goto _out;}
453
448
  }
454
449
  break;
455
- #line 456 "edn_parser.cc"
450
+ #line 451 "edn_parser.cc"
456
451
  }
457
452
  }
458
453
 
459
454
  _out: {}
460
455
  }
461
456
 
462
- #line 239 "edn_parser.rl"
457
+ #line 234 "edn_parser.rl"
463
458
 
464
459
  if (cs >= EDN_string_first_final) {
465
- o = s;
466
460
  return p + 1;
467
461
  }
468
462
  else if (cs == EDN_string_error) {
@@ -478,7 +472,7 @@ case 7:
478
472
  // keyword parsing
479
473
  //
480
474
 
481
- #line 482 "edn_parser.cc"
475
+ #line 476 "edn_parser.cc"
482
476
  static const int EDN_keyword_start = 1;
483
477
  static const int EDN_keyword_first_final = 3;
484
478
  static const int EDN_keyword_error = 0;
@@ -486,24 +480,24 @@ static const int EDN_keyword_error = 0;
486
480
  static const int EDN_keyword_en_main = 1;
487
481
 
488
482
 
489
- #line 269 "edn_parser.rl"
483
+ #line 263 "edn_parser.rl"
490
484
 
491
485
 
492
486
 
493
- const char* edn::Parser::parse_keyword(const char *p, const char *pe, Rice::Object& o)
487
+ const char* edn::Parser::parse_keyword(const char *p, const char *pe, VALUE& v)
494
488
  {
495
489
  int cs;
496
490
 
497
491
 
498
- #line 499 "edn_parser.cc"
492
+ #line 493 "edn_parser.cc"
499
493
  {
500
494
  cs = EDN_keyword_start;
501
495
  }
502
496
 
503
- #line 277 "edn_parser.rl"
504
- p_save = p;
497
+ #line 271 "edn_parser.rl"
498
+ const char* p_save = p;
505
499
 
506
- #line 507 "edn_parser.cc"
500
+ #line 501 "edn_parser.cc"
507
501
  {
508
502
  if ( p == pe )
509
503
  goto _test_eof;
@@ -558,14 +552,14 @@ case 3:
558
552
  goto st3;
559
553
  goto tr3;
560
554
  tr3:
561
- #line 61 "edn_parser.rl"
555
+ #line 57 "edn_parser.rl"
562
556
  { p--; {p++; cs = 4; goto _out;} }
563
557
  goto st4;
564
558
  st4:
565
559
  if ( ++p == pe )
566
560
  goto _test_eof4;
567
561
  case 4:
568
- #line 569 "edn_parser.cc"
562
+ #line 563 "edn_parser.cc"
569
563
  goto st0;
570
564
  }
571
565
  _test_eof2: cs = 2; goto _test_eof;
@@ -576,14 +570,14 @@ case 4:
576
570
  _out: {}
577
571
  }
578
572
 
579
- #line 279 "edn_parser.rl"
573
+ #line 273 "edn_parser.rl"
580
574
 
581
575
  if (cs >= EDN_keyword_first_final) {
582
576
  std::string buf;
583
577
  uint32_t len = p - p_save;
584
- // don't include leading ':' because Rice::Symbol will handle it
578
+ // don't include leading ':' because the ruby symbol will handle it
585
579
  buf.append(p_save + 1, len - 1);
586
- o = Rice::Symbol(buf);
580
+ v = ID2SYM(rb_intern(buf.c_str()));
587
581
  return p;
588
582
  }
589
583
  else if (cs == EDN_keyword_error) {
@@ -600,31 +594,31 @@ case 4:
600
594
  // decimal parsing machine
601
595
  //
602
596
 
603
- #line 604 "edn_parser.cc"
597
+ #line 598 "edn_parser.cc"
604
598
  static const int EDN_decimal_start = 1;
605
599
  static const int EDN_decimal_first_final = 9;
606
600
 
607
601
  static const int EDN_decimal_en_main = 1;
608
602
 
609
603
 
610
- #line 312 "edn_parser.rl"
604
+ #line 306 "edn_parser.rl"
611
605
 
612
606
 
613
607
 
614
- const char* edn::Parser::parse_decimal(const char *p, const char *pe, Rice::Object& o)
608
+ const char* edn::Parser::parse_decimal(const char *p, const char *pe, VALUE& v)
615
609
  {
616
610
  int cs;
617
611
 
618
612
 
619
- #line 620 "edn_parser.cc"
613
+ #line 614 "edn_parser.cc"
620
614
  {
621
615
  cs = EDN_decimal_start;
622
616
  }
623
617
 
624
- #line 320 "edn_parser.rl"
625
- p_save = p;
618
+ #line 314 "edn_parser.rl"
619
+ const char* p_save = p;
626
620
 
627
- #line 628 "edn_parser.cc"
621
+ #line 622 "edn_parser.cc"
628
622
  {
629
623
  if ( p == pe )
630
624
  goto _test_eof;
@@ -678,14 +672,14 @@ case 9:
678
672
  goto st0;
679
673
  goto tr10;
680
674
  tr10:
681
- #line 61 "edn_parser.rl"
675
+ #line 57 "edn_parser.rl"
682
676
  { p--; {p++; cs = 10; goto _out;} }
683
677
  goto st10;
684
678
  st10:
685
679
  if ( ++p == pe )
686
680
  goto _test_eof10;
687
681
  case 10:
688
- #line 689 "edn_parser.cc"
682
+ #line 683 "edn_parser.cc"
689
683
  goto st0;
690
684
  st4:
691
685
  if ( ++p == pe )
@@ -801,10 +795,10 @@ case 8:
801
795
  _out: {}
802
796
  }
803
797
 
804
- #line 322 "edn_parser.rl"
798
+ #line 316 "edn_parser.rl"
805
799
 
806
800
  if (cs >= EDN_decimal_first_final) {
807
- o = Parser::float_to_ruby(p_save, p - p_save);
801
+ v = Parser::float_to_ruby(p_save, p - p_save);
808
802
  return p + 1;
809
803
  }
810
804
  else if (cs == EDN_decimal_en_main) {} // silence ragel warning
@@ -816,30 +810,30 @@ case 8:
816
810
  // integer parsing machine
817
811
  //
818
812
 
819
- #line 820 "edn_parser.cc"
813
+ #line 814 "edn_parser.cc"
820
814
  static const int EDN_integer_start = 1;
821
815
  static const int EDN_integer_first_final = 3;
822
816
 
823
817
  static const int EDN_integer_en_main = 1;
824
818
 
825
819
 
826
- #line 345 "edn_parser.rl"
820
+ #line 339 "edn_parser.rl"
827
821
 
828
822
 
829
- const char* edn::Parser::parse_integer(const char *p, const char *pe, Rice::Object& o)
823
+ const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
830
824
  {
831
825
  int cs;
832
826
 
833
827
 
834
- #line 835 "edn_parser.cc"
828
+ #line 829 "edn_parser.cc"
835
829
  {
836
830
  cs = EDN_integer_start;
837
831
  }
838
832
 
839
- #line 352 "edn_parser.rl"
840
- p_save = p;
833
+ #line 346 "edn_parser.rl"
834
+ const char* p_save = p;
841
835
 
842
- #line 843 "edn_parser.cc"
836
+ #line 837 "edn_parser.cc"
843
837
  {
844
838
  if ( p == pe )
845
839
  goto _test_eof;
@@ -881,14 +875,14 @@ case 3:
881
875
  goto st0;
882
876
  goto tr4;
883
877
  tr4:
884
- #line 61 "edn_parser.rl"
878
+ #line 57 "edn_parser.rl"
885
879
  { p--; {p++; cs = 4; goto _out;} }
886
880
  goto st4;
887
881
  st4:
888
882
  if ( ++p == pe )
889
883
  goto _test_eof4;
890
884
  case 4:
891
- #line 892 "edn_parser.cc"
885
+ #line 886 "edn_parser.cc"
892
886
  goto st0;
893
887
  st5:
894
888
  if ( ++p == pe )
@@ -929,10 +923,10 @@ case 6:
929
923
  _out: {}
930
924
  }
931
925
 
932
- #line 354 "edn_parser.rl"
926
+ #line 348 "edn_parser.rl"
933
927
 
934
928
  if (cs >= EDN_integer_first_final) {
935
- o = Parser::integer_to_ruby(p_save, p - p_save);
929
+ v = Parser::integer_to_ruby(p_save, p - p_save);
936
930
  return p + 1;
937
931
  }
938
932
  else if (cs == EDN_integer_en_main) {} // silence ragel warning
@@ -949,7 +943,7 @@ case 6:
949
943
  // 3. stand-alone operators: +, -, /, *, etc.
950
944
  //
951
945
 
952
- #line 953 "edn_parser.cc"
946
+ #line 947 "edn_parser.cc"
953
947
  static const int EDN_operator_start = 1;
954
948
  static const int EDN_operator_first_final = 3;
955
949
  static const int EDN_operator_error = 0;
@@ -957,24 +951,24 @@ static const int EDN_operator_error = 0;
957
951
  static const int EDN_operator_en_main = 1;
958
952
 
959
953
 
960
- #line 424 "edn_parser.rl"
954
+ #line 418 "edn_parser.rl"
961
955
 
962
956
 
963
957
 
964
- const char* edn::Parser::parse_operator(const char *p, const char *pe, Rice::Object& o)
958
+ const char* edn::Parser::parse_operator(const char *p, const char *pe, VALUE& v)
965
959
  {
966
960
  int cs;
967
961
 
968
962
 
969
- #line 970 "edn_parser.cc"
963
+ #line 964 "edn_parser.cc"
970
964
  {
971
965
  cs = EDN_operator_start;
972
966
  }
973
967
 
974
- #line 432 "edn_parser.rl"
975
- p_save = p;
968
+ #line 426 "edn_parser.rl"
969
+ const char* p_save = p;
976
970
 
977
- #line 978 "edn_parser.cc"
971
+ #line 972 "edn_parser.cc"
978
972
  {
979
973
  if ( p == pe )
980
974
  goto _test_eof;
@@ -1030,69 +1024,69 @@ case 3:
1030
1024
  goto st0;
1031
1025
  goto tr6;
1032
1026
  tr6:
1033
- #line 411 "edn_parser.rl"
1027
+ #line 405 "edn_parser.rl"
1034
1028
  {
1035
1029
  // stand-alone operators (-, +, /, ... etc)
1036
- std::string sym;
1037
- sym += *(p_save);
1038
- o = Parser::make_edn_symbol(sym);
1030
+ char op[2] = { *p_save, 0 };
1031
+ VALUE sym = rb_str_new2(op);
1032
+ v = Parser::make_edn_symbol(sym);
1039
1033
  }
1040
- #line 61 "edn_parser.rl"
1034
+ #line 57 "edn_parser.rl"
1041
1035
  { p--; {p++; cs = 4; goto _out;} }
1042
1036
  goto st4;
1043
1037
  tr10:
1044
- #line 61 "edn_parser.rl"
1038
+ #line 57 "edn_parser.rl"
1045
1039
  { p--; {p++; cs = 4; goto _out;} }
1046
1040
  goto st4;
1047
1041
  st4:
1048
1042
  if ( ++p == pe )
1049
1043
  goto _test_eof4;
1050
1044
  case 4:
1051
- #line 1052 "edn_parser.cc"
1045
+ #line 1046 "edn_parser.cc"
1052
1046
  goto st0;
1053
1047
  tr5:
1054
- #line 24 "edn_parser.rl"
1048
+ #line 20 "edn_parser.rl"
1055
1049
  { line_number++; }
1056
1050
  goto st5;
1057
1051
  tr7:
1058
- #line 411 "edn_parser.rl"
1052
+ #line 405 "edn_parser.rl"
1059
1053
  {
1060
1054
  // stand-alone operators (-, +, /, ... etc)
1061
- std::string sym;
1062
- sym += *(p_save);
1063
- o = Parser::make_edn_symbol(sym);
1055
+ char op[2] = { *p_save, 0 };
1056
+ VALUE sym = rb_str_new2(op);
1057
+ v = Parser::make_edn_symbol(sym);
1064
1058
  }
1065
- #line 61 "edn_parser.rl"
1059
+ #line 57 "edn_parser.rl"
1066
1060
  { p--; {p++; cs = 5; goto _out;} }
1067
1061
  goto st5;
1068
1062
  tr8:
1069
- #line 411 "edn_parser.rl"
1063
+ #line 405 "edn_parser.rl"
1070
1064
  {
1071
1065
  // stand-alone operators (-, +, /, ... etc)
1072
- std::string sym;
1073
- sym += *(p_save);
1074
- o = Parser::make_edn_symbol(sym);
1066
+ char op[2] = { *p_save, 0 };
1067
+ VALUE sym = rb_str_new2(op);
1068
+ v = Parser::make_edn_symbol(sym);
1075
1069
  }
1076
- #line 24 "edn_parser.rl"
1070
+ #line 20 "edn_parser.rl"
1077
1071
  { line_number++; }
1078
- #line 61 "edn_parser.rl"
1072
+ #line 57 "edn_parser.rl"
1079
1073
  { p--; {p++; cs = 5; goto _out;} }
1080
1074
  goto st5;
1081
1075
  tr11:
1082
- #line 61 "edn_parser.rl"
1076
+ #line 57 "edn_parser.rl"
1083
1077
  { p--; {p++; cs = 5; goto _out;} }
1084
1078
  goto st5;
1085
1079
  tr12:
1086
- #line 24 "edn_parser.rl"
1080
+ #line 20 "edn_parser.rl"
1087
1081
  { line_number++; }
1088
- #line 61 "edn_parser.rl"
1082
+ #line 57 "edn_parser.rl"
1089
1083
  { p--; {p++; cs = 5; goto _out;} }
1090
1084
  goto st5;
1091
1085
  st5:
1092
1086
  if ( ++p == pe )
1093
1087
  goto _test_eof5;
1094
1088
  case 5:
1095
- #line 1096 "edn_parser.cc"
1089
+ #line 1090 "edn_parser.cc"
1096
1090
  switch( (*p) ) {
1097
1091
  case 10: goto tr12;
1098
1092
  case 32: goto tr11;
@@ -1120,25 +1114,25 @@ case 5:
1120
1114
  goto st0;
1121
1115
  goto tr10;
1122
1116
  tr9:
1123
- #line 411 "edn_parser.rl"
1117
+ #line 405 "edn_parser.rl"
1124
1118
  {
1125
1119
  // stand-alone operators (-, +, /, ... etc)
1126
- std::string sym;
1127
- sym += *(p_save);
1128
- o = Parser::make_edn_symbol(sym);
1120
+ char op[2] = { *p_save, 0 };
1121
+ VALUE sym = rb_str_new2(op);
1122
+ v = Parser::make_edn_symbol(sym);
1129
1123
  }
1130
- #line 61 "edn_parser.rl"
1124
+ #line 57 "edn_parser.rl"
1131
1125
  { p--; {p++; cs = 6; goto _out;} }
1132
1126
  goto st6;
1133
1127
  tr13:
1134
- #line 61 "edn_parser.rl"
1128
+ #line 57 "edn_parser.rl"
1135
1129
  { p--; {p++; cs = 6; goto _out;} }
1136
1130
  goto st6;
1137
1131
  st6:
1138
1132
  if ( ++p == pe )
1139
1133
  goto _test_eof6;
1140
1134
  case 6:
1141
- #line 1142 "edn_parser.cc"
1135
+ #line 1136 "edn_parser.cc"
1142
1136
  if ( (*p) == 10 )
1143
1137
  goto tr5;
1144
1138
  goto st2;
@@ -1183,17 +1177,17 @@ case 7:
1183
1177
  goto tr14;
1184
1178
  goto tr6;
1185
1179
  tr14:
1186
- #line 388 "edn_parser.rl"
1180
+ #line 382 "edn_parser.rl"
1187
1181
  {
1188
1182
  // parse a number with the leading symbol - this is slightly
1189
1183
  // different than the one within EDN_value since it includes
1190
1184
  // the leading - or +
1191
1185
  //
1192
1186
  // try to parse a decimal first
1193
- const char *np = parse_decimal(p_save, pe, o);
1187
+ const char *np = parse_decimal(p_save, pe, v);
1194
1188
  if (np == NULL) {
1195
1189
  // if we can't, try to parse it as an int
1196
- np = parse_integer(p_save, pe, o);
1190
+ np = parse_integer(p_save, pe, v);
1197
1191
  }
1198
1192
 
1199
1193
  if (np) {
@@ -1208,13 +1202,13 @@ tr14:
1208
1202
  }
1209
1203
  goto st8;
1210
1204
  tr15:
1211
- #line 378 "edn_parser.rl"
1205
+ #line 372 "edn_parser.rl"
1212
1206
  {
1213
1207
  // parse a symbol including the leading operator (-, +, .)
1214
- std::string sym;
1208
+ VALUE sym = Qnil;
1215
1209
  const char *np = parse_symbol(p_save, pe, sym);
1216
1210
  if (np == NULL) { p--; {p++; cs = 8; goto _out;} } else {
1217
- o = Parser::make_edn_symbol(sym);
1211
+ v = Parser::make_edn_symbol(sym);
1218
1212
  {p = (( np))-1;}
1219
1213
  }
1220
1214
  }
@@ -1223,7 +1217,7 @@ st8:
1223
1217
  if ( ++p == pe )
1224
1218
  goto _test_eof8;
1225
1219
  case 8:
1226
- #line 1227 "edn_parser.cc"
1220
+ #line 1221 "edn_parser.cc"
1227
1221
  switch( (*p) ) {
1228
1222
  case 33: goto st0;
1229
1223
  case 95: goto st0;
@@ -1293,22 +1287,22 @@ case 9:
1293
1287
  case 3:
1294
1288
  case 7:
1295
1289
  case 9:
1296
- #line 411 "edn_parser.rl"
1290
+ #line 405 "edn_parser.rl"
1297
1291
  {
1298
1292
  // stand-alone operators (-, +, /, ... etc)
1299
- std::string sym;
1300
- sym += *(p_save);
1301
- o = Parser::make_edn_symbol(sym);
1293
+ char op[2] = { *p_save, 0 };
1294
+ VALUE sym = rb_str_new2(op);
1295
+ v = Parser::make_edn_symbol(sym);
1302
1296
  }
1303
1297
  break;
1304
- #line 1305 "edn_parser.cc"
1298
+ #line 1299 "edn_parser.cc"
1305
1299
  }
1306
1300
  }
1307
1301
 
1308
1302
  _out: {}
1309
1303
  }
1310
1304
 
1311
- #line 434 "edn_parser.rl"
1305
+ #line 428 "edn_parser.rl"
1312
1306
 
1313
1307
  if (cs >= EDN_operator_first_final) {
1314
1308
  return p;
@@ -1327,7 +1321,7 @@ case 9:
1327
1321
  // escaped char parsing - handles \c, \newline, \formfeed, etc.
1328
1322
  //
1329
1323
 
1330
- #line 1331 "edn_parser.cc"
1324
+ #line 1325 "edn_parser.cc"
1331
1325
  static const int EDN_escaped_char_start = 1;
1332
1326
  static const int EDN_escaped_char_first_final = 4;
1333
1327
  static const int EDN_escaped_char_error = 0;
@@ -1335,24 +1329,24 @@ static const int EDN_escaped_char_error = 0;
1335
1329
  static const int EDN_escaped_char_en_main = 1;
1336
1330
 
1337
1331
 
1338
- #line 463 "edn_parser.rl"
1332
+ #line 457 "edn_parser.rl"
1339
1333
 
1340
1334
 
1341
1335
 
1342
- const char* edn::Parser::parse_esc_char(const char *p, const char *pe, Rice::Object& o)
1336
+ const char* edn::Parser::parse_esc_char(const char *p, const char *pe, VALUE& v)
1343
1337
  {
1344
1338
  int cs;
1345
1339
 
1346
1340
 
1347
- #line 1348 "edn_parser.cc"
1341
+ #line 1342 "edn_parser.cc"
1348
1342
  {
1349
1343
  cs = EDN_escaped_char_start;
1350
1344
  }
1351
1345
 
1352
- #line 471 "edn_parser.rl"
1353
- p_save = p;
1346
+ #line 465 "edn_parser.rl"
1347
+ const char* p_save = p;
1354
1348
 
1355
- #line 1356 "edn_parser.cc"
1349
+ #line 1350 "edn_parser.cc"
1356
1350
  {
1357
1351
  if ( p == pe )
1358
1352
  goto _test_eof;
@@ -1396,34 +1390,34 @@ case 4:
1396
1390
  goto st4;
1397
1391
  goto tr5;
1398
1392
  tr5:
1399
- #line 61 "edn_parser.rl"
1393
+ #line 57 "edn_parser.rl"
1400
1394
  { p--; {p++; cs = 5; goto _out;} }
1401
1395
  goto st5;
1402
1396
  st5:
1403
1397
  if ( ++p == pe )
1404
1398
  goto _test_eof5;
1405
1399
  case 5:
1406
- #line 1407 "edn_parser.cc"
1400
+ #line 1401 "edn_parser.cc"
1407
1401
  goto st0;
1408
1402
  tr4:
1409
- #line 24 "edn_parser.rl"
1403
+ #line 20 "edn_parser.rl"
1410
1404
  { line_number++; }
1411
1405
  goto st6;
1412
1406
  tr6:
1413
- #line 61 "edn_parser.rl"
1407
+ #line 57 "edn_parser.rl"
1414
1408
  { p--; {p++; cs = 6; goto _out;} }
1415
1409
  goto st6;
1416
1410
  tr7:
1417
- #line 24 "edn_parser.rl"
1411
+ #line 20 "edn_parser.rl"
1418
1412
  { line_number++; }
1419
- #line 61 "edn_parser.rl"
1413
+ #line 57 "edn_parser.rl"
1420
1414
  { p--; {p++; cs = 6; goto _out;} }
1421
1415
  goto st6;
1422
1416
  st6:
1423
1417
  if ( ++p == pe )
1424
1418
  goto _test_eof6;
1425
1419
  case 6:
1426
- #line 1427 "edn_parser.cc"
1420
+ #line 1421 "edn_parser.cc"
1427
1421
  switch( (*p) ) {
1428
1422
  case 10: goto tr7;
1429
1423
  case 32: goto tr6;
@@ -1441,14 +1435,14 @@ case 6:
1441
1435
  goto st0;
1442
1436
  goto tr5;
1443
1437
  tr8:
1444
- #line 61 "edn_parser.rl"
1438
+ #line 57 "edn_parser.rl"
1445
1439
  { p--; {p++; cs = 7; goto _out;} }
1446
1440
  goto st7;
1447
1441
  st7:
1448
1442
  if ( ++p == pe )
1449
1443
  goto _test_eof7;
1450
1444
  case 7:
1451
- #line 1452 "edn_parser.cc"
1445
+ #line 1446 "edn_parser.cc"
1452
1446
  if ( (*p) == 10 )
1453
1447
  goto tr4;
1454
1448
  goto st3;
@@ -1471,11 +1465,11 @@ case 3:
1471
1465
  _out: {}
1472
1466
  }
1473
1467
 
1474
- #line 473 "edn_parser.rl"
1468
+ #line 467 "edn_parser.rl"
1475
1469
 
1476
1470
  if (cs >= EDN_escaped_char_first_final) {
1477
1471
  // convert the escaped value to a character
1478
- if (!Parser::parse_escaped_char(p_save + 1, p, o)) {
1472
+ if (!Parser::parse_escaped_char(p_save + 1, p, v)) {
1479
1473
  return pe;
1480
1474
  }
1481
1475
  return p;
@@ -1496,8 +1490,9 @@ case 3:
1496
1490
  // character and an optional leading operator (name, -today,
1497
1491
  // .yesterday)
1498
1492
  //
1493
+ //
1499
1494
 
1500
- #line 1501 "edn_parser.cc"
1495
+ #line 1496 "edn_parser.cc"
1501
1496
  static const int EDN_symbol_start = 1;
1502
1497
  static const int EDN_symbol_first_final = 5;
1503
1498
  static const int EDN_symbol_error = 0;
@@ -1505,24 +1500,24 @@ static const int EDN_symbol_error = 0;
1505
1500
  static const int EDN_symbol_en_main = 1;
1506
1501
 
1507
1502
 
1508
- #line 507 "edn_parser.rl"
1503
+ #line 502 "edn_parser.rl"
1509
1504
 
1510
1505
 
1511
1506
 
1512
- const char* edn::Parser::parse_symbol(const char *p, const char *pe, std::string& sym)
1507
+ const char* edn::Parser::parse_symbol(const char *p, const char *pe, VALUE& s)
1513
1508
  {
1514
1509
  int cs;
1515
1510
 
1516
1511
 
1517
- #line 1518 "edn_parser.cc"
1512
+ #line 1513 "edn_parser.cc"
1518
1513
  {
1519
1514
  cs = EDN_symbol_start;
1520
1515
  }
1521
1516
 
1522
- #line 515 "edn_parser.rl"
1523
- p_save = p;
1517
+ #line 510 "edn_parser.rl"
1518
+ const char* p_save = p;
1524
1519
 
1525
- #line 1526 "edn_parser.cc"
1520
+ #line 1521 "edn_parser.cc"
1526
1521
  {
1527
1522
  if ( p == pe )
1528
1523
  goto _test_eof;
@@ -1600,34 +1595,34 @@ case 5:
1600
1595
  goto st5;
1601
1596
  goto tr6;
1602
1597
  tr6:
1603
- #line 61 "edn_parser.rl"
1598
+ #line 57 "edn_parser.rl"
1604
1599
  { p--; {p++; cs = 6; goto _out;} }
1605
1600
  goto st6;
1606
1601
  st6:
1607
1602
  if ( ++p == pe )
1608
1603
  goto _test_eof6;
1609
1604
  case 6:
1610
- #line 1611 "edn_parser.cc"
1605
+ #line 1606 "edn_parser.cc"
1611
1606
  goto st0;
1612
1607
  tr4:
1613
- #line 24 "edn_parser.rl"
1608
+ #line 20 "edn_parser.rl"
1614
1609
  { line_number++; }
1615
1610
  goto st7;
1616
1611
  tr7:
1617
- #line 61 "edn_parser.rl"
1612
+ #line 57 "edn_parser.rl"
1618
1613
  { p--; {p++; cs = 7; goto _out;} }
1619
1614
  goto st7;
1620
1615
  tr8:
1621
- #line 24 "edn_parser.rl"
1616
+ #line 20 "edn_parser.rl"
1622
1617
  { line_number++; }
1623
- #line 61 "edn_parser.rl"
1618
+ #line 57 "edn_parser.rl"
1624
1619
  { p--; {p++; cs = 7; goto _out;} }
1625
1620
  goto st7;
1626
1621
  st7:
1627
1622
  if ( ++p == pe )
1628
1623
  goto _test_eof7;
1629
1624
  case 7:
1630
- #line 1631 "edn_parser.cc"
1625
+ #line 1626 "edn_parser.cc"
1631
1626
  switch( (*p) ) {
1632
1627
  case 10: goto tr8;
1633
1628
  case 32: goto tr7;
@@ -1652,14 +1647,14 @@ case 7:
1652
1647
  goto st0;
1653
1648
  goto tr6;
1654
1649
  tr10:
1655
- #line 61 "edn_parser.rl"
1650
+ #line 57 "edn_parser.rl"
1656
1651
  { p--; {p++; cs = 8; goto _out;} }
1657
1652
  goto st8;
1658
1653
  st8:
1659
1654
  if ( ++p == pe )
1660
1655
  goto _test_eof8;
1661
1656
  case 8:
1662
- #line 1663 "edn_parser.cc"
1657
+ #line 1658 "edn_parser.cc"
1663
1658
  if ( (*p) == 10 )
1664
1659
  goto tr4;
1665
1660
  goto st3;
@@ -1729,12 +1724,13 @@ case 9:
1729
1724
  _out: {}
1730
1725
  }
1731
1726
 
1732
- #line 517 "edn_parser.rl"
1727
+ #line 512 "edn_parser.rl"
1733
1728
 
1734
1729
  if (cs >= EDN_symbol_first_final) {
1735
1730
  // copy the symbol text
1736
- sym.clear();
1737
- sym.append(p_save, p - p_save);
1731
+ if (s == Qnil)
1732
+ s = rb_str_new2("");
1733
+ rb_str_cat(s, p_save, p - p_save);
1738
1734
  return p;
1739
1735
  }
1740
1736
  else if (cs == EDN_symbol_error) {
@@ -1749,18 +1745,18 @@ case 9:
1749
1745
 
1750
1746
  // ============================================================
1751
1747
  // EDN_sequence_common is used to parse EDN containers - elements are
1752
- // initially stored in a rice array and then the final corresponding
1748
+ // initially stored in an array and then the final corresponding
1753
1749
  // container is built from the list (although, for vectors, lists, and
1754
1750
  // sets the same array is used)
1755
1751
  //
1756
1752
 
1757
- #line 572 "edn_parser.rl"
1753
+ #line 568 "edn_parser.rl"
1758
1754
 
1759
1755
 
1760
1756
  //
1761
1757
  // vector-specific machine
1762
1758
 
1763
- #line 1764 "edn_parser.cc"
1759
+ #line 1760 "edn_parser.cc"
1764
1760
  static const int EDN_vector_start = 1;
1765
1761
  static const int EDN_vector_first_final = 4;
1766
1762
  static const int EDN_vector_error = 0;
@@ -1768,29 +1764,29 @@ static const int EDN_vector_error = 0;
1768
1764
  static const int EDN_vector_en_main = 1;
1769
1765
 
1770
1766
 
1771
- #line 588 "edn_parser.rl"
1767
+ #line 584 "edn_parser.rl"
1772
1768
 
1773
1769
 
1774
1770
 
1775
1771
  //
1776
1772
  // vector parsing
1777
1773
  //
1778
- const char* edn::Parser::parse_vector(const char *p, const char *pe, Rice::Object& o)
1774
+ const char* edn::Parser::parse_vector(const char *p, const char *pe, VALUE& v)
1779
1775
  {
1780
1776
  static const char* EDN_TYPE = "vector";
1781
1777
 
1782
1778
  int cs;
1783
- Rice::Array elems; // will store the vector's elements
1779
+ VALUE elems = rb_ary_new(); // will store the vector's elements
1784
1780
 
1785
1781
 
1786
- #line 1787 "edn_parser.cc"
1782
+ #line 1783 "edn_parser.cc"
1787
1783
  {
1788
1784
  cs = EDN_vector_start;
1789
1785
  }
1790
1786
 
1791
- #line 602 "edn_parser.rl"
1787
+ #line 598 "edn_parser.rl"
1792
1788
 
1793
- #line 1794 "edn_parser.cc"
1789
+ #line 1790 "edn_parser.cc"
1794
1790
  {
1795
1791
  if ( p == pe )
1796
1792
  goto _test_eof;
@@ -1801,7 +1797,7 @@ case 1:
1801
1797
  goto st2;
1802
1798
  goto st0;
1803
1799
  tr2:
1804
- #line 54 "edn_parser.rl"
1800
+ #line 50 "edn_parser.rl"
1805
1801
  {
1806
1802
  std::stringstream s;
1807
1803
  s << "unterminated " << EDN_TYPE;
@@ -1809,22 +1805,22 @@ tr2:
1809
1805
  p--; {p++; cs = 0; goto _out;}
1810
1806
  }
1811
1807
  goto st0;
1812
- #line 1813 "edn_parser.cc"
1808
+ #line 1809 "edn_parser.cc"
1813
1809
  st0:
1814
1810
  cs = 0;
1815
1811
  goto _out;
1816
1812
  tr3:
1817
- #line 24 "edn_parser.rl"
1813
+ #line 20 "edn_parser.rl"
1818
1814
  { line_number++; }
1819
1815
  goto st2;
1820
1816
  tr4:
1821
- #line 544 "edn_parser.rl"
1817
+ #line 540 "edn_parser.rl"
1822
1818
  {
1823
1819
  // reads an item within a sequence (vector, list, map, or
1824
1820
  // set). Regardless of the sequence type, an array of the
1825
1821
  // items is built. Once done, the sequence parser will convert
1826
1822
  // if needed
1827
- Rice::Object e;
1823
+ VALUE e;
1828
1824
  const char *np = parse_value(p, pe, e);
1829
1825
  if (np == NULL) {
1830
1826
  p--; {p++; cs = 2; goto _out;}
@@ -1838,7 +1834,7 @@ tr4:
1838
1834
  else {
1839
1835
  // otherwise we add it to the list of elements for the
1840
1836
  // corresponding container
1841
- elems.push(e);
1837
+ rb_ary_push(elems, e);
1842
1838
  }
1843
1839
  {p = (( np))-1;}
1844
1840
  }
@@ -1848,7 +1844,7 @@ st2:
1848
1844
  if ( ++p == pe )
1849
1845
  goto _test_eof2;
1850
1846
  case 2:
1851
- #line 1852 "edn_parser.cc"
1847
+ #line 1848 "edn_parser.cc"
1852
1848
  switch( (*p) ) {
1853
1849
  case 10: goto tr3;
1854
1850
  case 32: goto st2;
@@ -1881,14 +1877,14 @@ case 3:
1881
1877
  goto tr3;
1882
1878
  goto st3;
1883
1879
  tr6:
1884
- #line 61 "edn_parser.rl"
1880
+ #line 57 "edn_parser.rl"
1885
1881
  { p--; {p++; cs = 4; goto _out;} }
1886
1882
  goto st4;
1887
1883
  st4:
1888
1884
  if ( ++p == pe )
1889
1885
  goto _test_eof4;
1890
1886
  case 4:
1891
- #line 1892 "edn_parser.cc"
1887
+ #line 1888 "edn_parser.cc"
1892
1888
  goto st0;
1893
1889
  }
1894
1890
  _test_eof2: cs = 2; goto _test_eof;
@@ -1901,7 +1897,7 @@ case 4:
1901
1897
  switch ( cs ) {
1902
1898
  case 2:
1903
1899
  case 3:
1904
- #line 54 "edn_parser.rl"
1900
+ #line 50 "edn_parser.rl"
1905
1901
  {
1906
1902
  std::stringstream s;
1907
1903
  s << "unterminated " << EDN_TYPE;
@@ -1909,17 +1905,17 @@ case 4:
1909
1905
  p--; {p++; cs = 0; goto _out;}
1910
1906
  }
1911
1907
  break;
1912
- #line 1913 "edn_parser.cc"
1908
+ #line 1909 "edn_parser.cc"
1913
1909
  }
1914
1910
  }
1915
1911
 
1916
1912
  _out: {}
1917
1913
  }
1918
1914
 
1919
- #line 603 "edn_parser.rl"
1915
+ #line 599 "edn_parser.rl"
1920
1916
 
1921
1917
  if (cs >= EDN_vector_first_final) {
1922
- o = elems;
1918
+ v = elems;
1923
1919
  return p + 1;
1924
1920
  }
1925
1921
  else if (cs == EDN_vector_error) {
@@ -1936,7 +1932,7 @@ case 4:
1936
1932
  // list parsing machine
1937
1933
  //
1938
1934
 
1939
- #line 1940 "edn_parser.cc"
1935
+ #line 1936 "edn_parser.cc"
1940
1936
  static const int EDN_list_start = 1;
1941
1937
  static const int EDN_list_first_final = 4;
1942
1938
  static const int EDN_list_error = 0;
@@ -1944,28 +1940,28 @@ static const int EDN_list_error = 0;
1944
1940
  static const int EDN_list_en_main = 1;
1945
1941
 
1946
1942
 
1947
- #line 632 "edn_parser.rl"
1943
+ #line 628 "edn_parser.rl"
1948
1944
 
1949
1945
 
1950
1946
  //
1951
1947
  // list parsing
1952
1948
  //
1953
- const char* edn::Parser::parse_list(const char *p, const char *pe, Rice::Object& o)
1949
+ const char* edn::Parser::parse_list(const char *p, const char *pe, VALUE& v)
1954
1950
  {
1955
1951
  static const char* EDN_TYPE = "list";
1956
1952
 
1957
1953
  int cs;
1958
- Rice::Array elems;
1954
+ VALUE elems = rb_ary_new();
1959
1955
 
1960
1956
 
1961
- #line 1962 "edn_parser.cc"
1957
+ #line 1958 "edn_parser.cc"
1962
1958
  {
1963
1959
  cs = EDN_list_start;
1964
1960
  }
1965
1961
 
1966
- #line 645 "edn_parser.rl"
1962
+ #line 641 "edn_parser.rl"
1967
1963
 
1968
- #line 1969 "edn_parser.cc"
1964
+ #line 1965 "edn_parser.cc"
1969
1965
  {
1970
1966
  if ( p == pe )
1971
1967
  goto _test_eof;
@@ -1976,7 +1972,7 @@ case 1:
1976
1972
  goto st2;
1977
1973
  goto st0;
1978
1974
  tr2:
1979
- #line 54 "edn_parser.rl"
1975
+ #line 50 "edn_parser.rl"
1980
1976
  {
1981
1977
  std::stringstream s;
1982
1978
  s << "unterminated " << EDN_TYPE;
@@ -1984,22 +1980,22 @@ tr2:
1984
1980
  p--; {p++; cs = 0; goto _out;}
1985
1981
  }
1986
1982
  goto st0;
1987
- #line 1988 "edn_parser.cc"
1983
+ #line 1984 "edn_parser.cc"
1988
1984
  st0:
1989
1985
  cs = 0;
1990
1986
  goto _out;
1991
1987
  tr3:
1992
- #line 24 "edn_parser.rl"
1988
+ #line 20 "edn_parser.rl"
1993
1989
  { line_number++; }
1994
1990
  goto st2;
1995
1991
  tr4:
1996
- #line 544 "edn_parser.rl"
1992
+ #line 540 "edn_parser.rl"
1997
1993
  {
1998
1994
  // reads an item within a sequence (vector, list, map, or
1999
1995
  // set). Regardless of the sequence type, an array of the
2000
1996
  // items is built. Once done, the sequence parser will convert
2001
1997
  // if needed
2002
- Rice::Object e;
1998
+ VALUE e;
2003
1999
  const char *np = parse_value(p, pe, e);
2004
2000
  if (np == NULL) {
2005
2001
  p--; {p++; cs = 2; goto _out;}
@@ -2013,7 +2009,7 @@ tr4:
2013
2009
  else {
2014
2010
  // otherwise we add it to the list of elements for the
2015
2011
  // corresponding container
2016
- elems.push(e);
2012
+ rb_ary_push(elems, e);
2017
2013
  }
2018
2014
  {p = (( np))-1;}
2019
2015
  }
@@ -2023,7 +2019,7 @@ st2:
2023
2019
  if ( ++p == pe )
2024
2020
  goto _test_eof2;
2025
2021
  case 2:
2026
- #line 2027 "edn_parser.cc"
2022
+ #line 2023 "edn_parser.cc"
2027
2023
  switch( (*p) ) {
2028
2024
  case 10: goto tr3;
2029
2025
  case 32: goto st2;
@@ -2048,14 +2044,14 @@ case 2:
2048
2044
  goto tr4;
2049
2045
  goto tr2;
2050
2046
  tr5:
2051
- #line 61 "edn_parser.rl"
2047
+ #line 57 "edn_parser.rl"
2052
2048
  { p--; {p++; cs = 4; goto _out;} }
2053
2049
  goto st4;
2054
2050
  st4:
2055
2051
  if ( ++p == pe )
2056
2052
  goto _test_eof4;
2057
2053
  case 4:
2058
- #line 2059 "edn_parser.cc"
2054
+ #line 2055 "edn_parser.cc"
2059
2055
  goto st0;
2060
2056
  st3:
2061
2057
  if ( ++p == pe )
@@ -2075,7 +2071,7 @@ case 3:
2075
2071
  switch ( cs ) {
2076
2072
  case 2:
2077
2073
  case 3:
2078
- #line 54 "edn_parser.rl"
2074
+ #line 50 "edn_parser.rl"
2079
2075
  {
2080
2076
  std::stringstream s;
2081
2077
  s << "unterminated " << EDN_TYPE;
@@ -2083,17 +2079,17 @@ case 3:
2083
2079
  p--; {p++; cs = 0; goto _out;}
2084
2080
  }
2085
2081
  break;
2086
- #line 2087 "edn_parser.cc"
2082
+ #line 2083 "edn_parser.cc"
2087
2083
  }
2088
2084
  }
2089
2085
 
2090
2086
  _out: {}
2091
2087
  }
2092
2088
 
2093
- #line 646 "edn_parser.rl"
2089
+ #line 642 "edn_parser.rl"
2094
2090
 
2095
2091
  if (cs >= EDN_list_first_final) {
2096
- o = elems;
2092
+ v = elems;
2097
2093
  return p + 1;
2098
2094
  }
2099
2095
  else if (cs == EDN_list_error) {
@@ -2110,7 +2106,7 @@ case 3:
2110
2106
  // hash parsing
2111
2107
  //
2112
2108
 
2113
- #line 2114 "edn_parser.cc"
2109
+ #line 2110 "edn_parser.cc"
2114
2110
  static const int EDN_map_start = 1;
2115
2111
  static const int EDN_map_first_final = 4;
2116
2112
  static const int EDN_map_error = 0;
@@ -2118,28 +2114,28 @@ static const int EDN_map_error = 0;
2118
2114
  static const int EDN_map_en_main = 1;
2119
2115
 
2120
2116
 
2121
- #line 676 "edn_parser.rl"
2117
+ #line 672 "edn_parser.rl"
2122
2118
 
2123
2119
 
2124
2120
 
2125
- const char* edn::Parser::parse_map(const char *p, const char *pe, Rice::Object& o)
2121
+ const char* edn::Parser::parse_map(const char *p, const char *pe, VALUE& v)
2126
2122
  {
2127
2123
  static const char* EDN_TYPE = "map";
2128
2124
 
2129
2125
  int cs;
2130
2126
  // since we don't know whether we're looking at a key or value,
2131
2127
  // initially store all elements in a list
2132
- Rice::Array elems;
2128
+ VALUE elems = rb_ary_new();
2133
2129
 
2134
2130
 
2135
- #line 2136 "edn_parser.cc"
2131
+ #line 2132 "edn_parser.cc"
2136
2132
  {
2137
2133
  cs = EDN_map_start;
2138
2134
  }
2139
2135
 
2140
- #line 689 "edn_parser.rl"
2136
+ #line 685 "edn_parser.rl"
2141
2137
 
2142
- #line 2143 "edn_parser.cc"
2138
+ #line 2139 "edn_parser.cc"
2143
2139
  {
2144
2140
  if ( p == pe )
2145
2141
  goto _test_eof;
@@ -2150,7 +2146,7 @@ case 1:
2150
2146
  goto st2;
2151
2147
  goto st0;
2152
2148
  tr2:
2153
- #line 54 "edn_parser.rl"
2149
+ #line 50 "edn_parser.rl"
2154
2150
  {
2155
2151
  std::stringstream s;
2156
2152
  s << "unterminated " << EDN_TYPE;
@@ -2158,22 +2154,22 @@ tr2:
2158
2154
  p--; {p++; cs = 0; goto _out;}
2159
2155
  }
2160
2156
  goto st0;
2161
- #line 2162 "edn_parser.cc"
2157
+ #line 2158 "edn_parser.cc"
2162
2158
  st0:
2163
2159
  cs = 0;
2164
2160
  goto _out;
2165
2161
  tr3:
2166
- #line 24 "edn_parser.rl"
2162
+ #line 20 "edn_parser.rl"
2167
2163
  { line_number++; }
2168
2164
  goto st2;
2169
2165
  tr4:
2170
- #line 544 "edn_parser.rl"
2166
+ #line 540 "edn_parser.rl"
2171
2167
  {
2172
2168
  // reads an item within a sequence (vector, list, map, or
2173
2169
  // set). Regardless of the sequence type, an array of the
2174
2170
  // items is built. Once done, the sequence parser will convert
2175
2171
  // if needed
2176
- Rice::Object e;
2172
+ VALUE e;
2177
2173
  const char *np = parse_value(p, pe, e);
2178
2174
  if (np == NULL) {
2179
2175
  p--; {p++; cs = 2; goto _out;}
@@ -2187,7 +2183,7 @@ tr4:
2187
2183
  else {
2188
2184
  // otherwise we add it to the list of elements for the
2189
2185
  // corresponding container
2190
- elems.push(e);
2186
+ rb_ary_push(elems, e);
2191
2187
  }
2192
2188
  {p = (( np))-1;}
2193
2189
  }
@@ -2197,7 +2193,7 @@ st2:
2197
2193
  if ( ++p == pe )
2198
2194
  goto _test_eof2;
2199
2195
  case 2:
2200
- #line 2201 "edn_parser.cc"
2196
+ #line 2197 "edn_parser.cc"
2201
2197
  switch( (*p) ) {
2202
2198
  case 10: goto tr3;
2203
2199
  case 32: goto st2;
@@ -2230,14 +2226,14 @@ case 3:
2230
2226
  goto tr3;
2231
2227
  goto st3;
2232
2228
  tr6:
2233
- #line 61 "edn_parser.rl"
2229
+ #line 57 "edn_parser.rl"
2234
2230
  { p--; {p++; cs = 4; goto _out;} }
2235
2231
  goto st4;
2236
2232
  st4:
2237
2233
  if ( ++p == pe )
2238
2234
  goto _test_eof4;
2239
2235
  case 4:
2240
- #line 2241 "edn_parser.cc"
2236
+ #line 2237 "edn_parser.cc"
2241
2237
  goto st0;
2242
2238
  }
2243
2239
  _test_eof2: cs = 2; goto _test_eof;
@@ -2250,7 +2246,7 @@ case 4:
2250
2246
  switch ( cs ) {
2251
2247
  case 2:
2252
2248
  case 3:
2253
- #line 54 "edn_parser.rl"
2249
+ #line 50 "edn_parser.rl"
2254
2250
  {
2255
2251
  std::stringstream s;
2256
2252
  s << "unterminated " << EDN_TYPE;
@@ -2258,32 +2254,32 @@ case 4:
2258
2254
  p--; {p++; cs = 0; goto _out;}
2259
2255
  }
2260
2256
  break;
2261
- #line 2262 "edn_parser.cc"
2257
+ #line 2258 "edn_parser.cc"
2262
2258
  }
2263
2259
  }
2264
2260
 
2265
2261
  _out: {}
2266
2262
  }
2267
2263
 
2268
- #line 690 "edn_parser.rl"
2264
+ #line 686 "edn_parser.rl"
2269
2265
 
2270
2266
  if (cs >= EDN_map_first_final) {
2271
2267
 
2272
2268
  // hash parsing is done. Make sure we have an even count
2273
- if ((elems.size() % 2) != 0) {
2269
+ if ((RARRAY_LEN(elems) % 2) != 0) {
2274
2270
  error(__FUNCTION__, "odd number of elements in map");
2275
2271
  return pe;
2276
2272
  }
2277
2273
 
2278
2274
  // now convert the sequence to a hash
2279
- Rice::Hash rslt;
2280
- while (elems.size())
2275
+ VALUE rslt = rb_hash_new();
2276
+ while (RARRAY_LEN(elems) > 0)
2281
2277
  {
2282
- Rice::Object k = elems.shift();
2283
- rslt[k] = elems.shift();
2278
+ VALUE k = rb_ary_shift(elems);
2279
+ rb_hash_aset(rslt, k, rb_ary_shift(elems));
2284
2280
  }
2285
2281
 
2286
- o = rslt;
2282
+ v = rslt;
2287
2283
  return p + 1;
2288
2284
  }
2289
2285
  else if (cs == EDN_map_error) {
@@ -2301,7 +2297,7 @@ case 4:
2301
2297
  // the remaining data to the correct parser
2302
2298
  //
2303
2299
 
2304
- #line 2305 "edn_parser.cc"
2300
+ #line 2301 "edn_parser.cc"
2305
2301
  static const int EDN_dispatch_start = 1;
2306
2302
  static const int EDN_dispatch_first_final = 2;
2307
2303
  static const int EDN_dispatch_error = 0;
@@ -2309,23 +2305,23 @@ static const int EDN_dispatch_error = 0;
2309
2305
  static const int EDN_dispatch_en_main = 1;
2310
2306
 
2311
2307
 
2312
- #line 754 "edn_parser.rl"
2308
+ #line 750 "edn_parser.rl"
2313
2309
 
2314
2310
 
2315
2311
 
2316
- const char* edn::Parser::parse_dispatch(const char *p, const char *pe, Rice::Object& o)
2312
+ const char* edn::Parser::parse_dispatch(const char *p, const char *pe, VALUE& v)
2317
2313
  {
2318
2314
  int cs;
2319
2315
 
2320
2316
 
2321
- #line 2322 "edn_parser.cc"
2317
+ #line 2318 "edn_parser.cc"
2322
2318
  {
2323
2319
  cs = EDN_dispatch_start;
2324
2320
  }
2325
2321
 
2326
- #line 762 "edn_parser.rl"
2322
+ #line 758 "edn_parser.rl"
2327
2323
 
2328
- #line 2329 "edn_parser.cc"
2324
+ #line 2325 "edn_parser.cc"
2329
2325
  {
2330
2326
  if ( p == pe )
2331
2327
  goto _test_eof;
@@ -2346,40 +2342,40 @@ st0:
2346
2342
  cs = 0;
2347
2343
  goto _out;
2348
2344
  tr0:
2349
- #line 742 "edn_parser.rl"
2345
+ #line 738 "edn_parser.rl"
2350
2346
  {
2351
2347
  // #inst, #uuid, or #user/tag
2352
- const char *np = parse_tagged(p, pe, o);
2348
+ const char *np = parse_tagged(p, pe, v);
2353
2349
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
2354
2350
  }
2355
- #line 61 "edn_parser.rl"
2351
+ #line 57 "edn_parser.rl"
2356
2352
  { p--; {p++; cs = 2; goto _out;} }
2357
2353
  goto st2;
2358
2354
  tr2:
2359
- #line 736 "edn_parser.rl"
2355
+ #line 732 "edn_parser.rl"
2360
2356
  {
2361
2357
  // discard token #_
2362
2358
  const char *np = parse_discard(p, pe);
2363
2359
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
2364
2360
  }
2365
- #line 61 "edn_parser.rl"
2361
+ #line 57 "edn_parser.rl"
2366
2362
  { p--; {p++; cs = 2; goto _out;} }
2367
2363
  goto st2;
2368
2364
  tr3:
2369
- #line 730 "edn_parser.rl"
2365
+ #line 726 "edn_parser.rl"
2370
2366
  {
2371
2367
  // #{ }
2372
- const char *np = parse_set(p, pe, o);
2368
+ const char *np = parse_set(p, pe, v);
2373
2369
  if (np == NULL) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
2374
2370
  }
2375
- #line 61 "edn_parser.rl"
2371
+ #line 57 "edn_parser.rl"
2376
2372
  { p--; {p++; cs = 2; goto _out;} }
2377
2373
  goto st2;
2378
2374
  st2:
2379
2375
  if ( ++p == pe )
2380
2376
  goto _test_eof2;
2381
2377
  case 2:
2382
- #line 2383 "edn_parser.cc"
2378
+ #line 2379 "edn_parser.cc"
2383
2379
  goto st0;
2384
2380
  }
2385
2381
  _test_eof2: cs = 2; goto _test_eof;
@@ -2388,7 +2384,7 @@ case 2:
2388
2384
  _out: {}
2389
2385
  }
2390
2386
 
2391
- #line 763 "edn_parser.rl"
2387
+ #line 759 "edn_parser.rl"
2392
2388
 
2393
2389
  if (cs >= EDN_dispatch_first_final) {
2394
2390
  return p + 1;
@@ -2407,7 +2403,7 @@ case 2:
2407
2403
  // set parsing machine
2408
2404
  //
2409
2405
 
2410
- #line 2411 "edn_parser.cc"
2406
+ #line 2407 "edn_parser.cc"
2411
2407
  static const int EDN_set_start = 1;
2412
2408
  static const int EDN_set_first_final = 4;
2413
2409
  static const int EDN_set_error = 0;
@@ -2415,28 +2411,28 @@ static const int EDN_set_error = 0;
2415
2411
  static const int EDN_set_en_main = 1;
2416
2412
 
2417
2413
 
2418
- #line 792 "edn_parser.rl"
2414
+ #line 788 "edn_parser.rl"
2419
2415
 
2420
2416
 
2421
2417
  //
2422
2418
  // set parsing
2423
2419
  //
2424
- const char* edn::Parser::parse_set(const char *p, const char *pe, Rice::Object& o)
2420
+ const char* edn::Parser::parse_set(const char *p, const char *pe, VALUE& v)
2425
2421
  {
2426
2422
  static const char* EDN_TYPE = "set";
2427
2423
 
2428
2424
  int cs;
2429
- Rice::Array elems; // stored as a vector
2425
+ VALUE elems = rb_ary_new(); // stored as an array
2430
2426
 
2431
2427
 
2432
- #line 2433 "edn_parser.cc"
2428
+ #line 2429 "edn_parser.cc"
2433
2429
  {
2434
2430
  cs = EDN_set_start;
2435
2431
  }
2436
2432
 
2437
- #line 805 "edn_parser.rl"
2433
+ #line 801 "edn_parser.rl"
2438
2434
 
2439
- #line 2440 "edn_parser.cc"
2435
+ #line 2436 "edn_parser.cc"
2440
2436
  {
2441
2437
  if ( p == pe )
2442
2438
  goto _test_eof;
@@ -2447,7 +2443,7 @@ case 1:
2447
2443
  goto st2;
2448
2444
  goto st0;
2449
2445
  tr2:
2450
- #line 54 "edn_parser.rl"
2446
+ #line 50 "edn_parser.rl"
2451
2447
  {
2452
2448
  std::stringstream s;
2453
2449
  s << "unterminated " << EDN_TYPE;
@@ -2455,22 +2451,22 @@ tr2:
2455
2451
  p--; {p++; cs = 0; goto _out;}
2456
2452
  }
2457
2453
  goto st0;
2458
- #line 2459 "edn_parser.cc"
2454
+ #line 2455 "edn_parser.cc"
2459
2455
  st0:
2460
2456
  cs = 0;
2461
2457
  goto _out;
2462
2458
  tr3:
2463
- #line 24 "edn_parser.rl"
2459
+ #line 20 "edn_parser.rl"
2464
2460
  { line_number++; }
2465
2461
  goto st2;
2466
2462
  tr4:
2467
- #line 544 "edn_parser.rl"
2463
+ #line 540 "edn_parser.rl"
2468
2464
  {
2469
2465
  // reads an item within a sequence (vector, list, map, or
2470
2466
  // set). Regardless of the sequence type, an array of the
2471
2467
  // items is built. Once done, the sequence parser will convert
2472
2468
  // if needed
2473
- Rice::Object e;
2469
+ VALUE e;
2474
2470
  const char *np = parse_value(p, pe, e);
2475
2471
  if (np == NULL) {
2476
2472
  p--; {p++; cs = 2; goto _out;}
@@ -2484,7 +2480,7 @@ tr4:
2484
2480
  else {
2485
2481
  // otherwise we add it to the list of elements for the
2486
2482
  // corresponding container
2487
- elems.push(e);
2483
+ rb_ary_push(elems, e);
2488
2484
  }
2489
2485
  {p = (( np))-1;}
2490
2486
  }
@@ -2494,7 +2490,7 @@ st2:
2494
2490
  if ( ++p == pe )
2495
2491
  goto _test_eof2;
2496
2492
  case 2:
2497
- #line 2498 "edn_parser.cc"
2493
+ #line 2494 "edn_parser.cc"
2498
2494
  switch( (*p) ) {
2499
2495
  case 10: goto tr3;
2500
2496
  case 32: goto st2;
@@ -2527,14 +2523,14 @@ case 3:
2527
2523
  goto tr3;
2528
2524
  goto st3;
2529
2525
  tr6:
2530
- #line 61 "edn_parser.rl"
2526
+ #line 57 "edn_parser.rl"
2531
2527
  { p--; {p++; cs = 4; goto _out;} }
2532
2528
  goto st4;
2533
2529
  st4:
2534
2530
  if ( ++p == pe )
2535
2531
  goto _test_eof4;
2536
2532
  case 4:
2537
- #line 2538 "edn_parser.cc"
2533
+ #line 2534 "edn_parser.cc"
2538
2534
  goto st0;
2539
2535
  }
2540
2536
  _test_eof2: cs = 2; goto _test_eof;
@@ -2547,7 +2543,7 @@ case 4:
2547
2543
  switch ( cs ) {
2548
2544
  case 2:
2549
2545
  case 3:
2550
- #line 54 "edn_parser.rl"
2546
+ #line 50 "edn_parser.rl"
2551
2547
  {
2552
2548
  std::stringstream s;
2553
2549
  s << "unterminated " << EDN_TYPE;
@@ -2555,18 +2551,18 @@ case 4:
2555
2551
  p--; {p++; cs = 0; goto _out;}
2556
2552
  }
2557
2553
  break;
2558
- #line 2559 "edn_parser.cc"
2554
+ #line 2555 "edn_parser.cc"
2559
2555
  }
2560
2556
  }
2561
2557
 
2562
2558
  _out: {}
2563
2559
  }
2564
2560
 
2565
- #line 806 "edn_parser.rl"
2561
+ #line 802 "edn_parser.rl"
2566
2562
 
2567
2563
  if (cs >= EDN_set_first_final) {
2568
2564
  // all elements collected; now convert to a set
2569
- o = Parser::make_ruby_set(elems);
2565
+ v = Parser::make_ruby_set(elems);
2570
2566
  return p + 1;
2571
2567
  }
2572
2568
  else if (cs == EDN_set_error) {
@@ -2581,12 +2577,11 @@ case 4:
2581
2577
 
2582
2578
  // ============================================================
2583
2579
  // discard - consume the discard token and parse the next value to
2584
- // discard. TODO: perhaps optimize this so no object data is built
2585
- // by defining a new machine(s) to consume items within container
2586
- // delimiters
2580
+ // discard. TODO: perhaps optimize this so no object data is built by
2581
+ // defining a machine to consume items within container delimiters
2587
2582
  //
2588
2583
 
2589
- #line 2590 "edn_parser.cc"
2584
+ #line 2585 "edn_parser.cc"
2590
2585
  static const int EDN_discard_start = 1;
2591
2586
  static const int EDN_discard_first_final = 4;
2592
2587
  static const int EDN_discard_error = 0;
@@ -2594,24 +2589,24 @@ static const int EDN_discard_error = 0;
2594
2589
  static const int EDN_discard_en_main = 1;
2595
2590
 
2596
2591
 
2597
- #line 853 "edn_parser.rl"
2592
+ #line 848 "edn_parser.rl"
2598
2593
 
2599
2594
 
2600
2595
 
2601
2596
  const char* edn::Parser::parse_discard(const char *p, const char *pe)
2602
2597
  {
2603
2598
  int cs;
2604
- Rice::Object o;
2599
+ VALUE v;
2605
2600
 
2606
2601
 
2607
- #line 2608 "edn_parser.cc"
2602
+ #line 2603 "edn_parser.cc"
2608
2603
  {
2609
2604
  cs = EDN_discard_start;
2610
2605
  }
2611
2606
 
2612
- #line 862 "edn_parser.rl"
2607
+ #line 857 "edn_parser.rl"
2613
2608
 
2614
- #line 2615 "edn_parser.cc"
2609
+ #line 2610 "edn_parser.cc"
2615
2610
  {
2616
2611
  if ( p == pe )
2617
2612
  goto _test_eof;
@@ -2625,14 +2620,14 @@ st0:
2625
2620
  cs = 0;
2626
2621
  goto _out;
2627
2622
  tr2:
2628
- #line 24 "edn_parser.rl"
2623
+ #line 20 "edn_parser.rl"
2629
2624
  { line_number++; }
2630
2625
  goto st2;
2631
2626
  st2:
2632
2627
  if ( ++p == pe )
2633
2628
  goto _test_eof2;
2634
2629
  case 2:
2635
- #line 2636 "edn_parser.cc"
2630
+ #line 2631 "edn_parser.cc"
2636
2631
  switch( (*p) ) {
2637
2632
  case 10: goto tr2;
2638
2633
  case 32: goto st2;
@@ -2657,27 +2652,27 @@ case 2:
2657
2652
  goto tr3;
2658
2653
  goto st0;
2659
2654
  tr3:
2660
- #line 836 "edn_parser.rl"
2655
+ #line 831 "edn_parser.rl"
2661
2656
  {
2662
- const char *np = parse_value(p, pe, o);
2657
+ const char *np = parse_value(p, pe, v);
2663
2658
  if (np) {
2664
2659
  // this token is to be discard it so store it in the
2665
2660
  // discard stack - we really don't need to save it so this
2666
2661
  // could be simplified
2667
- discard.push(o);
2662
+ discard.push(v);
2668
2663
  {p = (( np))-1;}
2669
2664
  } else {
2670
2665
  p--; {p++; cs = 4; goto _out;}
2671
2666
  }
2672
2667
  }
2673
- #line 61 "edn_parser.rl"
2668
+ #line 57 "edn_parser.rl"
2674
2669
  { p--; {p++; cs = 4; goto _out;} }
2675
2670
  goto st4;
2676
2671
  st4:
2677
2672
  if ( ++p == pe )
2678
2673
  goto _test_eof4;
2679
2674
  case 4:
2680
- #line 2681 "edn_parser.cc"
2675
+ #line 2676 "edn_parser.cc"
2681
2676
  goto st0;
2682
2677
  st3:
2683
2678
  if ( ++p == pe )
@@ -2695,7 +2690,7 @@ case 3:
2695
2690
  _out: {}
2696
2691
  }
2697
2692
 
2698
- #line 863 "edn_parser.rl"
2693
+ #line 858 "edn_parser.rl"
2699
2694
 
2700
2695
  if (cs >= EDN_discard_first_final) {
2701
2696
  return p + 1;
@@ -2726,7 +2721,7 @@ case 3:
2726
2721
  // 2. add parse checks for uuid and inst for better error reporting
2727
2722
  //
2728
2723
 
2729
- #line 2730 "edn_parser.cc"
2724
+ #line 2725 "edn_parser.cc"
2730
2725
  static const int EDN_tagged_start = 1;
2731
2726
  static const int EDN_tagged_first_final = 6;
2732
2727
  static const int EDN_tagged_error = 0;
@@ -2734,26 +2729,26 @@ static const int EDN_tagged_error = 0;
2734
2729
  static const int EDN_tagged_en_main = 1;
2735
2730
 
2736
2731
 
2737
- #line 914 "edn_parser.rl"
2732
+ #line 909 "edn_parser.rl"
2738
2733
 
2739
2734
 
2740
2735
 
2741
- const char* edn::Parser::parse_tagged(const char *p, const char *pe, Rice::Object& o)
2736
+ const char* edn::Parser::parse_tagged(const char *p, const char *pe, VALUE& v)
2742
2737
  {
2743
- std::string sym_name;
2744
- Rice::Object data;
2738
+ VALUE sym_name = Qnil;
2739
+ VALUE data = Qnil;
2745
2740
 
2746
2741
  int cs;
2747
2742
 
2748
2743
 
2749
- #line 2750 "edn_parser.cc"
2744
+ #line 2745 "edn_parser.cc"
2750
2745
  {
2751
2746
  cs = EDN_tagged_start;
2752
2747
  }
2753
2748
 
2754
- #line 925 "edn_parser.rl"
2749
+ #line 920 "edn_parser.rl"
2755
2750
 
2756
- #line 2757 "edn_parser.cc"
2751
+ #line 2752 "edn_parser.cc"
2757
2752
  {
2758
2753
  if ( p == pe )
2759
2754
  goto _test_eof;
@@ -2770,7 +2765,7 @@ st0:
2770
2765
  cs = 0;
2771
2766
  goto _out;
2772
2767
  tr0:
2773
- #line 901 "edn_parser.rl"
2768
+ #line 896 "edn_parser.rl"
2774
2769
  {
2775
2770
  // parses the symbol portion of the pair
2776
2771
  const char *np = parse_symbol(p, pe, sym_name);
@@ -2781,7 +2776,7 @@ st2:
2781
2776
  if ( ++p == pe )
2782
2777
  goto _test_eof2;
2783
2778
  case 2:
2784
- #line 2785 "edn_parser.cc"
2779
+ #line 2780 "edn_parser.cc"
2785
2780
  switch( (*p) ) {
2786
2781
  case 10: goto tr3;
2787
2782
  case 32: goto st3;
@@ -2818,14 +2813,14 @@ case 2:
2818
2813
  goto tr5;
2819
2814
  goto st0;
2820
2815
  tr3:
2821
- #line 24 "edn_parser.rl"
2816
+ #line 20 "edn_parser.rl"
2822
2817
  { line_number++; }
2823
2818
  goto st3;
2824
2819
  st3:
2825
2820
  if ( ++p == pe )
2826
2821
  goto _test_eof3;
2827
2822
  case 3:
2828
- #line 2829 "edn_parser.cc"
2823
+ #line 2824 "edn_parser.cc"
2829
2824
  switch( (*p) ) {
2830
2825
  case 10: goto tr3;
2831
2826
  case 32: goto st3;
@@ -2850,20 +2845,20 @@ case 3:
2850
2845
  goto tr4;
2851
2846
  goto st0;
2852
2847
  tr4:
2853
- #line 906 "edn_parser.rl"
2848
+ #line 901 "edn_parser.rl"
2854
2849
  {
2855
2850
  // parses the value portion
2856
2851
  const char *np = parse_value(p, pe, data);
2857
2852
  if (np == NULL) { p--; {p++; cs = 6; goto _out;} } else { {p = (( np))-1;} }
2858
2853
  }
2859
- #line 61 "edn_parser.rl"
2854
+ #line 57 "edn_parser.rl"
2860
2855
  { p--; {p++; cs = 6; goto _out;} }
2861
2856
  goto st6;
2862
2857
  st6:
2863
2858
  if ( ++p == pe )
2864
2859
  goto _test_eof6;
2865
2860
  case 6:
2866
- #line 2867 "edn_parser.cc"
2861
+ #line 2862 "edn_parser.cc"
2867
2862
  goto st0;
2868
2863
  st4:
2869
2864
  if ( ++p == pe )
@@ -2873,20 +2868,20 @@ case 4:
2873
2868
  goto tr3;
2874
2869
  goto st4;
2875
2870
  tr5:
2876
- #line 906 "edn_parser.rl"
2871
+ #line 901 "edn_parser.rl"
2877
2872
  {
2878
2873
  // parses the value portion
2879
2874
  const char *np = parse_value(p, pe, data);
2880
2875
  if (np == NULL) { p--; {p++; cs = 7; goto _out;} } else { {p = (( np))-1;} }
2881
2876
  }
2882
- #line 61 "edn_parser.rl"
2877
+ #line 57 "edn_parser.rl"
2883
2878
  { p--; {p++; cs = 7; goto _out;} }
2884
2879
  goto st7;
2885
2880
  st7:
2886
2881
  if ( ++p == pe )
2887
2882
  goto _test_eof7;
2888
2883
  case 7:
2889
- #line 2890 "edn_parser.cc"
2884
+ #line 2885 "edn_parser.cc"
2890
2885
  switch( (*p) ) {
2891
2886
  case 10: goto tr3;
2892
2887
  case 32: goto st3;
@@ -2923,20 +2918,20 @@ case 7:
2923
2918
  goto tr5;
2924
2919
  goto st0;
2925
2920
  tr6:
2926
- #line 906 "edn_parser.rl"
2921
+ #line 901 "edn_parser.rl"
2927
2922
  {
2928
2923
  // parses the value portion
2929
2924
  const char *np = parse_value(p, pe, data);
2930
2925
  if (np == NULL) { p--; {p++; cs = 8; goto _out;} } else { {p = (( np))-1;} }
2931
2926
  }
2932
- #line 61 "edn_parser.rl"
2927
+ #line 57 "edn_parser.rl"
2933
2928
  { p--; {p++; cs = 8; goto _out;} }
2934
2929
  goto st8;
2935
2930
  st8:
2936
2931
  if ( ++p == pe )
2937
2932
  goto _test_eof8;
2938
2933
  case 8:
2939
- #line 2940 "edn_parser.cc"
2934
+ #line 2935 "edn_parser.cc"
2940
2935
  if ( (*p) > 90 ) {
2941
2936
  if ( 97 <= (*p) && (*p) <= 122 )
2942
2937
  goto st5;
@@ -2983,20 +2978,20 @@ case 5:
2983
2978
  goto tr8;
2984
2979
  goto st0;
2985
2980
  tr8:
2986
- #line 906 "edn_parser.rl"
2981
+ #line 901 "edn_parser.rl"
2987
2982
  {
2988
2983
  // parses the value portion
2989
2984
  const char *np = parse_value(p, pe, data);
2990
2985
  if (np == NULL) { p--; {p++; cs = 9; goto _out;} } else { {p = (( np))-1;} }
2991
2986
  }
2992
- #line 61 "edn_parser.rl"
2987
+ #line 57 "edn_parser.rl"
2993
2988
  { p--; {p++; cs = 9; goto _out;} }
2994
2989
  goto st9;
2995
2990
  st9:
2996
2991
  if ( ++p == pe )
2997
2992
  goto _test_eof9;
2998
2993
  case 9:
2999
- #line 3000 "edn_parser.cc"
2994
+ #line 2995 "edn_parser.cc"
3000
2995
  switch( (*p) ) {
3001
2996
  case 10: goto tr3;
3002
2997
  case 32: goto st3;
@@ -3046,7 +3041,7 @@ case 9:
3046
3041
  _out: {}
3047
3042
  }
3048
3043
 
3049
- #line 926 "edn_parser.rl"
3044
+ #line 921 "edn_parser.rl"
3050
3045
 
3051
3046
  if (cs >= EDN_tagged_first_final) {
3052
3047
  //std::cerr << __FUNCTION__ << " parse symbol name as '" << sym_name << "', value is: " << data << std::endl;
@@ -3054,9 +3049,9 @@ case 9:
3054
3049
  try {
3055
3050
  // tagged_element makes a call to ruby which may throw an
3056
3051
  // exception when parsing the data
3057
- o = Parser::tagged_element(sym_name, data);
3058
- } catch (Rice::Exception& e) {
3059
- error(__FUNCTION__, e.message().str());
3052
+ v = Parser::tagged_element(sym_name, data);
3053
+ } catch (std::exception& e) {
3054
+ error(__FUNCTION__, e.what());
3060
3055
  return pe;
3061
3056
  }
3062
3057
  return p + 1;
@@ -3072,58 +3067,53 @@ case 9:
3072
3067
 
3073
3068
 
3074
3069
  // ============================================================
3075
- // main parsing machine
3070
+ // parses entire input but expects single valid token at the
3071
+ // top-level, therefore, does not tokenize source stream
3076
3072
  //
3077
3073
 
3078
- #line 3079 "edn_parser.cc"
3079
- static const int EDN_start = 2;
3080
- static const int EDN_error = 0;
3074
+ #line 3075 "edn_parser.cc"
3075
+ static const int EDN_parser_start = 2;
3076
+ static const int EDN_parser_first_final = 2;
3077
+ static const int EDN_parser_error = 0;
3081
3078
 
3082
- static const int EDN_en_main = 2;
3079
+ static const int EDN_parser_en_main = 2;
3083
3080
 
3084
3081
 
3085
- #line 969 "edn_parser.rl"
3082
+ #line 965 "edn_parser.rl"
3086
3083
 
3087
3084
 
3088
- //
3089
- // TODO: Currently using a sequence to handle cases with a discard
3090
- // but EDN's Reader allows token by token parsing
3091
- Rice::Object edn::Parser::parse(const char* buf, std::size_t len)
3085
+
3086
+ VALUE edn::Parser::parse(const char* src, std::size_t len)
3092
3087
  {
3093
3088
  int cs;
3094
- const char *p;
3095
- const char *pe;
3096
- Rice::Object result;
3089
+ VALUE result = Qnil;
3097
3090
 
3098
- // init
3099
- line_number = 1;
3100
- p_save = NULL;
3101
- while (!discard.empty())
3102
- discard.pop();
3091
+ // reset line counter & discard stack
3092
+ reset();
3103
3093
 
3104
3094
 
3105
- #line 3106 "edn_parser.cc"
3095
+ #line 3096 "edn_parser.cc"
3106
3096
  {
3107
- cs = EDN_start;
3097
+ cs = EDN_parser_start;
3108
3098
  }
3109
3099
 
3110
- #line 988 "edn_parser.rl"
3111
- p = &buf[0];
3100
+ #line 977 "edn_parser.rl"
3101
+ p = src;
3112
3102
  pe = p + len;
3113
- eof = pe; // eof defined in Parser class
3103
+ eof = pe;
3114
3104
 
3115
- #line 3116 "edn_parser.cc"
3105
+ #line 3106 "edn_parser.cc"
3116
3106
  {
3117
3107
  if ( p == pe )
3118
3108
  goto _test_eof;
3119
3109
  switch ( cs )
3120
3110
  {
3121
3111
  tr1:
3122
- #line 24 "edn_parser.rl"
3112
+ #line 20 "edn_parser.rl"
3123
3113
  { line_number++; }
3124
3114
  goto st2;
3125
3115
  tr4:
3126
- #line 959 "edn_parser.rl"
3116
+ #line 955 "edn_parser.rl"
3127
3117
  {
3128
3118
  const char* np = parse_value(p, pe, result);
3129
3119
  if (np == NULL) { {p = (( pe))-1;} {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
@@ -3133,7 +3123,7 @@ st2:
3133
3123
  if ( ++p == pe )
3134
3124
  goto _test_eof2;
3135
3125
  case 2:
3136
- #line 3137 "edn_parser.cc"
3126
+ #line 3127 "edn_parser.cc"
3137
3127
  switch( (*p) ) {
3138
3128
  case 10: goto tr1;
3139
3129
  case 32: goto st2;
@@ -3175,16 +3165,149 @@ case 1:
3175
3165
  _out: {}
3176
3166
  }
3177
3167
 
3178
- #line 992 "edn_parser.rl"
3168
+ #line 981 "edn_parser.rl"
3179
3169
 
3180
- if (cs == EDN_error) {
3170
+ if (cs == EDN_parser_error) {
3181
3171
  error(__FUNCTION__, *p);
3182
3172
  return Qnil;
3183
3173
  }
3184
- else if (cs == EDN_en_main) {} // silence ragel warning
3174
+ else if (cs == EDN_parser_first_final) {
3175
+ // whole source is parsed so reset
3176
+ p = pe = eof = NULL;
3177
+ reset();
3178
+ }
3179
+ else if (cs == EDN_parser_en_main) {} // silence ragel warning
3180
+ return result;
3181
+ }
3182
+
3183
+
3184
+ // ============================================================
3185
+ // token-by-token machine
3186
+ //
3187
+
3188
+ #line 3189 "edn_parser.cc"
3189
+ static const int EDN_tokens_start = 1;
3190
+
3191
+ static const int EDN_tokens_en_main = 1;
3192
+
3193
+
3194
+ #line 1013 "edn_parser.rl"
3195
+
3196
+
3197
+
3198
+ //
3199
+ //
3200
+ VALUE edn::Parser::next()
3201
+ {
3202
+ VALUE result = Qnil;
3203
+ int cs;
3204
+
3205
+
3206
+ #line 3207 "edn_parser.cc"
3207
+ {
3208
+ cs = EDN_tokens_start;
3209
+ }
3210
+
3211
+ #line 1024 "edn_parser.rl"
3212
+
3213
+ #line 3214 "edn_parser.cc"
3214
+ {
3215
+ if ( p == pe )
3216
+ goto _test_eof;
3217
+ switch ( cs )
3218
+ {
3219
+ tr2:
3220
+ #line 20 "edn_parser.rl"
3221
+ { line_number++; }
3222
+ goto st1;
3223
+ st1:
3224
+ if ( ++p == pe )
3225
+ goto _test_eof1;
3226
+ case 1:
3227
+ #line 3228 "edn_parser.cc"
3228
+ switch( (*p) ) {
3229
+ case 10: goto tr2;
3230
+ case 32: goto st1;
3231
+ case 40: goto tr3;
3232
+ case 44: goto st1;
3233
+ case 59: goto st3;
3234
+ case 95: goto tr3;
3235
+ }
3236
+ if ( (*p) < 42 ) {
3237
+ if ( (*p) > 13 ) {
3238
+ if ( 33 <= (*p) && (*p) <= 38 )
3239
+ goto tr3;
3240
+ } else if ( (*p) >= 9 )
3241
+ goto st1;
3242
+ } else if ( (*p) > 63 ) {
3243
+ if ( (*p) > 92 ) {
3244
+ if ( 97 <= (*p) && (*p) <= 123 )
3245
+ goto tr3;
3246
+ } else if ( (*p) >= 65 )
3247
+ goto tr3;
3248
+ } else
3249
+ goto tr3;
3250
+ goto st0;
3251
+ st0:
3252
+ cs = 0;
3253
+ goto _out;
3254
+ tr6:
3255
+ #line 20 "edn_parser.rl"
3256
+ { line_number++; }
3257
+ goto st4;
3258
+ tr3:
3259
+ #line 1005 "edn_parser.rl"
3260
+ {
3261
+ const char* np = parse_value(p, pe, result);
3262
+ if (np == NULL) { p--; {p++; cs = 4; goto _out;} } else { {p = (( np))-1;} }
3263
+ }
3264
+ goto st4;
3265
+ st4:
3266
+ if ( ++p == pe )
3267
+ goto _test_eof4;
3268
+ case 4:
3269
+ #line 3270 "edn_parser.cc"
3270
+ switch( (*p) ) {
3271
+ case 10: goto tr6;
3272
+ case 32: goto st4;
3273
+ case 44: goto st4;
3274
+ case 59: goto st2;
3275
+ }
3276
+ if ( 9 <= (*p) && (*p) <= 13 )
3277
+ goto st4;
3278
+ goto st0;
3279
+ st2:
3280
+ if ( ++p == pe )
3281
+ goto _test_eof2;
3282
+ case 2:
3283
+ if ( (*p) == 10 )
3284
+ goto tr6;
3285
+ goto st2;
3286
+ st3:
3287
+ if ( ++p == pe )
3288
+ goto _test_eof3;
3289
+ case 3:
3290
+ if ( (*p) == 10 )
3291
+ goto tr2;
3292
+ goto st3;
3293
+ }
3294
+ _test_eof1: cs = 1; goto _test_eof;
3295
+ _test_eof4: cs = 4; goto _test_eof;
3296
+ _test_eof2: cs = 2; goto _test_eof;
3297
+ _test_eof3: cs = 3; goto _test_eof;
3298
+
3299
+ _test_eof: {}
3300
+ _out: {}
3301
+ }
3302
+
3303
+ #line 1025 "edn_parser.rl"
3304
+
3305
+ if (cs == EDN_tokens_en_main) {} // silence ragel warning
3306
+
3185
3307
  return result;
3186
3308
  }
3187
3309
 
3310
+
3188
3311
  /*
3189
3312
  * Local variables:
3190
3313
  * mode: c