fabulator-grammar 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/History.txt +22 -0
  2. data/Rakefile +3 -1
  3. data/VERSION +1 -1
  4. data/features/grammar.feature +116 -12
  5. data/features/step_definitions/expression_steps.rb +2 -2
  6. data/features/step_definitions/grammar_steps.rb +46 -2
  7. data/features/step_definitions/xml_steps.rb +5 -16
  8. data/features/support/env.rb +1 -0
  9. data/lib/fabulator-grammar.rb +1 -0
  10. data/lib/fabulator/grammar.rb +12 -3
  11. data/lib/fabulator/grammar/actions.rb +17 -7
  12. data/lib/fabulator/grammar/actions/context.rb +18 -0
  13. data/lib/fabulator/grammar/actions/grammar.rb +76 -0
  14. data/lib/fabulator/grammar/actions/rule.rb +51 -0
  15. data/lib/fabulator/grammar/actions/token.rb +27 -0
  16. data/lib/fabulator/grammar/actions/when.rb +35 -0
  17. data/lib/fabulator/grammar/cursor.rb +118 -0
  18. data/lib/fabulator/grammar/expr/anchor.rb +28 -0
  19. data/lib/fabulator/grammar/expr/char_set.rb +67 -18
  20. data/lib/fabulator/grammar/expr/look_ahead.rb +44 -0
  21. data/lib/fabulator/grammar/expr/rule.rb +33 -28
  22. data/lib/fabulator/grammar/expr/rule_alternative.rb +45 -0
  23. data/lib/fabulator/grammar/expr/rule_mode.rb +16 -0
  24. data/lib/fabulator/grammar/expr/rule_ref.rb +15 -4
  25. data/lib/fabulator/grammar/expr/rule_sequence.rb +59 -0
  26. data/lib/fabulator/grammar/expr/sequence.rb +7 -1
  27. data/lib/fabulator/grammar/expr/set_skip.rb +16 -0
  28. data/lib/fabulator/grammar/expr/text.rb +8 -0
  29. data/lib/fabulator/grammar/expr/{rules.rb → token.rb} +12 -1
  30. data/lib/fabulator/grammar/expr/token_alternative.rb +42 -0
  31. data/lib/fabulator/grammar/rule_parser.rb +667 -0
  32. data/lib/fabulator/grammar/token_parser.rb +733 -0
  33. data/rules.racc +249 -0
  34. data/tokens.racc +257 -0
  35. metadata +29 -12
  36. data/lib/fabulator/grammar/parser.rb +0 -548
  37. data/regex.racc +0 -183
@@ -0,0 +1,733 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by Racc 1.4.6
4
+ # from Racc grammer file "".
5
+ #
6
+
7
+ require 'racc/parser.rb'
8
+ module Fabulator
9
+ module Grammar
10
+ class TokenParser < Racc::Parser
11
+
12
+ module_eval(<<'...end tokens.racc/module_eval...', 'tokens.racc', 70)
13
+ require 'fabulator/grammar'
14
+
15
+ def parse(t)
16
+ @source = t
17
+ @curpos = 0
18
+ @col = 0
19
+ @line = 0
20
+
21
+ @yydebug = true
22
+
23
+ @last_token = nil
24
+
25
+ @brackets = 0
26
+
27
+ do_parse
28
+ end
29
+
30
+ def on_error(*args)
31
+ raise Fabulator::Grammar::ParserError.new("unable to parse '#{args[1]}' near line #{@line + 1}, column #{@col}")
32
+ end
33
+
34
+ @@ops = {
35
+ #'[{' => :LB_LC,
36
+ #'}]' => :RC_RB,
37
+ #'[[' => :LB_LB,
38
+ #']]' => :RB_RB,
39
+ '[' => :LB,
40
+ ']' => :RB,
41
+ '(' => :LP,
42
+ ')' => :RP,
43
+ #'{' => :LC,
44
+ #'}' => :RC,
45
+ #'#' => :HASH,
46
+ '$' => :DOLLAR,
47
+ '^' => :CARET,
48
+ #'&' => :AND,
49
+ '*' => :STAR,
50
+ '+' => :PLUS,
51
+ '-' => :MINUS,
52
+ '?' => :QUESTION,
53
+ '.' => :DOT,
54
+ '|' => :PIPE,
55
+ ',' => :COMMA,
56
+ ':' => :COLON
57
+ }
58
+
59
+
60
+ @@regex = {
61
+ :simple_tokens => %r{^(#{Regexp.union(@@ops.keys.sort_by{|a| a.length}.reverse.collect{ |k| k })})},
62
+ :ncname => %r{(?:[a-zA-Z_][-a-zA-Z0-9_.]*)}
63
+ }
64
+
65
+ #puts @@regex[:simple_tokens]
66
+
67
+ @@regex[:qname] = %r{((?:#{@@regex[:ncname]}:)?#{@@regex[:ncname]})}
68
+ @@regex[:general] = Regexp.compile(%{^#{@@regex[:qname]}|#{@@regex[:simple_tokens]}})
69
+
70
+ def next_token
71
+ @token = nil
72
+ white_space = 0
73
+ new_line = 0
74
+ while @curpos < @source.length && @source[@curpos..@curpos] =~ /\s/ do
75
+ if @source[@curpos..@curpos] =~ /\n/
76
+ new_line = new_line + 1
77
+ @line = @line + 1
78
+ @col = 0
79
+ else
80
+ @col = @col + 1
81
+ end
82
+ @curpos = @curpos + 1
83
+ white_space = white_space + 1
84
+ end
85
+
86
+ # skip comments delimited by (: :)
87
+ # comments can be nested
88
+ # these are XPath 2.0 comments
89
+ #
90
+ if @curpos < @source.length && @source[@curpos..@curpos+1] == '(:'
91
+ comment_depth = 1
92
+ @curpos = @curpos + 2
93
+ @col = @col + 2
94
+ while comment_depth > 0 && @curpos < @source.length
95
+ if @source[@curpos..@curpos+1] == '(:'
96
+ comment_depth = comment_depth + 1
97
+ @curpos = @curpos + 1
98
+ @col = @col + 1
99
+ end
100
+ if @source[@curpos..@curpos+1] == ':)'
101
+ comment_depth = comment_depth - 1
102
+ @curpos = @curpos + 1
103
+ @col = @col + 1
104
+ end
105
+ @curpos = @curpos + 1
106
+ @col = @col + 1
107
+ end
108
+ white_space = white_space + 1
109
+ end
110
+
111
+ while @curpos < @source.length && @source[@curpos..@curpos] =~ /\s/ do
112
+ if @source[@curpos..@curpos] =~ /\n/
113
+ new_line = new_line + 1
114
+ @line = @line + 1
115
+ @col = 0
116
+ else
117
+ @col = @col + 1
118
+ end
119
+ @curpos = @curpos + 1
120
+ white_space = white_space + 1
121
+ end
122
+
123
+ if @curpos >= @source.length
124
+ @last_token = nil
125
+ return [ false, false ]
126
+ end
127
+
128
+ # case @source[@curpos..@curpos]
129
+ # when '<': @token = [ :LT, '<' ]
130
+ # when '>': @token = [ :GT, '>' ]
131
+ # when '[': @token = [ :LB, '[' ]
132
+ # when ']': @token = [ :RB, ']' ]
133
+ # when '(': @token = [ :LP, '(' ]
134
+ # when ')': @token = [ :RP, ')' ]
135
+ # when '{': @token = [ :LC, '{' ]
136
+ # when '}': @token = [ :RC, '}' ]
137
+ # when ':': @token = [ :COLON, ':' ]
138
+ # when ',': @token = [ :COMMA, ',' ]
139
+ # when '|': @token = [ :PIPE, '|' ]
140
+ # when '*': @token = [ :STAR, '*' ]
141
+ # when '+': @token = [ :PLUS, '+' ]
142
+ # when '.': @token = [ :DOT, '.' ]
143
+ # when '?': @token = [ :QUESTION, '?' ]
144
+ # when '$': @token = [ :DOLLAR, '$' ]
145
+ # when '^': @token = [ :CARET, '^' ]
146
+ # end
147
+
148
+ res = @@regex[:simple_tokens].match(@source[@curpos..@source.length-1])
149
+ if !res.nil?
150
+ if !res[1].nil?
151
+ @token = [ @@ops[res[1]], res[1] ]
152
+ end
153
+ end
154
+
155
+ if @token.nil?
156
+ # get longest sequence of non-special characters
157
+ # if it's all digits, report INTEGER
158
+ # if it's a qname, report QNAME
159
+ # otherwise, report TEXT
160
+ @source[@curpos..@source.length-1] =~ /^(((\\.)|[^ \$\^\[\]\{\}\(\):,|*+.?])+)*/
161
+ text = $1
162
+ bits = text.split(/\\/)
163
+ text = bits.join('')
164
+ @curpos += bits.size - 1
165
+ @col += bits.size - 1
166
+ if text.length > 0
167
+ if @source[@curpos+text.length .. @curpos+text.length] =~ /[*?+\{]/
168
+ # TODO: make sure we backtrack properly if the last character is escaped
169
+ text = text[0..text.length-2]
170
+ @token = [ :TEXT, text ]
171
+ else
172
+ case text
173
+ when /^\d+$/: @token = [ :INTEGER, text ]
174
+ when /^#{@@regex[:ncname]}$/: @token = [ :NCNAME, text ]
175
+ else @token = [ :TEXT, text ]
176
+ end
177
+ end
178
+ end
179
+ end
180
+
181
+ if @token.nil?
182
+ puts "Uh oh... we don't know what to do: #{@source[@curpos .. @source.length-1]}"
183
+ else
184
+ @curpos += @token[1].length
185
+ @col += @token[1].length
186
+ end
187
+
188
+ if @token[0] == :LB
189
+ if @brackets == 0 && @source[@curpos..@source.length-1] =~ /^\s*\d/
190
+ @token[0] = :LLB
191
+ end
192
+ @brackets += 1
193
+ elsif @token[0] == :RB
194
+ @brackets -= 1
195
+ elsif @brackets > 1
196
+ @token[0] = :CHAR_TEXT
197
+ end
198
+
199
+ return @token
200
+ end
201
+ ...end tokens.racc/module_eval...
202
+ ##### State transition tables begin ###
203
+
204
+ racc_action_table = [
205
+ 11, 14, 17, 6, 19, 7, 11, 14, 17, 8,
206
+ 19, 10, 13, 16, 28, 8, 55, 10, 13, 16,
207
+ 65, 29, 31, 32, 54, 7, 35, 64, 36, 35,
208
+ 42, 36, 34, 46, 35, 34, 36, 35, 45, 36,
209
+ 34, 38, 35, 34, 36, 44, 38, 47, 34, 60,
210
+ 61, 58, 57, 43, 59, 53, 52, 53, 52, 50,
211
+ 41, 4, 26, 56, 25, 4, 23, 21, 4, 66,
212
+ 67, 68, 69, 70 ]
213
+
214
+ racc_action_check = [
215
+ 22, 22, 22, 1, 22, 1, 3, 3, 3, 22,
216
+ 3, 22, 22, 22, 18, 3, 46, 3, 3, 3,
217
+ 54, 18, 18, 18, 46, 27, 52, 54, 52, 38,
218
+ 27, 38, 52, 32, 53, 38, 53, 19, 31, 19,
219
+ 53, 19, 35, 19, 35, 29, 35, 34, 35, 49,
220
+ 49, 49, 48, 28, 49, 48, 48, 39, 39, 37,
221
+ 25, 17, 11, 47, 8, 7, 6, 4, 0, 58,
222
+ 61, 64, 65, 68 ]
223
+
224
+ racc_action_pointer = [
225
+ 65, 3, nil, 2, 64, nil, 66, 62, 52, nil,
226
+ nil, 58, nil, nil, nil, nil, nil, 58, 3, 31,
227
+ nil, nil, -4, nil, nil, 47, nil, 23, 34, 26,
228
+ nil, 19, 17, nil, 34, 36, nil, 50, 23, 47,
229
+ nil, nil, nil, nil, nil, nil, 7, 51, 45, 40,
230
+ nil, nil, 20, 28, 11, nil, nil, nil, 55, nil,
231
+ nil, 56, nil, nil, 62, 53, nil, nil, 54, nil,
232
+ nil ]
233
+
234
+ racc_action_default = [
235
+ -11, -48, -1, -3, -7, -11, -48, -11, -35, -31,
236
+ -32, -9, -5, -33, -16, -12, -34, -11, -14, -48,
237
+ -15, -8, -4, 71, -2, -48, -10, -48, -39, -37,
238
+ -13, -41, -48, -20, -48, -48, -27, -48, -48, -19,
239
+ -6, -36, -17, -40, -38, -42, -48, -48, -48, -48,
240
+ -18, -21, -48, -48, -48, -43, -25, -26, -48, -28,
241
+ -24, -48, -22, -23, -48, -45, -30, -29, -44, -46,
242
+ -47 ]
243
+
244
+ racc_goto_table = [
245
+ 12, 1, 51, 30, 39, 37, 22, 24, 49, nil,
246
+ nil, nil, nil, nil, nil, nil, 62, 63, 27, 40,
247
+ 48 ]
248
+
249
+ racc_goto_check = [
250
+ 5, 1, 12, 8, 11, 10, 3, 2, 13, nil,
251
+ nil, nil, nil, nil, nil, nil, 12, 12, 1, 5,
252
+ 11 ]
253
+
254
+ racc_goto_pointer = [
255
+ nil, 1, 0, 1, nil, -3, nil, nil, -15, nil,
256
+ -14, -15, -36, -28, nil ]
257
+
258
+ racc_goto_default = [
259
+ nil, nil, 2, 3, 5, nil, 15, 18, nil, 20,
260
+ nil, nil, 33, nil, 9 ]
261
+
262
+ racc_reduce_table = [
263
+ 0, 0, :racc_error,
264
+ 1, 22, :_reduce_1,
265
+ 3, 22, :_reduce_2,
266
+ 1, 23, :_reduce_3,
267
+ 2, 23, :_reduce_4,
268
+ 2, 23, :_reduce_5,
269
+ 3, 23, :_reduce_6,
270
+ 1, 25, :_reduce_7,
271
+ 2, 25, :_reduce_8,
272
+ 1, 26, :_reduce_9,
273
+ 2, 26, :_reduce_10,
274
+ 0, 24, :_reduce_11,
275
+ 2, 24, :_reduce_12,
276
+ 2, 27, :_reduce_13,
277
+ 1, 27, :_reduce_14,
278
+ 1, 28, :_reduce_15,
279
+ 1, 28, :_reduce_16,
280
+ 3, 28, :_reduce_17,
281
+ 3, 28, :_reduce_18,
282
+ 1, 31, :_reduce_none,
283
+ 1, 32, :_reduce_20,
284
+ 2, 32, :_reduce_21,
285
+ 3, 32, :_reduce_22,
286
+ 3, 32, :_reduce_23,
287
+ 3, 33, :_reduce_24,
288
+ 3, 33, :_reduce_25,
289
+ 3, 33, :_reduce_26,
290
+ 0, 34, :_reduce_27,
291
+ 2, 34, :_reduce_28,
292
+ 3, 34, :_reduce_29,
293
+ 3, 34, :_reduce_30,
294
+ 1, 30, :_reduce_31,
295
+ 1, 30, :_reduce_32,
296
+ 1, 30, :_reduce_33,
297
+ 1, 30, :_reduce_34,
298
+ 1, 35, :_reduce_35,
299
+ 3, 35, :_reduce_36,
300
+ 1, 29, :_reduce_37,
301
+ 2, 29, :_reduce_38,
302
+ 1, 29, :_reduce_39,
303
+ 2, 29, :_reduce_40,
304
+ 1, 29, :_reduce_41,
305
+ 2, 29, :_reduce_42,
306
+ 3, 29, :_reduce_43,
307
+ 5, 29, :_reduce_44,
308
+ 4, 29, :_reduce_45,
309
+ 5, 29, :_reduce_46,
310
+ 6, 29, :_reduce_47 ]
311
+
312
+ racc_reduce_n = 48
313
+
314
+ racc_shift_n = 71
315
+
316
+ racc_token_table = {
317
+ false => 0,
318
+ :error => 1,
319
+ :PIPE => 2,
320
+ :CARET => 3,
321
+ :DOLLAR => 4,
322
+ :DOT => 5,
323
+ :LP => 6,
324
+ :RP => 7,
325
+ :LB => 8,
326
+ :RB => 9,
327
+ :MINUS => 10,
328
+ :PLUS => 11,
329
+ :COLON => 12,
330
+ :NCNAME => 13,
331
+ :CHAR_TEXT => 14,
332
+ :TEXT => 15,
333
+ :INTEGER => 16,
334
+ :COMMA => 17,
335
+ :STAR => 18,
336
+ :QUESTION => 19,
337
+ :LLB => 20 }
338
+
339
+ racc_nt_base = 21
340
+
341
+ racc_use_result_var = true
342
+
343
+ Racc_arg = [
344
+ racc_action_table,
345
+ racc_action_check,
346
+ racc_action_default,
347
+ racc_action_pointer,
348
+ racc_goto_table,
349
+ racc_goto_check,
350
+ racc_goto_default,
351
+ racc_goto_pointer,
352
+ racc_nt_base,
353
+ racc_reduce_table,
354
+ racc_token_table,
355
+ racc_shift_n,
356
+ racc_reduce_n,
357
+ racc_use_result_var ]
358
+
359
+ Racc_token_to_s_table = [
360
+ "$end",
361
+ "error",
362
+ "PIPE",
363
+ "CARET",
364
+ "DOLLAR",
365
+ "DOT",
366
+ "LP",
367
+ "RP",
368
+ "LB",
369
+ "RB",
370
+ "MINUS",
371
+ "PLUS",
372
+ "COLON",
373
+ "NCNAME",
374
+ "CHAR_TEXT",
375
+ "TEXT",
376
+ "INTEGER",
377
+ "COMMA",
378
+ "STAR",
379
+ "QUESTION",
380
+ "LLB",
381
+ "$start",
382
+ "rules",
383
+ "anchored_rule",
384
+ "rule",
385
+ "left_anchor",
386
+ "right_anchor",
387
+ "sequence",
388
+ "atom",
389
+ "sequence_qualifiers",
390
+ "text",
391
+ "atom_expr",
392
+ "char_set_expr",
393
+ "char_set",
394
+ "char_set_text",
395
+ "qname" ]
396
+
397
+ Racc_debug_parser = false
398
+
399
+ ##### State transition tables end #####
400
+
401
+ # reduce 0 omitted
402
+
403
+ module_eval(<<'.,.,', 'tokens.racc', 5)
404
+ def _reduce_1(val, _values, result)
405
+ result = Fabulator::Grammar::Expr::Token.new; result.add_alternative(val[0])
406
+ result
407
+ end
408
+ .,.,
409
+
410
+ module_eval(<<'.,.,', 'tokens.racc', 6)
411
+ def _reduce_2(val, _values, result)
412
+ result = val[0]; result.add_alternative(val[2])
413
+ result
414
+ end
415
+ .,.,
416
+
417
+ module_eval(<<'.,.,', 'tokens.racc', 8)
418
+ def _reduce_3(val, _values, result)
419
+ result = val[0]
420
+ result
421
+ end
422
+ .,.,
423
+
424
+ module_eval(<<'.,.,', 'tokens.racc', 9)
425
+ def _reduce_4(val, _values, result)
426
+ result = val[1]; result.anchor_start(val[0])
427
+ result
428
+ end
429
+ .,.,
430
+
431
+ module_eval(<<'.,.,', 'tokens.racc', 10)
432
+ def _reduce_5(val, _values, result)
433
+ result = val[0]; result.anchor_end(val[1])
434
+ result
435
+ end
436
+ .,.,
437
+
438
+ module_eval(<<'.,.,', 'tokens.racc', 11)
439
+ def _reduce_6(val, _values, result)
440
+ result = val[1]; result.anchor_start(val[0]); result.anchor_end(val[2])
441
+ result
442
+ end
443
+ .,.,
444
+
445
+ module_eval(<<'.,.,', 'tokens.racc', 13)
446
+ def _reduce_7(val, _values, result)
447
+ result = '^'
448
+ result
449
+ end
450
+ .,.,
451
+
452
+ module_eval(<<'.,.,', 'tokens.racc', 14)
453
+ def _reduce_8(val, _values, result)
454
+ result = '^^'
455
+ result
456
+ end
457
+ .,.,
458
+
459
+ module_eval(<<'.,.,', 'tokens.racc', 16)
460
+ def _reduce_9(val, _values, result)
461
+ result = '$'
462
+ result
463
+ end
464
+ .,.,
465
+
466
+ module_eval(<<'.,.,', 'tokens.racc', 17)
467
+ def _reduce_10(val, _values, result)
468
+ result = '$$'
469
+ result
470
+ end
471
+ .,.,
472
+
473
+ module_eval(<<'.,.,', 'tokens.racc', 19)
474
+ def _reduce_11(val, _values, result)
475
+ result = Fabulator::Grammar::Expr::TokenAlternative.new;
476
+ result
477
+ end
478
+ .,.,
479
+
480
+ module_eval(<<'.,.,', 'tokens.racc', 20)
481
+ def _reduce_12(val, _values, result)
482
+ result = val[0]; result.add_sequence(val[1]);
483
+ result
484
+ end
485
+ .,.,
486
+
487
+ module_eval(<<'.,.,', 'tokens.racc', 22)
488
+ def _reduce_13(val, _values, result)
489
+ result = Fabulator::Grammar::Expr::Sequence.new(nil, val[0], val[1])
490
+ result
491
+ end
492
+ .,.,
493
+
494
+ module_eval(<<'.,.,', 'tokens.racc', 23)
495
+ def _reduce_14(val, _values, result)
496
+ result = Fabulator::Grammar::Expr::Sequence.new(nil, val[0])
497
+ result
498
+ end
499
+ .,.,
500
+
501
+ module_eval(<<'.,.,', 'tokens.racc', 25)
502
+ def _reduce_15(val, _values, result)
503
+ result = Fabulator::Grammar::Expr::Text.new(val[0])
504
+ result
505
+ end
506
+ .,.,
507
+
508
+ module_eval(<<'.,.,', 'tokens.racc', 26)
509
+ def _reduce_16(val, _values, result)
510
+ result = Fabulator::Grammar::Expr::Any.new
511
+ result
512
+ end
513
+ .,.,
514
+
515
+ module_eval(<<'.,.,', 'tokens.racc', 27)
516
+ def _reduce_17(val, _values, result)
517
+ result = val[1]
518
+ result
519
+ end
520
+ .,.,
521
+
522
+ module_eval(<<'.,.,', 'tokens.racc', 28)
523
+ def _reduce_18(val, _values, result)
524
+ result = val[1]
525
+ result
526
+ end
527
+ .,.,
528
+
529
+ # reduce 19 omitted
530
+
531
+ module_eval(<<'.,.,', 'tokens.racc', 33)
532
+ def _reduce_20(val, _values, result)
533
+ result = val[0]
534
+ result
535
+ end
536
+ .,.,
537
+
538
+ module_eval(<<'.,.,', 'tokens.racc', 34)
539
+ def _reduce_21(val, _values, result)
540
+ result = Fabulator::Grammar::Expr::CharSet.new; result.universal; result.but_not(val[1])
541
+ result
542
+ end
543
+ .,.,
544
+
545
+ module_eval(<<'.,.,', 'tokens.racc', 35)
546
+ def _reduce_22(val, _values, result)
547
+ result = val[0].or(val[2])
548
+ result
549
+ end
550
+ .,.,
551
+
552
+ module_eval(<<'.,.,', 'tokens.racc', 36)
553
+ def _reduce_23(val, _values, result)
554
+ result = val[0].but_not(val[2])
555
+ result
556
+ end
557
+ .,.,
558
+
559
+ module_eval(<<'.,.,', 'tokens.racc', 38)
560
+ def _reduce_24(val, _values, result)
561
+ result = Fabulator::Grammar::Expr::CharSet.new(val[1])
562
+ result
563
+ end
564
+ .,.,
565
+
566
+ module_eval(<<'.,.,', 'tokens.racc', 39)
567
+ def _reduce_25(val, _values, result)
568
+ result = Fabulator::Grammar::Expr::CharClass.new(val[1])
569
+ result
570
+ end
571
+ .,.,
572
+
573
+ module_eval(<<'.,.,', 'tokens.racc', 40)
574
+ def _reduce_26(val, _values, result)
575
+ result = val[1]
576
+ result
577
+ end
578
+ .,.,
579
+
580
+ module_eval(<<'.,.,', 'tokens.racc', 42)
581
+ def _reduce_27(val, _values, result)
582
+ result = ''
583
+ result
584
+ end
585
+ .,.,
586
+
587
+ module_eval(<<'.,.,', 'tokens.racc', 43)
588
+ def _reduce_28(val, _values, result)
589
+ result = val[0] + val[1]
590
+ result
591
+ end
592
+ .,.,
593
+
594
+ module_eval(<<'.,.,', 'tokens.racc', 44)
595
+ def _reduce_29(val, _values, result)
596
+ result = val[0] + '-' + val[2]
597
+ result
598
+ end
599
+ .,.,
600
+
601
+ module_eval(<<'.,.,', 'tokens.racc', 45)
602
+ def _reduce_30(val, _values, result)
603
+ result = val[0] + '+' + val[2]
604
+ result
605
+ end
606
+ .,.,
607
+
608
+ module_eval(<<'.,.,', 'tokens.racc', 47)
609
+ def _reduce_31(val, _values, result)
610
+ result = val[0]
611
+ result
612
+ end
613
+ .,.,
614
+
615
+ module_eval(<<'.,.,', 'tokens.racc', 48)
616
+ def _reduce_32(val, _values, result)
617
+ result = val[0]
618
+ result
619
+ end
620
+ .,.,
621
+
622
+ module_eval(<<'.,.,', 'tokens.racc', 49)
623
+ def _reduce_33(val, _values, result)
624
+ result = val[0]
625
+ result
626
+ end
627
+ .,.,
628
+
629
+ module_eval(<<'.,.,', 'tokens.racc', 50)
630
+ def _reduce_34(val, _values, result)
631
+ result = val[0]
632
+ result
633
+ end
634
+ .,.,
635
+
636
+ module_eval(<<'.,.,', 'tokens.racc', 52)
637
+ def _reduce_35(val, _values, result)
638
+ result = val[0]
639
+ result
640
+ end
641
+ .,.,
642
+
643
+ module_eval(<<'.,.,', 'tokens.racc', 53)
644
+ def _reduce_36(val, _values, result)
645
+ result = val[0] + ':' + val[2]
646
+ result
647
+ end
648
+ .,.,
649
+
650
+ module_eval(<<'.,.,', 'tokens.racc', 55)
651
+ def _reduce_37(val, _values, result)
652
+ result = [ :zero_or_more ]
653
+ result
654
+ end
655
+ .,.,
656
+
657
+ module_eval(<<'.,.,', 'tokens.racc', 56)
658
+ def _reduce_38(val, _values, result)
659
+ result = [ :zero_or_more, :min ]
660
+ result
661
+ end
662
+ .,.,
663
+
664
+ module_eval(<<'.,.,', 'tokens.racc', 57)
665
+ def _reduce_39(val, _values, result)
666
+ result = [ :one_or_more ]
667
+ result
668
+ end
669
+ .,.,
670
+
671
+ module_eval(<<'.,.,', 'tokens.racc', 58)
672
+ def _reduce_40(val, _values, result)
673
+ result = [ :one_or_more, :min ]
674
+ result
675
+ end
676
+ .,.,
677
+
678
+ module_eval(<<'.,.,', 'tokens.racc', 59)
679
+ def _reduce_41(val, _values, result)
680
+ result = [ :zero_or_one ]
681
+ result
682
+ end
683
+ .,.,
684
+
685
+ module_eval(<<'.,.,', 'tokens.racc', 60)
686
+ def _reduce_42(val, _values, result)
687
+ result = [ :zero_or_one, :min ]
688
+ result
689
+ end
690
+ .,.,
691
+
692
+ module_eval(<<'.,.,', 'tokens.racc', 61)
693
+ def _reduce_43(val, _values, result)
694
+ result = [ :exact, val[1].to_i ]
695
+ result
696
+ end
697
+ .,.,
698
+
699
+ module_eval(<<'.,.,', 'tokens.racc', 62)
700
+ def _reduce_44(val, _values, result)
701
+ result = [ :range, val[1].to_i, val[3].to_i ]
702
+ result
703
+ end
704
+ .,.,
705
+
706
+ module_eval(<<'.,.,', 'tokens.racc', 63)
707
+ def _reduce_45(val, _values, result)
708
+ result = [ :range, val[1], '' ]
709
+ result
710
+ end
711
+ .,.,
712
+
713
+ module_eval(<<'.,.,', 'tokens.racc', 64)
714
+ def _reduce_46(val, _values, result)
715
+ result = [ :min, :range, val[1], '' ]
716
+ result
717
+ end
718
+ .,.,
719
+
720
+ module_eval(<<'.,.,', 'tokens.racc', 65)
721
+ def _reduce_47(val, _values, result)
722
+ result = [ :min, :range, val[1].to_i, val[3].to_i ]
723
+ result
724
+ end
725
+ .,.,
726
+
727
+ def _reduce_none(val, _values, result)
728
+ val[0]
729
+ end
730
+
731
+ end # class TokenParser
732
+ end # module Grammar
733
+ end # module Fabulator