biodiversity19 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1269 @@
1
+ # encoding: UTF-8
2
+ # Autogenerated from a Treetop grammar. Edits may be lost.
3
+
4
+
5
+ module ScientificNameDirty
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :root
10
+ end
11
+
12
+ include ScientificNameClean
13
+
14
+ module Root0
15
+ def space1
16
+ elements[0]
17
+ end
18
+
19
+ def a
20
+ elements[1]
21
+ end
22
+
23
+ def space2
24
+ elements[2]
25
+ end
26
+ end
27
+
28
+ module Root1
29
+ def value
30
+ a.value.gsub(/\s{2,}/, ' ').strip
31
+ end
32
+
33
+ def canonical
34
+ a.canonical.gsub(/\s{2,}/, ' ').strip
35
+ end
36
+
37
+ def pos
38
+ a.pos
39
+ end
40
+
41
+ def hybrid
42
+ a.hybrid
43
+ end
44
+
45
+ def details
46
+ a.details.class == Array ? a.details : [a.details]
47
+ end
48
+
49
+ def parser_run
50
+ 2
51
+ end
52
+ end
53
+
54
+ def _nt_root
55
+ start_index = index
56
+ if node_cache[:root].has_key?(index)
57
+ cached = node_cache[:root][index]
58
+ if cached
59
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
60
+ @index = cached.interval.end
61
+ end
62
+ return cached
63
+ end
64
+
65
+ i0, s0 = index, []
66
+ r1 = _nt_space
67
+ s0 << r1
68
+ if r1
69
+ r2 = _nt_scientific_name_5
70
+ s0 << r2
71
+ if r2
72
+ r3 = _nt_space
73
+ s0 << r3
74
+ end
75
+ end
76
+ if s0.last
77
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
78
+ r0.extend(Root0)
79
+ r0.extend(Root1)
80
+ else
81
+ @index = i0
82
+ r0 = nil
83
+ end
84
+
85
+ node_cache[:root][start_index] = r0
86
+
87
+ r0
88
+ end
89
+
90
+ module ScientificName50
91
+ def a
92
+ elements[0]
93
+ end
94
+
95
+ def garbage
96
+ elements[1]
97
+ end
98
+ end
99
+
100
+ module ScientificName51
101
+ def value
102
+ a.value
103
+ end
104
+
105
+ def canonical
106
+ a.canonical
107
+ end
108
+
109
+ def pos
110
+ a.pos
111
+ end
112
+
113
+ def details
114
+ a.details
115
+ end
116
+ end
117
+
118
+ def _nt_scientific_name_5
119
+ start_index = index
120
+ if node_cache[:scientific_name_5].has_key?(index)
121
+ cached = node_cache[:scientific_name_5][index]
122
+ if cached
123
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
124
+ @index = cached.interval.end
125
+ end
126
+ return cached
127
+ end
128
+
129
+ i0 = index
130
+ i1, s1 = index, []
131
+ r2 = _nt_scientific_name_4
132
+ s1 << r2
133
+ if r2
134
+ r3 = _nt_garbage
135
+ s1 << r3
136
+ end
137
+ if s1.last
138
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
139
+ r1.extend(ScientificName50)
140
+ r1.extend(ScientificName51)
141
+ else
142
+ @index = i1
143
+ r1 = nil
144
+ end
145
+ if r1
146
+ r0 = r1
147
+ else
148
+ r4 = super
149
+ if r4
150
+ r0 = r4
151
+ else
152
+ @index = i0
153
+ r0 = nil
154
+ end
155
+ end
156
+
157
+ node_cache[:scientific_name_5][start_index] = r0
158
+
159
+ r0
160
+ end
161
+
162
+ module Infraspecies0
163
+ def a
164
+ elements[0]
165
+ end
166
+
167
+ def space
168
+ elements[1]
169
+ end
170
+
171
+ def b
172
+ elements[2]
173
+ end
174
+ end
175
+
176
+ module Infraspecies1
177
+ def value
178
+ a.value + " " + b.value
179
+ end
180
+
181
+ def canonical
182
+ a.canonical
183
+ end
184
+
185
+ def pos
186
+ a.pos.merge(b.pos)
187
+ end
188
+
189
+ def details
190
+ {:infraspecies => a.details[:infraspecies].merge(b.details)}
191
+ end
192
+ end
193
+
194
+ module Infraspecies2
195
+ def a
196
+ elements[0]
197
+ end
198
+
199
+ def space1
200
+ elements[1]
201
+ end
202
+
203
+ def string_authorship_inconsistencies
204
+ elements[2]
205
+ end
206
+
207
+ def space2
208
+ elements[3]
209
+ end
210
+
211
+ def b
212
+ elements[4]
213
+ end
214
+ end
215
+
216
+ module Infraspecies3
217
+ def value
218
+ a.value + " " + b.value
219
+ end
220
+
221
+ def canonical
222
+ a.canonical
223
+ end
224
+
225
+ def pos
226
+ a.pos.merge(b.pos)
227
+ end
228
+
229
+ def details
230
+ {:infraspecies => a.details[:infraspecies].merge(b.details)}
231
+ end
232
+ end
233
+
234
+ def _nt_infraspecies
235
+ start_index = index
236
+ if node_cache[:infraspecies].has_key?(index)
237
+ cached = node_cache[:infraspecies][index]
238
+ if cached
239
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
240
+ @index = cached.interval.end
241
+ end
242
+ return cached
243
+ end
244
+
245
+ i0 = index
246
+ i1, s1 = index, []
247
+ r2 = _nt_infraspecies_string
248
+ s1 << r2
249
+ if r2
250
+ r3 = _nt_space
251
+ s1 << r3
252
+ if r3
253
+ r4 = _nt_year
254
+ s1 << r4
255
+ end
256
+ end
257
+ if s1.last
258
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
259
+ r1.extend(Infraspecies0)
260
+ r1.extend(Infraspecies1)
261
+ else
262
+ @index = i1
263
+ r1 = nil
264
+ end
265
+ if r1
266
+ r0 = r1
267
+ else
268
+ i5, s5 = index, []
269
+ r6 = _nt_infraspecies_string
270
+ s5 << r6
271
+ if r6
272
+ r7 = _nt_space
273
+ s5 << r7
274
+ if r7
275
+ r8 = _nt_string_authorship_inconsistencies
276
+ s5 << r8
277
+ if r8
278
+ r9 = _nt_space
279
+ s5 << r9
280
+ if r9
281
+ r10 = _nt_authorship
282
+ s5 << r10
283
+ end
284
+ end
285
+ end
286
+ end
287
+ if s5.last
288
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
289
+ r5.extend(Infraspecies2)
290
+ r5.extend(Infraspecies3)
291
+ else
292
+ @index = i5
293
+ r5 = nil
294
+ end
295
+ if r5
296
+ r0 = r5
297
+ else
298
+ r11 = super
299
+ if r11
300
+ r0 = r11
301
+ else
302
+ @index = i0
303
+ r0 = nil
304
+ end
305
+ end
306
+ end
307
+
308
+ node_cache[:infraspecies][start_index] = r0
309
+
310
+ r0
311
+ end
312
+
313
+ module Species0
314
+ def a
315
+ elements[0]
316
+ end
317
+
318
+ def space
319
+ elements[1]
320
+ end
321
+
322
+ def b
323
+ elements[2]
324
+ end
325
+ end
326
+
327
+ module Species1
328
+ def value
329
+ a.value + " " + b.value
330
+ end
331
+
332
+ def canonical
333
+ a.canonical
334
+ end
335
+
336
+ def pos
337
+ a.pos.merge(b.pos)
338
+ end
339
+
340
+ def details
341
+ {:species => a.details[:species].merge(b.details)}
342
+ end
343
+ end
344
+
345
+ def _nt_species
346
+ start_index = index
347
+ if node_cache[:species].has_key?(index)
348
+ cached = node_cache[:species][index]
349
+ if cached
350
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
351
+ @index = cached.interval.end
352
+ end
353
+ return cached
354
+ end
355
+
356
+ i0 = index
357
+ i1, s1 = index, []
358
+ r2 = _nt_species_string
359
+ s1 << r2
360
+ if r2
361
+ r3 = _nt_space
362
+ s1 << r3
363
+ if r3
364
+ r4 = _nt_year
365
+ s1 << r4
366
+ end
367
+ end
368
+ if s1.last
369
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
370
+ r1.extend(Species0)
371
+ r1.extend(Species1)
372
+ else
373
+ @index = i1
374
+ r1 = nil
375
+ end
376
+ if r1
377
+ r0 = r1
378
+ else
379
+ r5 = super
380
+ if r5
381
+ r0 = r5
382
+ else
383
+ @index = i0
384
+ r0 = nil
385
+ end
386
+ end
387
+
388
+ node_cache[:species][start_index] = r0
389
+
390
+ r0
391
+ end
392
+
393
+ module LatinWord0
394
+ def a
395
+ elements[0]
396
+ end
397
+
398
+ def b
399
+ elements[1]
400
+ end
401
+ end
402
+
403
+ module LatinWord1
404
+ def value
405
+ res = ''
406
+ text_value.split('').each do |l|
407
+ l = 'ae' if l == 'æ'
408
+ l = 'oe' if l == 'œ'
409
+ res << l
410
+ end
411
+ res.tr('àâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž',
412
+ 'aaaaaacceeeiiinnnoooooouuurrrsssz')
413
+ end
414
+ end
415
+
416
+ def _nt_latin_word
417
+ start_index = index
418
+ if node_cache[:latin_word].has_key?(index)
419
+ cached = node_cache[:latin_word][index]
420
+ if cached
421
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
422
+ @index = cached.interval.end
423
+ end
424
+ return cached
425
+ end
426
+
427
+ i0, s0 = index, []
428
+ if has_terminal?('\G[a-z\\-æœàâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž]', true, index)
429
+ r1 = true
430
+ @index += 1
431
+ else
432
+ r1 = nil
433
+ end
434
+ s0 << r1
435
+ if r1
436
+ r2 = _nt_valid_name_letters
437
+ s0 << r2
438
+ end
439
+ if s0.last
440
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
441
+ r0.extend(LatinWord0)
442
+ r0.extend(LatinWord1)
443
+ else
444
+ @index = i0
445
+ r0 = nil
446
+ end
447
+
448
+ node_cache[:latin_word][start_index] = r0
449
+
450
+ r0
451
+ end
452
+
453
+ module ValidNameLetters0
454
+ def value
455
+ res = ''
456
+ text_value.split('').each do |l|
457
+ l = 'ae' if l == 'æ'
458
+ l = 'oe' if l == 'œ'
459
+ res << l
460
+ end
461
+ res.tr('àâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž',
462
+ 'aaaaaacceeeiiinnnoooooouuurrrsssz')
463
+
464
+ end
465
+ end
466
+
467
+ def _nt_valid_name_letters
468
+ start_index = index
469
+ if node_cache[:valid_name_letters].has_key?(index)
470
+ cached = node_cache[:valid_name_letters][index]
471
+ if cached
472
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
473
+ @index = cached.interval.end
474
+ end
475
+ return cached
476
+ end
477
+
478
+ s0, i0 = [], index
479
+ loop do
480
+ if has_terminal?('\G[a-z\\-æœàâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž]', true, index)
481
+ r1 = true
482
+ @index += 1
483
+ else
484
+ r1 = nil
485
+ end
486
+ if r1
487
+ s0 << r1
488
+ else
489
+ break
490
+ end
491
+ end
492
+ if s0.empty?
493
+ @index = i0
494
+ r0 = nil
495
+ else
496
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
497
+ r0.extend(ValidNameLetters0)
498
+ end
499
+
500
+ node_cache[:valid_name_letters][start_index] = r0
501
+
502
+ r0
503
+ end
504
+
505
+ module RightParen0
506
+ def space
507
+ elements[1]
508
+ end
509
+
510
+ end
511
+
512
+ def _nt_right_paren
513
+ start_index = index
514
+ if node_cache[:right_paren].has_key?(index)
515
+ cached = node_cache[:right_paren][index]
516
+ if cached
517
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
518
+ @index = cached.interval.end
519
+ end
520
+ return cached
521
+ end
522
+
523
+ i0 = index
524
+ i1, s1 = index, []
525
+ if has_terminal?(")", false, index)
526
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
527
+ @index += 1
528
+ else
529
+ terminal_parse_failure(")")
530
+ r2 = nil
531
+ end
532
+ s1 << r2
533
+ if r2
534
+ r3 = _nt_space
535
+ s1 << r3
536
+ if r3
537
+ if has_terminal?(")", false, index)
538
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
539
+ @index += 1
540
+ else
541
+ terminal_parse_failure(")")
542
+ r4 = nil
543
+ end
544
+ s1 << r4
545
+ end
546
+ end
547
+ if s1.last
548
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
549
+ r1.extend(RightParen0)
550
+ else
551
+ @index = i1
552
+ r1 = nil
553
+ end
554
+ if r1
555
+ r0 = r1
556
+ else
557
+ r5 = super
558
+ if r5
559
+ r0 = r5
560
+ else
561
+ @index = i0
562
+ r0 = nil
563
+ end
564
+ end
565
+
566
+ node_cache[:right_paren][start_index] = r0
567
+
568
+ r0
569
+ end
570
+
571
+ module LeftParen0
572
+ def space
573
+ elements[1]
574
+ end
575
+
576
+ end
577
+
578
+ def _nt_left_paren
579
+ start_index = index
580
+ if node_cache[:left_paren].has_key?(index)
581
+ cached = node_cache[:left_paren][index]
582
+ if cached
583
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
584
+ @index = cached.interval.end
585
+ end
586
+ return cached
587
+ end
588
+
589
+ i0 = index
590
+ i1, s1 = index, []
591
+ if has_terminal?("(", false, index)
592
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
593
+ @index += 1
594
+ else
595
+ terminal_parse_failure("(")
596
+ r2 = nil
597
+ end
598
+ s1 << r2
599
+ if r2
600
+ r3 = _nt_space
601
+ s1 << r3
602
+ if r3
603
+ if has_terminal?("(", false, index)
604
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
605
+ @index += 1
606
+ else
607
+ terminal_parse_failure("(")
608
+ r4 = nil
609
+ end
610
+ s1 << r4
611
+ end
612
+ end
613
+ if s1.last
614
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
615
+ r1.extend(LeftParen0)
616
+ else
617
+ @index = i1
618
+ r1 = nil
619
+ end
620
+ if r1
621
+ r0 = r1
622
+ else
623
+ r5 = super
624
+ if r5
625
+ r0 = r5
626
+ else
627
+ @index = i0
628
+ r0 = nil
629
+ end
630
+ end
631
+
632
+ node_cache[:left_paren][start_index] = r0
633
+
634
+ r0
635
+ end
636
+
637
+ module Year0
638
+ def a
639
+ elements[0]
640
+ end
641
+
642
+ def space
643
+ elements[1]
644
+ end
645
+
646
+ def b
647
+ elements[2]
648
+ end
649
+ end
650
+
651
+ module Year1
652
+ def value
653
+ a.value + " " + b.value
654
+ end
655
+
656
+ def pos
657
+ a.pos.merge(b.pos)
658
+ end
659
+
660
+ def details
661
+ {:year => a.value, :approximate_year => b.value}
662
+ end
663
+ end
664
+
665
+ module Year2
666
+ def a
667
+ elements[0]
668
+ end
669
+
670
+ def space
671
+ elements[1]
672
+ end
673
+
674
+ def page_number
675
+ elements[2]
676
+ end
677
+ end
678
+
679
+ module Year3
680
+ def value
681
+ a.text_value
682
+ end
683
+
684
+ def pos
685
+ {a.interval.begin => ['year', a.interval.end]}
686
+ end
687
+
688
+ def details
689
+ {:year => value}
690
+ end
691
+ end
692
+
693
+ def _nt_year
694
+ start_index = index
695
+ if node_cache[:year].has_key?(index)
696
+ cached = node_cache[:year][index]
697
+ if cached
698
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
699
+ @index = cached.interval.end
700
+ end
701
+ return cached
702
+ end
703
+
704
+ i0 = index
705
+ i1, s1 = index, []
706
+ r2 = _nt_year_number
707
+ s1 << r2
708
+ if r2
709
+ r3 = _nt_space
710
+ s1 << r3
711
+ if r3
712
+ r4 = _nt_approximate_year
713
+ s1 << r4
714
+ end
715
+ end
716
+ if s1.last
717
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
718
+ r1.extend(Year0)
719
+ r1.extend(Year1)
720
+ else
721
+ @index = i1
722
+ r1 = nil
723
+ end
724
+ if r1
725
+ r0 = r1
726
+ else
727
+ i5, s5 = index, []
728
+ r6 = _nt_year_number
729
+ s5 << r6
730
+ if r6
731
+ r7 = _nt_space
732
+ s5 << r7
733
+ if r7
734
+ r8 = _nt_page_number
735
+ s5 << r8
736
+ end
737
+ end
738
+ if s5.last
739
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
740
+ r5.extend(Year2)
741
+ r5.extend(Year3)
742
+ else
743
+ @index = i5
744
+ r5 = nil
745
+ end
746
+ if r5
747
+ r0 = r5
748
+ else
749
+ r9 = _nt_year_number_with_punctuation
750
+ if r9
751
+ r0 = r9
752
+ else
753
+ r10 = _nt_approximate_year
754
+ if r10
755
+ r0 = r10
756
+ else
757
+ r11 = _nt_double_year
758
+ if r11
759
+ r0 = r11
760
+ else
761
+ r12 = super
762
+ if r12
763
+ r0 = r12
764
+ else
765
+ @index = i0
766
+ r0 = nil
767
+ end
768
+ end
769
+ end
770
+ end
771
+ end
772
+ end
773
+
774
+ node_cache[:year][start_index] = r0
775
+
776
+ r0
777
+ end
778
+
779
+ module ApproximateYear0
780
+ def space1
781
+ elements[1]
782
+ end
783
+
784
+ def a
785
+ elements[2]
786
+ end
787
+
788
+ def space2
789
+ elements[3]
790
+ end
791
+
792
+ end
793
+
794
+ module ApproximateYear1
795
+ def value
796
+ "(" + a.text_value + ")"
797
+ end
798
+
799
+ def pos
800
+ {a.interval.begin => ['year', a.interval.end]}
801
+ end
802
+
803
+ def details
804
+ {:approximate_year => value}
805
+ end
806
+ end
807
+
808
+ def _nt_approximate_year
809
+ start_index = index
810
+ if node_cache[:approximate_year].has_key?(index)
811
+ cached = node_cache[:approximate_year][index]
812
+ if cached
813
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
814
+ @index = cached.interval.end
815
+ end
816
+ return cached
817
+ end
818
+
819
+ i0, s0 = index, []
820
+ if has_terminal?("[", false, index)
821
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
822
+ @index += 1
823
+ else
824
+ terminal_parse_failure("[")
825
+ r1 = nil
826
+ end
827
+ s0 << r1
828
+ if r1
829
+ r2 = _nt_space
830
+ s0 << r2
831
+ if r2
832
+ r3 = _nt_year_number
833
+ s0 << r3
834
+ if r3
835
+ r4 = _nt_space
836
+ s0 << r4
837
+ if r4
838
+ s5, i5 = [], index
839
+ loop do
840
+ if has_terminal?("]", false, index)
841
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
842
+ @index += 1
843
+ else
844
+ terminal_parse_failure("]")
845
+ r6 = nil
846
+ end
847
+ if r6
848
+ s5 << r6
849
+ else
850
+ break
851
+ end
852
+ end
853
+ if s5.empty?
854
+ @index = i5
855
+ r5 = nil
856
+ else
857
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
858
+ end
859
+ s0 << r5
860
+ end
861
+ end
862
+ end
863
+ end
864
+ if s0.last
865
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
866
+ r0.extend(ApproximateYear0)
867
+ r0.extend(ApproximateYear1)
868
+ else
869
+ @index = i0
870
+ r0 = nil
871
+ end
872
+
873
+ node_cache[:approximate_year][start_index] = r0
874
+
875
+ r0
876
+ end
877
+
878
+ module DoubleYear0
879
+ def year_number
880
+ elements[0]
881
+ end
882
+
883
+ end
884
+
885
+ module DoubleYear1
886
+ def value
887
+ text_value
888
+ end
889
+
890
+ def pos
891
+ {interval.begin => ['year', interval.end]}
892
+ end
893
+
894
+ def details
895
+ {:year => value}
896
+ end
897
+ end
898
+
899
+ def _nt_double_year
900
+ start_index = index
901
+ if node_cache[:double_year].has_key?(index)
902
+ cached = node_cache[:double_year][index]
903
+ if cached
904
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
905
+ @index = cached.interval.end
906
+ end
907
+ return cached
908
+ end
909
+
910
+ i0, s0 = index, []
911
+ r1 = _nt_year_number
912
+ s0 << r1
913
+ if r1
914
+ if has_terminal?("-", false, index)
915
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
916
+ @index += 1
917
+ else
918
+ terminal_parse_failure("-")
919
+ r2 = nil
920
+ end
921
+ s0 << r2
922
+ if r2
923
+ s3, i3 = [], index
924
+ loop do
925
+ if has_terminal?('\G[0-9]', true, index)
926
+ r4 = true
927
+ @index += 1
928
+ else
929
+ r4 = nil
930
+ end
931
+ if r4
932
+ s3 << r4
933
+ else
934
+ break
935
+ end
936
+ end
937
+ if s3.empty?
938
+ @index = i3
939
+ r3 = nil
940
+ else
941
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
942
+ end
943
+ s0 << r3
944
+ if r3
945
+ if has_terminal?('\G[A-Za-z]', true, index)
946
+ r6 = true
947
+ @index += 1
948
+ else
949
+ r6 = nil
950
+ end
951
+ if r6
952
+ r5 = r6
953
+ else
954
+ r5 = instantiate_node(SyntaxNode,input, index...index)
955
+ end
956
+ s0 << r5
957
+ if r5
958
+ if has_terminal?('\G[\\?]', true, index)
959
+ r8 = true
960
+ @index += 1
961
+ else
962
+ r8 = nil
963
+ end
964
+ if r8
965
+ r7 = r8
966
+ else
967
+ r7 = instantiate_node(SyntaxNode,input, index...index)
968
+ end
969
+ s0 << r7
970
+ end
971
+ end
972
+ end
973
+ end
974
+ if s0.last
975
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
976
+ r0.extend(DoubleYear0)
977
+ r0.extend(DoubleYear1)
978
+ else
979
+ @index = i0
980
+ r0 = nil
981
+ end
982
+
983
+ node_cache[:double_year][start_index] = r0
984
+
985
+ r0
986
+ end
987
+
988
+ module YearNumberWithPunctuation0
989
+ def a
990
+ elements[0]
991
+ end
992
+
993
+ end
994
+
995
+ module YearNumberWithPunctuation1
996
+ def value
997
+ a.text_value
998
+ end
999
+
1000
+ def pos
1001
+ {interval.begin => ['year', interval.end]}
1002
+ end
1003
+
1004
+ def details
1005
+ {:year => value}
1006
+ end
1007
+ end
1008
+
1009
+ def _nt_year_number_with_punctuation
1010
+ start_index = index
1011
+ if node_cache[:year_number_with_punctuation].has_key?(index)
1012
+ cached = node_cache[:year_number_with_punctuation][index]
1013
+ if cached
1014
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1015
+ @index = cached.interval.end
1016
+ end
1017
+ return cached
1018
+ end
1019
+
1020
+ i0, s0 = index, []
1021
+ r1 = _nt_year_number
1022
+ s0 << r1
1023
+ if r1
1024
+ if has_terminal?(".", false, index)
1025
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
1026
+ @index += 1
1027
+ else
1028
+ terminal_parse_failure(".")
1029
+ r2 = nil
1030
+ end
1031
+ s0 << r2
1032
+ end
1033
+ if s0.last
1034
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1035
+ r0.extend(YearNumberWithPunctuation0)
1036
+ r0.extend(YearNumberWithPunctuation1)
1037
+ else
1038
+ @index = i0
1039
+ r0 = nil
1040
+ end
1041
+
1042
+ node_cache[:year_number_with_punctuation][start_index] = r0
1043
+
1044
+ r0
1045
+ end
1046
+
1047
+ module PageNumber0
1048
+ def space
1049
+ elements[1]
1050
+ end
1051
+
1052
+ end
1053
+
1054
+ module PageNumber1
1055
+ def value
1056
+ end
1057
+ end
1058
+
1059
+ def _nt_page_number
1060
+ start_index = index
1061
+ if node_cache[:page_number].has_key?(index)
1062
+ cached = node_cache[:page_number][index]
1063
+ if cached
1064
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1065
+ @index = cached.interval.end
1066
+ end
1067
+ return cached
1068
+ end
1069
+
1070
+ i0, s0 = index, []
1071
+ if has_terminal?(":", false, index)
1072
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
1073
+ @index += 1
1074
+ else
1075
+ terminal_parse_failure(":")
1076
+ r1 = nil
1077
+ end
1078
+ s0 << r1
1079
+ if r1
1080
+ r2 = _nt_space
1081
+ s0 << r2
1082
+ if r2
1083
+ s3, i3 = [], index
1084
+ loop do
1085
+ if has_terminal?('\G[\\d]', true, index)
1086
+ r4 = true
1087
+ @index += 1
1088
+ else
1089
+ r4 = nil
1090
+ end
1091
+ if r4
1092
+ s3 << r4
1093
+ else
1094
+ break
1095
+ end
1096
+ end
1097
+ if s3.empty?
1098
+ @index = i3
1099
+ r3 = nil
1100
+ else
1101
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1102
+ end
1103
+ s0 << r3
1104
+ end
1105
+ end
1106
+ if s0.last
1107
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1108
+ r0.extend(PageNumber0)
1109
+ r0.extend(PageNumber1)
1110
+ else
1111
+ @index = i0
1112
+ r0 = nil
1113
+ end
1114
+
1115
+ node_cache[:page_number][start_index] = r0
1116
+
1117
+ r0
1118
+ end
1119
+
1120
+ def _nt_string_authorship_inconsistencies
1121
+ start_index = index
1122
+ if node_cache[:string_authorship_inconsistencies].has_key?(index)
1123
+ cached = node_cache[:string_authorship_inconsistencies][index]
1124
+ if cached
1125
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1126
+ @index = cached.interval.end
1127
+ end
1128
+ return cached
1129
+ end
1130
+
1131
+ if has_terminal?("corrig.", false, index)
1132
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 7))
1133
+ @index += 7
1134
+ else
1135
+ terminal_parse_failure("corrig.")
1136
+ r0 = nil
1137
+ end
1138
+
1139
+ node_cache[:string_authorship_inconsistencies][start_index] = r0
1140
+
1141
+ r0
1142
+ end
1143
+
1144
+ module Garbage0
1145
+ def space1
1146
+ elements[0]
1147
+ end
1148
+
1149
+ def space2
1150
+ elements[2]
1151
+ end
1152
+
1153
+ end
1154
+
1155
+ module Garbage1
1156
+ def space_hard
1157
+ elements[0]
1158
+ end
1159
+
1160
+ end
1161
+
1162
+ def _nt_garbage
1163
+ start_index = index
1164
+ if node_cache[:garbage].has_key?(index)
1165
+ cached = node_cache[:garbage][index]
1166
+ if cached
1167
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1168
+ @index = cached.interval.end
1169
+ end
1170
+ return cached
1171
+ end
1172
+
1173
+ i0 = index
1174
+ i1, s1 = index, []
1175
+ r2 = _nt_space
1176
+ s1 << r2
1177
+ if r2
1178
+ if has_terminal?('\G["\',]', true, index)
1179
+ r3 = true
1180
+ @index += 1
1181
+ else
1182
+ r3 = nil
1183
+ end
1184
+ s1 << r3
1185
+ if r3
1186
+ r4 = _nt_space
1187
+ s1 << r4
1188
+ if r4
1189
+ s5, i5 = [], index
1190
+ loop do
1191
+ if has_terminal?('\G[^щ]', true, index)
1192
+ r6 = true
1193
+ @index += 1
1194
+ else
1195
+ r6 = nil
1196
+ end
1197
+ if r6
1198
+ s5 << r6
1199
+ else
1200
+ break
1201
+ end
1202
+ end
1203
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1204
+ s1 << r5
1205
+ end
1206
+ end
1207
+ end
1208
+ if s1.last
1209
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1210
+ r1.extend(Garbage0)
1211
+ else
1212
+ @index = i1
1213
+ r1 = nil
1214
+ end
1215
+ if r1
1216
+ r0 = r1
1217
+ else
1218
+ i7, s7 = index, []
1219
+ r8 = _nt_space_hard
1220
+ s7 << r8
1221
+ if r8
1222
+ s9, i9 = [], index
1223
+ loop do
1224
+ if has_terminal?('\G[^ш]', true, index)
1225
+ r10 = true
1226
+ @index += 1
1227
+ else
1228
+ r10 = nil
1229
+ end
1230
+ if r10
1231
+ s9 << r10
1232
+ else
1233
+ break
1234
+ end
1235
+ end
1236
+ if s9.empty?
1237
+ @index = i9
1238
+ r9 = nil
1239
+ else
1240
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1241
+ end
1242
+ s7 << r9
1243
+ end
1244
+ if s7.last
1245
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
1246
+ r7.extend(Garbage1)
1247
+ else
1248
+ @index = i7
1249
+ r7 = nil
1250
+ end
1251
+ if r7
1252
+ r0 = r7
1253
+ else
1254
+ @index = i0
1255
+ r0 = nil
1256
+ end
1257
+ end
1258
+
1259
+ node_cache[:garbage][start_index] = r0
1260
+
1261
+ r0
1262
+ end
1263
+
1264
+ end
1265
+
1266
+ class ScientificNameDirtyParser < Treetop::Runtime::CompiledParser
1267
+ include ScientificNameDirty
1268
+ end
1269
+