iregexp 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1978 @@
1
+ # Encoding: UTF-8
2
+ # Autogenerated from a Treetop grammar. Edits may be lost.
3
+
4
+
5
+ module IREGEXPGRAMMAR
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :i_regexp
10
+ end
11
+
12
+ module IRegexp0
13
+ def branch
14
+ elements[1]
15
+ end
16
+ end
17
+
18
+ module IRegexp1
19
+ def branch
20
+ elements[0]
21
+ end
22
+
23
+ end
24
+
25
+ module IRegexp2
26
+ def ast
27
+ if elements[1].text_value == ''
28
+ elements[0].ast
29
+ else
30
+ ["alt", elements[0].ast, *elements[1].elements.map{|el| el.elements[1].ast}]
31
+ end
32
+ end
33
+ end
34
+
35
+ def _nt_i_regexp
36
+ start_index = index
37
+ if node_cache[:i_regexp].has_key?(index)
38
+ cached = node_cache[:i_regexp][index]
39
+ if cached
40
+ node_cache[:i_regexp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
41
+ @index = cached.interval.end
42
+ end
43
+ return cached
44
+ end
45
+
46
+ i0, s0 = index, []
47
+ r1 = _nt_branch
48
+ s0 << r1
49
+ if r1
50
+ s2, i2 = [], index
51
+ loop do
52
+ i3, s3 = index, []
53
+ if (match_len = has_terminal?("|", false, index))
54
+ r4 = true
55
+ @index += match_len
56
+ else
57
+ terminal_parse_failure('"|"')
58
+ r4 = nil
59
+ end
60
+ s3 << r4
61
+ if r4
62
+ r5 = _nt_branch
63
+ s3 << r5
64
+ end
65
+ if s3.last
66
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
67
+ r3.extend(IRegexp0)
68
+ else
69
+ @index = i3
70
+ r3 = nil
71
+ end
72
+ if r3
73
+ s2 << r3
74
+ else
75
+ break
76
+ end
77
+ end
78
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
79
+ s0 << r2
80
+ end
81
+ if s0.last
82
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
83
+ r0.extend(IRegexp1)
84
+ r0.extend(IRegexp2)
85
+ else
86
+ @index = i0
87
+ r0 = nil
88
+ end
89
+
90
+ node_cache[:i_regexp][start_index] = r0
91
+
92
+ r0
93
+ end
94
+
95
+ module Branch0
96
+ def ast
97
+ pieces = elements.map{|el| el.ast}
98
+ if pieces.size == 1
99
+ pieces[0]
100
+ else
101
+ ["seq", *pieces]
102
+ end
103
+ end
104
+ end
105
+
106
+ def _nt_branch
107
+ start_index = index
108
+ if node_cache[:branch].has_key?(index)
109
+ cached = node_cache[:branch][index]
110
+ if cached
111
+ node_cache[:branch][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
112
+ @index = cached.interval.end
113
+ end
114
+ return cached
115
+ end
116
+
117
+ s0, i0 = [], index
118
+ loop do
119
+ r1 = _nt_piece
120
+ if r1
121
+ s0 << r1
122
+ else
123
+ break
124
+ end
125
+ end
126
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
127
+ r0.extend(Branch0)
128
+ r0.extend(Branch0)
129
+
130
+ node_cache[:branch][start_index] = r0
131
+
132
+ r0
133
+ end
134
+
135
+ module Piece0
136
+ def atom
137
+ elements[0]
138
+ end
139
+
140
+ end
141
+
142
+ module Piece1
143
+ def ast
144
+ a = atom.ast
145
+ if elements[1].text_value != ''
146
+ q = elements[1].ast
147
+ ["rep", *q, a]
148
+ else
149
+ a
150
+ end
151
+ end
152
+ end
153
+
154
+ def _nt_piece
155
+ start_index = index
156
+ if node_cache[:piece].has_key?(index)
157
+ cached = node_cache[:piece][index]
158
+ if cached
159
+ node_cache[:piece][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
160
+ @index = cached.interval.end
161
+ end
162
+ return cached
163
+ end
164
+
165
+ i0, s0 = index, []
166
+ r1 = _nt_atom
167
+ s0 << r1
168
+ if r1
169
+ r3 = _nt_quantifier
170
+ if r3
171
+ r2 = r3
172
+ else
173
+ r2 = instantiate_node(SyntaxNode,input, index...index)
174
+ end
175
+ s0 << r2
176
+ end
177
+ if s0.last
178
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
179
+ r0.extend(Piece0)
180
+ r0.extend(Piece1)
181
+ else
182
+ @index = i0
183
+ r0 = nil
184
+ end
185
+
186
+ node_cache[:piece][start_index] = r0
187
+
188
+ r0
189
+ end
190
+
191
+ module Quantifier0
192
+ def ast
193
+ {"*" => [0, false],
194
+ "+" => [1, false],
195
+ "?" => [0, 1]}[text_value]
196
+ end
197
+ end
198
+
199
+ module Quantifier1
200
+ def quantity
201
+ elements[1]
202
+ end
203
+
204
+ end
205
+
206
+ module Quantifier2
207
+ def ast
208
+ quantity.ast
209
+ end
210
+ end
211
+
212
+ def _nt_quantifier
213
+ start_index = index
214
+ if node_cache[:quantifier].has_key?(index)
215
+ cached = node_cache[:quantifier][index]
216
+ if cached
217
+ node_cache[:quantifier][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
218
+ @index = cached.interval.end
219
+ end
220
+ return cached
221
+ end
222
+
223
+ i0 = index
224
+ i1 = index
225
+ if has_terminal?(@regexps[gr = '\A[\\*-\\+]'] ||= Regexp.new(gr), :regexp, index)
226
+ r2 = true
227
+ @index += 1
228
+ else
229
+ terminal_parse_failure('[\\*-\\+]')
230
+ r2 = nil
231
+ end
232
+ if r2
233
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
234
+ r1 = r2
235
+ r1.extend(Quantifier0)
236
+ r1.extend(Quantifier0)
237
+ else
238
+ if (match_len = has_terminal?("?", false, index))
239
+ r3 = true
240
+ @index += match_len
241
+ else
242
+ terminal_parse_failure('"?"')
243
+ r3 = nil
244
+ end
245
+ if r3
246
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
247
+ r1 = r3
248
+ r1.extend(Quantifier0)
249
+ r1.extend(Quantifier0)
250
+ else
251
+ @index = i1
252
+ r1 = nil
253
+ end
254
+ end
255
+ if r1
256
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
257
+ r0 = r1
258
+ else
259
+ i4, s4 = index, []
260
+ if (match_len = has_terminal?("{", false, index))
261
+ r5 = true
262
+ @index += match_len
263
+ else
264
+ terminal_parse_failure('"{"')
265
+ r5 = nil
266
+ end
267
+ s4 << r5
268
+ if r5
269
+ r6 = _nt_quantity
270
+ s4 << r6
271
+ if r6
272
+ if (match_len = has_terminal?("}", false, index))
273
+ r7 = true
274
+ @index += match_len
275
+ else
276
+ terminal_parse_failure('"}"')
277
+ r7 = nil
278
+ end
279
+ s4 << r7
280
+ end
281
+ end
282
+ if s4.last
283
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
284
+ r4.extend(Quantifier1)
285
+ r4.extend(Quantifier2)
286
+ else
287
+ @index = i4
288
+ r4 = nil
289
+ end
290
+ if r4
291
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
292
+ r0 = r4
293
+ else
294
+ @index = i0
295
+ r0 = nil
296
+ end
297
+ end
298
+
299
+ node_cache[:quantifier][start_index] = r0
300
+
301
+ r0
302
+ end
303
+
304
+ module Quantity0
305
+ end
306
+
307
+ module Quantity1
308
+ def QuantExact
309
+ elements[0]
310
+ end
311
+
312
+ end
313
+
314
+ module Quantity2
315
+ def ast
316
+ l = elements[0].ast
317
+ r = if rp = elements[1].elements
318
+ if rp[1].text_value != ''
319
+ rp[1].ast
320
+ else
321
+ false
322
+ end
323
+ else
324
+ l
325
+ end
326
+ [l, r]
327
+ end
328
+ end
329
+
330
+ def _nt_quantity
331
+ start_index = index
332
+ if node_cache[:quantity].has_key?(index)
333
+ cached = node_cache[:quantity][index]
334
+ if cached
335
+ node_cache[:quantity][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
336
+ @index = cached.interval.end
337
+ end
338
+ return cached
339
+ end
340
+
341
+ i0, s0 = index, []
342
+ r1 = _nt_QuantExact
343
+ s0 << r1
344
+ if r1
345
+ i3, s3 = index, []
346
+ if (match_len = has_terminal?(",", false, index))
347
+ r4 = true
348
+ @index += match_len
349
+ else
350
+ terminal_parse_failure('","')
351
+ r4 = nil
352
+ end
353
+ s3 << r4
354
+ if r4
355
+ r6 = _nt_QuantExact
356
+ if r6
357
+ r5 = r6
358
+ else
359
+ r5 = instantiate_node(SyntaxNode,input, index...index)
360
+ end
361
+ s3 << r5
362
+ end
363
+ if s3.last
364
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
365
+ r3.extend(Quantity0)
366
+ else
367
+ @index = i3
368
+ r3 = nil
369
+ end
370
+ if r3
371
+ r2 = r3
372
+ else
373
+ r2 = instantiate_node(SyntaxNode,input, index...index)
374
+ end
375
+ s0 << r2
376
+ end
377
+ if s0.last
378
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
379
+ r0.extend(Quantity1)
380
+ r0.extend(Quantity2)
381
+ else
382
+ @index = i0
383
+ r0 = nil
384
+ end
385
+
386
+ node_cache[:quantity][start_index] = r0
387
+
388
+ r0
389
+ end
390
+
391
+ module QuantExact0
392
+ def ast
393
+ Integer(text_value)
394
+ end
395
+ end
396
+
397
+ def _nt_QuantExact
398
+ start_index = index
399
+ if node_cache[:QuantExact].has_key?(index)
400
+ cached = node_cache[:QuantExact][index]
401
+ if cached
402
+ node_cache[:QuantExact][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
403
+ @index = cached.interval.end
404
+ end
405
+ return cached
406
+ end
407
+
408
+ s0, i0 = [], index
409
+ loop do
410
+ if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
411
+ r1 = true
412
+ @index += 1
413
+ else
414
+ terminal_parse_failure('[0-9]')
415
+ r1 = nil
416
+ end
417
+ if r1
418
+ s0 << r1
419
+ else
420
+ break
421
+ end
422
+ end
423
+ if s0.empty?
424
+ @index = i0
425
+ r0 = nil
426
+ else
427
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
428
+ r0.extend(QuantExact0)
429
+ r0.extend(QuantExact0)
430
+ end
431
+
432
+ node_cache[:QuantExact][start_index] = r0
433
+
434
+ r0
435
+ end
436
+
437
+ module Atom0
438
+ def i_regexp
439
+ elements[1]
440
+ end
441
+
442
+ end
443
+
444
+ module Atom1
445
+ def ast
446
+ elements[1].ast
447
+ end
448
+ end
449
+
450
+ def _nt_atom
451
+ start_index = index
452
+ if node_cache[:atom].has_key?(index)
453
+ cached = node_cache[:atom][index]
454
+ if cached
455
+ node_cache[:atom][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
456
+ @index = cached.interval.end
457
+ end
458
+ return cached
459
+ end
460
+
461
+ i0 = index
462
+ r1 = _nt_NormalChar
463
+ if r1
464
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
465
+ r0 = r1
466
+ else
467
+ r2 = _nt_charClass
468
+ if r2
469
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
470
+ r0 = r2
471
+ else
472
+ i3, s3 = index, []
473
+ if (match_len = has_terminal?("(", false, index))
474
+ r4 = true
475
+ @index += match_len
476
+ else
477
+ terminal_parse_failure('"("')
478
+ r4 = nil
479
+ end
480
+ s3 << r4
481
+ if r4
482
+ r5 = _nt_i_regexp
483
+ s3 << r5
484
+ if r5
485
+ if (match_len = has_terminal?(")", false, index))
486
+ r6 = true
487
+ @index += match_len
488
+ else
489
+ terminal_parse_failure('")"')
490
+ r6 = nil
491
+ end
492
+ s3 << r6
493
+ end
494
+ end
495
+ if s3.last
496
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
497
+ r3.extend(Atom0)
498
+ r3.extend(Atom1)
499
+ else
500
+ @index = i3
501
+ r3 = nil
502
+ end
503
+ if r3
504
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
505
+ r0 = r3
506
+ else
507
+ @index = i0
508
+ r0 = nil
509
+ end
510
+ end
511
+ end
512
+
513
+ node_cache[:atom][start_index] = r0
514
+
515
+ r0
516
+ end
517
+
518
+ module NormalChar0
519
+ #'
520
+ def ast
521
+ text_value
522
+ end
523
+ end
524
+
525
+ def _nt_NormalChar
526
+ start_index = index
527
+ if node_cache[:NormalChar].has_key?(index)
528
+ cached = node_cache[:NormalChar][index]
529
+ if cached
530
+ node_cache[:NormalChar][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
531
+ @index = cached.interval.end
532
+ end
533
+ return cached
534
+ end
535
+
536
+ i0 = index
537
+ if has_terminal?(@regexps[gr = '\A[-\']'] ||= Regexp.new(gr), :regexp, index)
538
+ r1 = true
539
+ @index += 1
540
+ else
541
+ terminal_parse_failure('[-\']')
542
+ r1 = nil
543
+ end
544
+ if r1
545
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
546
+ r0 = r1
547
+ r0.extend(NormalChar0)
548
+ r0.extend(NormalChar0)
549
+ else
550
+ if has_terminal?(@regexps[gr = '\A[,-\\-]'] ||= Regexp.new(gr), :regexp, index)
551
+ r2 = true
552
+ @index += 1
553
+ else
554
+ terminal_parse_failure('[,-\\-]')
555
+ r2 = nil
556
+ end
557
+ if r2
558
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
559
+ r0 = r2
560
+ r0.extend(NormalChar0)
561
+ r0.extend(NormalChar0)
562
+ else
563
+ if has_terminal?(@regexps[gr = '\A[/->]'] ||= Regexp.new(gr), :regexp, index)
564
+ r3 = true
565
+ @index += 1
566
+ else
567
+ terminal_parse_failure('[/->]')
568
+ r3 = nil
569
+ end
570
+ if r3
571
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
572
+ r0 = r3
573
+ r0.extend(NormalChar0)
574
+ r0.extend(NormalChar0)
575
+ else
576
+ if has_terminal?(@regexps[gr = '\A[@-Z]'] ||= Regexp.new(gr), :regexp, index)
577
+ r4 = true
578
+ @index += 1
579
+ else
580
+ terminal_parse_failure('[@-Z]')
581
+ r4 = nil
582
+ end
583
+ if r4
584
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
585
+ r0 = r4
586
+ r0.extend(NormalChar0)
587
+ r0.extend(NormalChar0)
588
+ else
589
+ if has_terminal?(@regexps[gr = '\A[\\^-z]'] ||= Regexp.new(gr), :regexp, index)
590
+ r5 = true
591
+ @index += 1
592
+ else
593
+ terminal_parse_failure('[\\^-z]')
594
+ r5 = nil
595
+ end
596
+ if r5
597
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
598
+ r0 = r5
599
+ r0.extend(NormalChar0)
600
+ r0.extend(NormalChar0)
601
+ else
602
+ if has_terminal?(@regexps[gr = '\A[~-􏿿]'] ||= Regexp.new(gr), :regexp, index)
603
+ r6 = true
604
+ @index += 1
605
+ else
606
+ terminal_parse_failure('[~-􏿿]')
607
+ r6 = nil
608
+ end
609
+ if r6
610
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
611
+ r0 = r6
612
+ r0.extend(NormalChar0)
613
+ r0.extend(NormalChar0)
614
+ else
615
+ @index = i0
616
+ r0 = nil
617
+ end
618
+ end
619
+ end
620
+ end
621
+ end
622
+ end
623
+
624
+ node_cache[:NormalChar][start_index] = r0
625
+
626
+ r0
627
+ end
628
+
629
+ module CharClass0
630
+ def ast
631
+ ["dot"]
632
+ end
633
+ end
634
+
635
+ def _nt_charClass
636
+ start_index = index
637
+ if node_cache[:charClass].has_key?(index)
638
+ cached = node_cache[:charClass][index]
639
+ if cached
640
+ node_cache[:charClass][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
641
+ @index = cached.interval.end
642
+ end
643
+ return cached
644
+ end
645
+
646
+ i0 = index
647
+ if (match_len = has_terminal?(".", false, index))
648
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
649
+ r1.extend(CharClass0)
650
+ @index += match_len
651
+ else
652
+ terminal_parse_failure('"."')
653
+ r1 = nil
654
+ end
655
+ if r1
656
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
657
+ r0 = r1
658
+ else
659
+ r2 = _nt_SingleCharEsc
660
+ if r2
661
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
662
+ r0 = r2
663
+ else
664
+ r3 = _nt_charClassEsc
665
+ if r3
666
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
667
+ r0 = r3
668
+ else
669
+ r4 = _nt_charClassExpr
670
+ if r4
671
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
672
+ r0 = r4
673
+ else
674
+ @index = i0
675
+ r0 = nil
676
+ end
677
+ end
678
+ end
679
+ end
680
+
681
+ node_cache[:charClass][start_index] = r0
682
+
683
+ r0
684
+ end
685
+
686
+ module SingleCharEsc0
687
+ end
688
+
689
+ module SingleCharEsc1
690
+ def ast
691
+ ch = text_value[1]
692
+ {"n" => "\n", "r" => "\r", "t" => "\t"}[ch] || ch
693
+ end
694
+ end
695
+
696
+ def _nt_SingleCharEsc
697
+ start_index = index
698
+ if node_cache[:SingleCharEsc].has_key?(index)
699
+ cached = node_cache[:SingleCharEsc][index]
700
+ if cached
701
+ node_cache[:SingleCharEsc][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
702
+ @index = cached.interval.end
703
+ end
704
+ return cached
705
+ end
706
+
707
+ i0, s0 = index, []
708
+ if (match_len = has_terminal?("\\", false, index))
709
+ r1 = true
710
+ @index += match_len
711
+ else
712
+ terminal_parse_failure('"\\\\"')
713
+ r1 = nil
714
+ end
715
+ s0 << r1
716
+ if r1
717
+ i2 = index
718
+ if has_terminal?(@regexps[gr = '\A[\\(-\\+]'] ||= Regexp.new(gr), :regexp, index)
719
+ r3 = true
720
+ @index += 1
721
+ else
722
+ terminal_parse_failure('[\\(-\\+]')
723
+ r3 = nil
724
+ end
725
+ if r3
726
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
727
+ r2 = r3
728
+ else
729
+ if has_terminal?(@regexps[gr = '\A[\\--\\.]'] ||= Regexp.new(gr), :regexp, index)
730
+ r4 = true
731
+ @index += 1
732
+ else
733
+ terminal_parse_failure('[\\--\\.]')
734
+ r4 = nil
735
+ end
736
+ if r4
737
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
738
+ r2 = r4
739
+ else
740
+ if (match_len = has_terminal?("?", false, index))
741
+ r5 = true
742
+ @index += match_len
743
+ else
744
+ terminal_parse_failure('"?"')
745
+ r5 = nil
746
+ end
747
+ if r5
748
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
749
+ r2 = r5
750
+ else
751
+ if has_terminal?(@regexps[gr = '\A[\\[-\\^]'] ||= Regexp.new(gr), :regexp, index)
752
+ r6 = true
753
+ @index += 1
754
+ else
755
+ terminal_parse_failure('[\\[-\\^]')
756
+ r6 = nil
757
+ end
758
+ if r6
759
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
760
+ r2 = r6
761
+ else
762
+ if (match_len = has_terminal?("n", false, index))
763
+ r7 = true
764
+ @index += match_len
765
+ else
766
+ terminal_parse_failure('"n"')
767
+ r7 = nil
768
+ end
769
+ if r7
770
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
771
+ r2 = r7
772
+ else
773
+ if (match_len = has_terminal?("r", false, index))
774
+ r8 = true
775
+ @index += match_len
776
+ else
777
+ terminal_parse_failure('"r"')
778
+ r8 = nil
779
+ end
780
+ if r8
781
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
782
+ r2 = r8
783
+ else
784
+ if (match_len = has_terminal?("t", false, index))
785
+ r9 = true
786
+ @index += match_len
787
+ else
788
+ terminal_parse_failure('"t"')
789
+ r9 = nil
790
+ end
791
+ if r9
792
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
793
+ r2 = r9
794
+ else
795
+ if has_terminal?(@regexps[gr = '\A[\\{-\\}]'] ||= Regexp.new(gr), :regexp, index)
796
+ r10 = true
797
+ @index += 1
798
+ else
799
+ terminal_parse_failure('[\\{-\\}]')
800
+ r10 = nil
801
+ end
802
+ if r10
803
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
804
+ r2 = r10
805
+ else
806
+ @index = i2
807
+ r2 = nil
808
+ end
809
+ end
810
+ end
811
+ end
812
+ end
813
+ end
814
+ end
815
+ end
816
+ s0 << r2
817
+ end
818
+ if s0.last
819
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
820
+ r0.extend(SingleCharEsc0)
821
+ r0.extend(SingleCharEsc1)
822
+ else
823
+ @index = i0
824
+ r0 = nil
825
+ end
826
+
827
+ node_cache[:SingleCharEsc][start_index] = r0
828
+
829
+ r0
830
+ end
831
+
832
+ def _nt_charClassEsc
833
+ start_index = index
834
+ if node_cache[:charClassEsc].has_key?(index)
835
+ cached = node_cache[:charClassEsc][index]
836
+ if cached
837
+ node_cache[:charClassEsc][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
838
+ @index = cached.interval.end
839
+ end
840
+ return cached
841
+ end
842
+
843
+ i0 = index
844
+ r1 = _nt_catEsc
845
+ if r1
846
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
847
+ r0 = r1
848
+ else
849
+ r2 = _nt_complEsc
850
+ if r2
851
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
852
+ r0 = r2
853
+ else
854
+ @index = i0
855
+ r0 = nil
856
+ end
857
+ end
858
+
859
+ node_cache[:charClassEsc][start_index] = r0
860
+
861
+ r0
862
+ end
863
+
864
+ module CharClassExpr0
865
+ end
866
+
867
+ module CharClassExpr1
868
+ def ast
869
+ ret = ["pos"]
870
+ ret = ["neg"] if elements[1].text_value != ''
871
+ c1 = elements[2].text_value
872
+ c1 = elements[2].ast if c1 != "-"
873
+ ret << c1 # XXX check for "^"!
874
+ elements[3].elements.each do |el|
875
+ ret << el.ast
876
+ end
877
+ ret << "-" if elements[4].text_value == "-"
878
+ ret
879
+ end
880
+ end
881
+
882
+ def _nt_charClassExpr
883
+ start_index = index
884
+ if node_cache[:charClassExpr].has_key?(index)
885
+ cached = node_cache[:charClassExpr][index]
886
+ if cached
887
+ node_cache[:charClassExpr][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
888
+ @index = cached.interval.end
889
+ end
890
+ return cached
891
+ end
892
+
893
+ i0, s0 = index, []
894
+ if (match_len = has_terminal?("[", false, index))
895
+ r1 = true
896
+ @index += match_len
897
+ else
898
+ terminal_parse_failure('"["')
899
+ r1 = nil
900
+ end
901
+ s0 << r1
902
+ if r1
903
+ if (match_len = has_terminal?("^", false, index))
904
+ r3 = true
905
+ @index += match_len
906
+ else
907
+ terminal_parse_failure('"^"')
908
+ r3 = nil
909
+ end
910
+ if r3
911
+ r2 = r3
912
+ else
913
+ r2 = instantiate_node(SyntaxNode,input, index...index)
914
+ end
915
+ s0 << r2
916
+ if r2
917
+ i4 = index
918
+ if (match_len = has_terminal?("-", false, index))
919
+ r5 = true
920
+ @index += match_len
921
+ else
922
+ terminal_parse_failure('"-"')
923
+ r5 = nil
924
+ end
925
+ if r5
926
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
927
+ r4 = r5
928
+ else
929
+ r6 = _nt_CCE1
930
+ if r6
931
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
932
+ r4 = r6
933
+ else
934
+ @index = i4
935
+ r4 = nil
936
+ end
937
+ end
938
+ s0 << r4
939
+ if r4
940
+ s7, i7 = [], index
941
+ loop do
942
+ r8 = _nt_CCE1
943
+ if r8
944
+ s7 << r8
945
+ else
946
+ break
947
+ end
948
+ end
949
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
950
+ s0 << r7
951
+ if r7
952
+ if (match_len = has_terminal?("-", false, index))
953
+ r10 = true
954
+ @index += match_len
955
+ else
956
+ terminal_parse_failure('"-"')
957
+ r10 = nil
958
+ end
959
+ if r10
960
+ r9 = r10
961
+ else
962
+ r9 = instantiate_node(SyntaxNode,input, index...index)
963
+ end
964
+ s0 << r9
965
+ if r9
966
+ if (match_len = has_terminal?("]", false, index))
967
+ r11 = true
968
+ @index += match_len
969
+ else
970
+ terminal_parse_failure('"]"')
971
+ r11 = nil
972
+ end
973
+ s0 << r11
974
+ end
975
+ end
976
+ end
977
+ end
978
+ end
979
+ if s0.last
980
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
981
+ r0.extend(CharClassExpr0)
982
+ r0.extend(CharClassExpr1)
983
+ else
984
+ @index = i0
985
+ r0 = nil
986
+ end
987
+
988
+ node_cache[:charClassExpr][start_index] = r0
989
+
990
+ r0
991
+ end
992
+
993
+ module CCE10
994
+ def CCchar
995
+ elements[1]
996
+ end
997
+ end
998
+
999
+ module CCE11
1000
+ def CCchar
1001
+ elements[0]
1002
+ end
1003
+
1004
+ end
1005
+
1006
+ module CCE12
1007
+ def ast
1008
+ l = elements[0].ast
1009
+ if elements[1].text_value != ''
1010
+ r = elements[1].elements[1].ast
1011
+ ["-", l, r]
1012
+ else
1013
+ l
1014
+ end
1015
+ end
1016
+ end
1017
+
1018
+ def _nt_CCE1
1019
+ start_index = index
1020
+ if node_cache[:CCE1].has_key?(index)
1021
+ cached = node_cache[:CCE1][index]
1022
+ if cached
1023
+ node_cache[:CCE1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1024
+ @index = cached.interval.end
1025
+ end
1026
+ return cached
1027
+ end
1028
+
1029
+ i0 = index
1030
+ i1, s1 = index, []
1031
+ r2 = _nt_CCchar
1032
+ s1 << r2
1033
+ if r2
1034
+ i4, s4 = index, []
1035
+ if (match_len = has_terminal?("-", false, index))
1036
+ r5 = true
1037
+ @index += match_len
1038
+ else
1039
+ terminal_parse_failure('"-"')
1040
+ r5 = nil
1041
+ end
1042
+ s4 << r5
1043
+ if r5
1044
+ r6 = _nt_CCchar
1045
+ s4 << r6
1046
+ end
1047
+ if s4.last
1048
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1049
+ r4.extend(CCE10)
1050
+ else
1051
+ @index = i4
1052
+ r4 = nil
1053
+ end
1054
+ if r4
1055
+ r3 = r4
1056
+ else
1057
+ r3 = instantiate_node(SyntaxNode,input, index...index)
1058
+ end
1059
+ s1 << r3
1060
+ end
1061
+ if s1.last
1062
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1063
+ r1.extend(CCE11)
1064
+ r1.extend(CCE12)
1065
+ else
1066
+ @index = i1
1067
+ r1 = nil
1068
+ end
1069
+ if r1
1070
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1071
+ r0 = r1
1072
+ else
1073
+ r7 = _nt_charClassEsc
1074
+ if r7
1075
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
1076
+ r0 = r7
1077
+ else
1078
+ @index = i0
1079
+ r0 = nil
1080
+ end
1081
+ end
1082
+
1083
+ node_cache[:CCE1][start_index] = r0
1084
+
1085
+ r0
1086
+ end
1087
+
1088
+ module CCchar0
1089
+ def ast
1090
+ text_value
1091
+ end
1092
+ end
1093
+
1094
+ def _nt_CCchar
1095
+ start_index = index
1096
+ if node_cache[:CCchar].has_key?(index)
1097
+ cached = node_cache[:CCchar][index]
1098
+ if cached
1099
+ node_cache[:CCchar][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1100
+ @index = cached.interval.end
1101
+ end
1102
+ return cached
1103
+ end
1104
+
1105
+ i0 = index
1106
+ i1 = index
1107
+ if has_terminal?(@regexps[gr = '\A[-,]'] ||= Regexp.new(gr), :regexp, index)
1108
+ r2 = true
1109
+ @index += 1
1110
+ else
1111
+ terminal_parse_failure('[-,]')
1112
+ r2 = nil
1113
+ end
1114
+ if r2
1115
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
1116
+ r1 = r2
1117
+ r1.extend(CCchar0)
1118
+ r1.extend(CCchar0)
1119
+ else
1120
+ if has_terminal?(@regexps[gr = '\A[\\.-Z]'] ||= Regexp.new(gr), :regexp, index)
1121
+ r3 = true
1122
+ @index += 1
1123
+ else
1124
+ terminal_parse_failure('[\\.-Z]')
1125
+ r3 = nil
1126
+ end
1127
+ if r3
1128
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
1129
+ r1 = r3
1130
+ r1.extend(CCchar0)
1131
+ r1.extend(CCchar0)
1132
+ else
1133
+ if has_terminal?(@regexps[gr = '\A[\\^-􏿿]'] ||= Regexp.new(gr), :regexp, index)
1134
+ r4 = true
1135
+ @index += 1
1136
+ else
1137
+ terminal_parse_failure('[\\^-􏿿]')
1138
+ r4 = nil
1139
+ end
1140
+ if r4
1141
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1142
+ r1 = r4
1143
+ r1.extend(CCchar0)
1144
+ r1.extend(CCchar0)
1145
+ else
1146
+ @index = i1
1147
+ r1 = nil
1148
+ end
1149
+ end
1150
+ end
1151
+ if r1
1152
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1153
+ r0 = r1
1154
+ else
1155
+ r5 = _nt_SingleCharEsc
1156
+ if r5
1157
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1158
+ r0 = r5
1159
+ else
1160
+ @index = i0
1161
+ r0 = nil
1162
+ end
1163
+ end
1164
+
1165
+ node_cache[:CCchar][start_index] = r0
1166
+
1167
+ r0
1168
+ end
1169
+
1170
+ module CatEsc0
1171
+ def charProp
1172
+ elements[1]
1173
+ end
1174
+
1175
+ end
1176
+
1177
+ module CatEsc1
1178
+ def ast; ["p", charProp.text_value] end
1179
+ end
1180
+
1181
+ def _nt_catEsc
1182
+ start_index = index
1183
+ if node_cache[:catEsc].has_key?(index)
1184
+ cached = node_cache[:catEsc][index]
1185
+ if cached
1186
+ node_cache[:catEsc][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1187
+ @index = cached.interval.end
1188
+ end
1189
+ return cached
1190
+ end
1191
+
1192
+ i0, s0 = index, []
1193
+ if (match_len = has_terminal?("\\p{", false, index))
1194
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1195
+ @index += match_len
1196
+ else
1197
+ terminal_parse_failure('"\\\\p{"')
1198
+ r1 = nil
1199
+ end
1200
+ s0 << r1
1201
+ if r1
1202
+ r2 = _nt_charProp
1203
+ s0 << r2
1204
+ if r2
1205
+ if (match_len = has_terminal?("}", false, index))
1206
+ r3 = true
1207
+ @index += match_len
1208
+ else
1209
+ terminal_parse_failure('"}"')
1210
+ r3 = nil
1211
+ end
1212
+ s0 << r3
1213
+ end
1214
+ end
1215
+ if s0.last
1216
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1217
+ r0.extend(CatEsc0)
1218
+ r0.extend(CatEsc1)
1219
+ else
1220
+ @index = i0
1221
+ r0 = nil
1222
+ end
1223
+
1224
+ node_cache[:catEsc][start_index] = r0
1225
+
1226
+ r0
1227
+ end
1228
+
1229
+ module ComplEsc0
1230
+ def charProp
1231
+ elements[1]
1232
+ end
1233
+
1234
+ end
1235
+
1236
+ module ComplEsc1
1237
+ def ast; ["P", charProp.text_value] end
1238
+ end
1239
+
1240
+ def _nt_complEsc
1241
+ start_index = index
1242
+ if node_cache[:complEsc].has_key?(index)
1243
+ cached = node_cache[:complEsc][index]
1244
+ if cached
1245
+ node_cache[:complEsc][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1246
+ @index = cached.interval.end
1247
+ end
1248
+ return cached
1249
+ end
1250
+
1251
+ i0, s0 = index, []
1252
+ if (match_len = has_terminal?("\\P{", false, index))
1253
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1254
+ @index += match_len
1255
+ else
1256
+ terminal_parse_failure('"\\\\P{"')
1257
+ r1 = nil
1258
+ end
1259
+ s0 << r1
1260
+ if r1
1261
+ r2 = _nt_charProp
1262
+ s0 << r2
1263
+ if r2
1264
+ if (match_len = has_terminal?("}", false, index))
1265
+ r3 = true
1266
+ @index += match_len
1267
+ else
1268
+ terminal_parse_failure('"}"')
1269
+ r3 = nil
1270
+ end
1271
+ s0 << r3
1272
+ end
1273
+ end
1274
+ if s0.last
1275
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1276
+ r0.extend(ComplEsc0)
1277
+ r0.extend(ComplEsc1)
1278
+ else
1279
+ @index = i0
1280
+ r0 = nil
1281
+ end
1282
+
1283
+ node_cache[:complEsc][start_index] = r0
1284
+
1285
+ r0
1286
+ end
1287
+
1288
+ def _nt_charProp
1289
+ start_index = index
1290
+ if node_cache[:charProp].has_key?(index)
1291
+ cached = node_cache[:charProp][index]
1292
+ if cached
1293
+ node_cache[:charProp][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1294
+ @index = cached.interval.end
1295
+ end
1296
+ return cached
1297
+ end
1298
+
1299
+ r0 = _nt_IsCategory
1300
+
1301
+ node_cache[:charProp][start_index] = r0
1302
+
1303
+ r0
1304
+ end
1305
+
1306
+ def _nt_IsCategory
1307
+ start_index = index
1308
+ if node_cache[:IsCategory].has_key?(index)
1309
+ cached = node_cache[:IsCategory][index]
1310
+ if cached
1311
+ node_cache[:IsCategory][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1312
+ @index = cached.interval.end
1313
+ end
1314
+ return cached
1315
+ end
1316
+
1317
+ i0 = index
1318
+ r1 = _nt_Letters
1319
+ if r1
1320
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1321
+ r0 = r1
1322
+ else
1323
+ r2 = _nt_Marks
1324
+ if r2
1325
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
1326
+ r0 = r2
1327
+ else
1328
+ r3 = _nt_Numbers
1329
+ if r3
1330
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
1331
+ r0 = r3
1332
+ else
1333
+ r4 = _nt_Punctuation
1334
+ if r4
1335
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1336
+ r0 = r4
1337
+ else
1338
+ r5 = _nt_Separators
1339
+ if r5
1340
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1341
+ r0 = r5
1342
+ else
1343
+ r6 = _nt_Symbols
1344
+ if r6
1345
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1346
+ r0 = r6
1347
+ else
1348
+ r7 = _nt_Others
1349
+ if r7
1350
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
1351
+ r0 = r7
1352
+ else
1353
+ @index = i0
1354
+ r0 = nil
1355
+ end
1356
+ end
1357
+ end
1358
+ end
1359
+ end
1360
+ end
1361
+ end
1362
+
1363
+ node_cache[:IsCategory][start_index] = r0
1364
+
1365
+ r0
1366
+ end
1367
+
1368
+ module Letters0
1369
+ end
1370
+
1371
+ def _nt_Letters
1372
+ start_index = index
1373
+ if node_cache[:Letters].has_key?(index)
1374
+ cached = node_cache[:Letters][index]
1375
+ if cached
1376
+ node_cache[:Letters][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1377
+ @index = cached.interval.end
1378
+ end
1379
+ return cached
1380
+ end
1381
+
1382
+ i0, s0 = index, []
1383
+ if (match_len = has_terminal?("L", false, index))
1384
+ r1 = true
1385
+ @index += match_len
1386
+ else
1387
+ terminal_parse_failure('"L"')
1388
+ r1 = nil
1389
+ end
1390
+ s0 << r1
1391
+ if r1
1392
+ i3 = index
1393
+ if has_terminal?(@regexps[gr = '\A[l-m]'] ||= Regexp.new(gr), :regexp, index)
1394
+ r4 = true
1395
+ @index += 1
1396
+ else
1397
+ terminal_parse_failure('[l-m]')
1398
+ r4 = nil
1399
+ end
1400
+ if r4
1401
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1402
+ r3 = r4
1403
+ else
1404
+ if (match_len = has_terminal?("o", false, index))
1405
+ r5 = true
1406
+ @index += match_len
1407
+ else
1408
+ terminal_parse_failure('"o"')
1409
+ r5 = nil
1410
+ end
1411
+ if r5
1412
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1413
+ r3 = r5
1414
+ else
1415
+ if has_terminal?(@regexps[gr = '\A[t-u]'] ||= Regexp.new(gr), :regexp, index)
1416
+ r6 = true
1417
+ @index += 1
1418
+ else
1419
+ terminal_parse_failure('[t-u]')
1420
+ r6 = nil
1421
+ end
1422
+ if r6
1423
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1424
+ r3 = r6
1425
+ else
1426
+ @index = i3
1427
+ r3 = nil
1428
+ end
1429
+ end
1430
+ end
1431
+ if r3
1432
+ r2 = r3
1433
+ else
1434
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1435
+ end
1436
+ s0 << r2
1437
+ end
1438
+ if s0.last
1439
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1440
+ r0.extend(Letters0)
1441
+ else
1442
+ @index = i0
1443
+ r0 = nil
1444
+ end
1445
+
1446
+ node_cache[:Letters][start_index] = r0
1447
+
1448
+ r0
1449
+ end
1450
+
1451
+ module Marks0
1452
+ end
1453
+
1454
+ def _nt_Marks
1455
+ start_index = index
1456
+ if node_cache[:Marks].has_key?(index)
1457
+ cached = node_cache[:Marks][index]
1458
+ if cached
1459
+ node_cache[:Marks][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1460
+ @index = cached.interval.end
1461
+ end
1462
+ return cached
1463
+ end
1464
+
1465
+ i0, s0 = index, []
1466
+ if (match_len = has_terminal?("M", false, index))
1467
+ r1 = true
1468
+ @index += match_len
1469
+ else
1470
+ terminal_parse_failure('"M"')
1471
+ r1 = nil
1472
+ end
1473
+ s0 << r1
1474
+ if r1
1475
+ i3 = index
1476
+ if (match_len = has_terminal?("c", false, index))
1477
+ r4 = true
1478
+ @index += match_len
1479
+ else
1480
+ terminal_parse_failure('"c"')
1481
+ r4 = nil
1482
+ end
1483
+ if r4
1484
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1485
+ r3 = r4
1486
+ else
1487
+ if (match_len = has_terminal?("e", false, index))
1488
+ r5 = true
1489
+ @index += match_len
1490
+ else
1491
+ terminal_parse_failure('"e"')
1492
+ r5 = nil
1493
+ end
1494
+ if r5
1495
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1496
+ r3 = r5
1497
+ else
1498
+ if (match_len = has_terminal?("n", false, index))
1499
+ r6 = true
1500
+ @index += match_len
1501
+ else
1502
+ terminal_parse_failure('"n"')
1503
+ r6 = nil
1504
+ end
1505
+ if r6
1506
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1507
+ r3 = r6
1508
+ else
1509
+ @index = i3
1510
+ r3 = nil
1511
+ end
1512
+ end
1513
+ end
1514
+ if r3
1515
+ r2 = r3
1516
+ else
1517
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1518
+ end
1519
+ s0 << r2
1520
+ end
1521
+ if s0.last
1522
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1523
+ r0.extend(Marks0)
1524
+ else
1525
+ @index = i0
1526
+ r0 = nil
1527
+ end
1528
+
1529
+ node_cache[:Marks][start_index] = r0
1530
+
1531
+ r0
1532
+ end
1533
+
1534
+ module Numbers0
1535
+ end
1536
+
1537
+ def _nt_Numbers
1538
+ start_index = index
1539
+ if node_cache[:Numbers].has_key?(index)
1540
+ cached = node_cache[:Numbers][index]
1541
+ if cached
1542
+ node_cache[:Numbers][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1543
+ @index = cached.interval.end
1544
+ end
1545
+ return cached
1546
+ end
1547
+
1548
+ i0, s0 = index, []
1549
+ if (match_len = has_terminal?("N", false, index))
1550
+ r1 = true
1551
+ @index += match_len
1552
+ else
1553
+ terminal_parse_failure('"N"')
1554
+ r1 = nil
1555
+ end
1556
+ s0 << r1
1557
+ if r1
1558
+ i3 = index
1559
+ if (match_len = has_terminal?("d", false, index))
1560
+ r4 = true
1561
+ @index += match_len
1562
+ else
1563
+ terminal_parse_failure('"d"')
1564
+ r4 = nil
1565
+ end
1566
+ if r4
1567
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1568
+ r3 = r4
1569
+ else
1570
+ if (match_len = has_terminal?("l", false, index))
1571
+ r5 = true
1572
+ @index += match_len
1573
+ else
1574
+ terminal_parse_failure('"l"')
1575
+ r5 = nil
1576
+ end
1577
+ if r5
1578
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1579
+ r3 = r5
1580
+ else
1581
+ if (match_len = has_terminal?("o", false, index))
1582
+ r6 = true
1583
+ @index += match_len
1584
+ else
1585
+ terminal_parse_failure('"o"')
1586
+ r6 = nil
1587
+ end
1588
+ if r6
1589
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1590
+ r3 = r6
1591
+ else
1592
+ @index = i3
1593
+ r3 = nil
1594
+ end
1595
+ end
1596
+ end
1597
+ if r3
1598
+ r2 = r3
1599
+ else
1600
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1601
+ end
1602
+ s0 << r2
1603
+ end
1604
+ if s0.last
1605
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1606
+ r0.extend(Numbers0)
1607
+ else
1608
+ @index = i0
1609
+ r0 = nil
1610
+ end
1611
+
1612
+ node_cache[:Numbers][start_index] = r0
1613
+
1614
+ r0
1615
+ end
1616
+
1617
+ module Punctuation0
1618
+ end
1619
+
1620
+ def _nt_Punctuation
1621
+ start_index = index
1622
+ if node_cache[:Punctuation].has_key?(index)
1623
+ cached = node_cache[:Punctuation][index]
1624
+ if cached
1625
+ node_cache[:Punctuation][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1626
+ @index = cached.interval.end
1627
+ end
1628
+ return cached
1629
+ end
1630
+
1631
+ i0, s0 = index, []
1632
+ if (match_len = has_terminal?("P", false, index))
1633
+ r1 = true
1634
+ @index += match_len
1635
+ else
1636
+ terminal_parse_failure('"P"')
1637
+ r1 = nil
1638
+ end
1639
+ s0 << r1
1640
+ if r1
1641
+ i3 = index
1642
+ if has_terminal?(@regexps[gr = '\A[c-f]'] ||= Regexp.new(gr), :regexp, index)
1643
+ r4 = true
1644
+ @index += 1
1645
+ else
1646
+ terminal_parse_failure('[c-f]')
1647
+ r4 = nil
1648
+ end
1649
+ if r4
1650
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1651
+ r3 = r4
1652
+ else
1653
+ if (match_len = has_terminal?("i", false, index))
1654
+ r5 = true
1655
+ @index += match_len
1656
+ else
1657
+ terminal_parse_failure('"i"')
1658
+ r5 = nil
1659
+ end
1660
+ if r5
1661
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1662
+ r3 = r5
1663
+ else
1664
+ if (match_len = has_terminal?("o", false, index))
1665
+ r6 = true
1666
+ @index += match_len
1667
+ else
1668
+ terminal_parse_failure('"o"')
1669
+ r6 = nil
1670
+ end
1671
+ if r6
1672
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1673
+ r3 = r6
1674
+ else
1675
+ if (match_len = has_terminal?("s", false, index))
1676
+ r7 = true
1677
+ @index += match_len
1678
+ else
1679
+ terminal_parse_failure('"s"')
1680
+ r7 = nil
1681
+ end
1682
+ if r7
1683
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
1684
+ r3 = r7
1685
+ else
1686
+ @index = i3
1687
+ r3 = nil
1688
+ end
1689
+ end
1690
+ end
1691
+ end
1692
+ if r3
1693
+ r2 = r3
1694
+ else
1695
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1696
+ end
1697
+ s0 << r2
1698
+ end
1699
+ if s0.last
1700
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1701
+ r0.extend(Punctuation0)
1702
+ else
1703
+ @index = i0
1704
+ r0 = nil
1705
+ end
1706
+
1707
+ node_cache[:Punctuation][start_index] = r0
1708
+
1709
+ r0
1710
+ end
1711
+
1712
+ module Separators0
1713
+ end
1714
+
1715
+ def _nt_Separators
1716
+ start_index = index
1717
+ if node_cache[:Separators].has_key?(index)
1718
+ cached = node_cache[:Separators][index]
1719
+ if cached
1720
+ node_cache[:Separators][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1721
+ @index = cached.interval.end
1722
+ end
1723
+ return cached
1724
+ end
1725
+
1726
+ i0, s0 = index, []
1727
+ if (match_len = has_terminal?("Z", false, index))
1728
+ r1 = true
1729
+ @index += match_len
1730
+ else
1731
+ terminal_parse_failure('"Z"')
1732
+ r1 = nil
1733
+ end
1734
+ s0 << r1
1735
+ if r1
1736
+ i3 = index
1737
+ if (match_len = has_terminal?("l", false, index))
1738
+ r4 = true
1739
+ @index += match_len
1740
+ else
1741
+ terminal_parse_failure('"l"')
1742
+ r4 = nil
1743
+ end
1744
+ if r4
1745
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1746
+ r3 = r4
1747
+ else
1748
+ if (match_len = has_terminal?("p", false, index))
1749
+ r5 = true
1750
+ @index += match_len
1751
+ else
1752
+ terminal_parse_failure('"p"')
1753
+ r5 = nil
1754
+ end
1755
+ if r5
1756
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1757
+ r3 = r5
1758
+ else
1759
+ if (match_len = has_terminal?("s", false, index))
1760
+ r6 = true
1761
+ @index += match_len
1762
+ else
1763
+ terminal_parse_failure('"s"')
1764
+ r6 = nil
1765
+ end
1766
+ if r6
1767
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1768
+ r3 = r6
1769
+ else
1770
+ @index = i3
1771
+ r3 = nil
1772
+ end
1773
+ end
1774
+ end
1775
+ if r3
1776
+ r2 = r3
1777
+ else
1778
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1779
+ end
1780
+ s0 << r2
1781
+ end
1782
+ if s0.last
1783
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1784
+ r0.extend(Separators0)
1785
+ else
1786
+ @index = i0
1787
+ r0 = nil
1788
+ end
1789
+
1790
+ node_cache[:Separators][start_index] = r0
1791
+
1792
+ r0
1793
+ end
1794
+
1795
+ module Symbols0
1796
+ end
1797
+
1798
+ def _nt_Symbols
1799
+ start_index = index
1800
+ if node_cache[:Symbols].has_key?(index)
1801
+ cached = node_cache[:Symbols][index]
1802
+ if cached
1803
+ node_cache[:Symbols][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1804
+ @index = cached.interval.end
1805
+ end
1806
+ return cached
1807
+ end
1808
+
1809
+ i0, s0 = index, []
1810
+ if (match_len = has_terminal?("S", false, index))
1811
+ r1 = true
1812
+ @index += match_len
1813
+ else
1814
+ terminal_parse_failure('"S"')
1815
+ r1 = nil
1816
+ end
1817
+ s0 << r1
1818
+ if r1
1819
+ i3 = index
1820
+ if (match_len = has_terminal?("c", false, index))
1821
+ r4 = true
1822
+ @index += match_len
1823
+ else
1824
+ terminal_parse_failure('"c"')
1825
+ r4 = nil
1826
+ end
1827
+ if r4
1828
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1829
+ r3 = r4
1830
+ else
1831
+ if (match_len = has_terminal?("k", false, index))
1832
+ r5 = true
1833
+ @index += match_len
1834
+ else
1835
+ terminal_parse_failure('"k"')
1836
+ r5 = nil
1837
+ end
1838
+ if r5
1839
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1840
+ r3 = r5
1841
+ else
1842
+ if (match_len = has_terminal?("m", false, index))
1843
+ r6 = true
1844
+ @index += match_len
1845
+ else
1846
+ terminal_parse_failure('"m"')
1847
+ r6 = nil
1848
+ end
1849
+ if r6
1850
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1851
+ r3 = r6
1852
+ else
1853
+ if (match_len = has_terminal?("o", false, index))
1854
+ r7 = true
1855
+ @index += match_len
1856
+ else
1857
+ terminal_parse_failure('"o"')
1858
+ r7 = nil
1859
+ end
1860
+ if r7
1861
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
1862
+ r3 = r7
1863
+ else
1864
+ @index = i3
1865
+ r3 = nil
1866
+ end
1867
+ end
1868
+ end
1869
+ end
1870
+ if r3
1871
+ r2 = r3
1872
+ else
1873
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1874
+ end
1875
+ s0 << r2
1876
+ end
1877
+ if s0.last
1878
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1879
+ r0.extend(Symbols0)
1880
+ else
1881
+ @index = i0
1882
+ r0 = nil
1883
+ end
1884
+
1885
+ node_cache[:Symbols][start_index] = r0
1886
+
1887
+ r0
1888
+ end
1889
+
1890
+ module Others0
1891
+ end
1892
+
1893
+ def _nt_Others
1894
+ start_index = index
1895
+ if node_cache[:Others].has_key?(index)
1896
+ cached = node_cache[:Others][index]
1897
+ if cached
1898
+ node_cache[:Others][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1899
+ @index = cached.interval.end
1900
+ end
1901
+ return cached
1902
+ end
1903
+
1904
+ i0, s0 = index, []
1905
+ if (match_len = has_terminal?("C", false, index))
1906
+ r1 = true
1907
+ @index += match_len
1908
+ else
1909
+ terminal_parse_failure('"C"')
1910
+ r1 = nil
1911
+ end
1912
+ s0 << r1
1913
+ if r1
1914
+ i3 = index
1915
+ if (match_len = has_terminal?("c", false, index))
1916
+ r4 = true
1917
+ @index += match_len
1918
+ else
1919
+ terminal_parse_failure('"c"')
1920
+ r4 = nil
1921
+ end
1922
+ if r4
1923
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
1924
+ r3 = r4
1925
+ else
1926
+ if (match_len = has_terminal?("f", false, index))
1927
+ r5 = true
1928
+ @index += match_len
1929
+ else
1930
+ terminal_parse_failure('"f"')
1931
+ r5 = nil
1932
+ end
1933
+ if r5
1934
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1935
+ r3 = r5
1936
+ else
1937
+ if has_terminal?(@regexps[gr = '\A[n-o]'] ||= Regexp.new(gr), :regexp, index)
1938
+ r6 = true
1939
+ @index += 1
1940
+ else
1941
+ terminal_parse_failure('[n-o]')
1942
+ r6 = nil
1943
+ end
1944
+ if r6
1945
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1946
+ r3 = r6
1947
+ else
1948
+ @index = i3
1949
+ r3 = nil
1950
+ end
1951
+ end
1952
+ end
1953
+ if r3
1954
+ r2 = r3
1955
+ else
1956
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1957
+ end
1958
+ s0 << r2
1959
+ end
1960
+ if s0.last
1961
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1962
+ r0.extend(Others0)
1963
+ else
1964
+ @index = i0
1965
+ r0 = nil
1966
+ end
1967
+
1968
+ node_cache[:Others][start_index] = r0
1969
+
1970
+ r0
1971
+ end
1972
+
1973
+ end
1974
+
1975
+ class IREGEXPGRAMMARParser < Treetop::Runtime::CompiledParser
1976
+ include IREGEXPGRAMMAR
1977
+ end
1978
+