biodiversity 0.5.16 → 0.6.0

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