dimus-biodiversity 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/bin/nnparse +2 -1
- data/lib/biodiversity/parser.rb +19 -1
- data/lib/biodiversity/parser/scientific_name_canonical.rb +214 -0
- data/lib/biodiversity/parser/scientific_name_canonical.treetop +40 -0
- data/lib/biodiversity/parser/{scientific_name.rb → scientific_name_clean.rb} +1432 -369
- data/lib/biodiversity/parser/{scientific_name.treetop → scientific_name_clean.treetop} +197 -18
- data/lib/biodiversity/parser/scientific_name_dirty.rb +473 -0
- data/lib/biodiversity/parser/scientific_name_dirty.treetop +80 -0
- data/spec/parser/scientific_name.spec.rb +14 -252
- data/spec/parser/scientific_name_canonical.spec.rb +43 -0
- data/spec/parser/scientific_name_clean.spec.rb +393 -0
- data/spec/parser/scientific_name_dirty.spec.rb +90 -0
- metadata +10 -3
data/Rakefile
CHANGED
@@ -26,7 +26,9 @@ task :default => :spec
|
|
26
26
|
|
27
27
|
|
28
28
|
task :tt do
|
29
|
-
system("tt #{dir}/lib/biodiversity/parser/
|
29
|
+
system("tt #{dir}/lib/biodiversity/parser/scientific_name_clean.treetop")
|
30
|
+
system("tt #{dir}/lib/biodiversity/parser/scientific_name_dirty.treetop")
|
31
|
+
system("tt #{dir}/lib/biodiversity/parser/scientific_name_canonical.treetop")
|
30
32
|
end
|
31
33
|
|
32
34
|
task :files do
|
data/bin/nnparse
CHANGED
@@ -13,6 +13,7 @@ end
|
|
13
13
|
|
14
14
|
|
15
15
|
parser = ScientificNameParser.new
|
16
|
+
dirty_parser = ScientificNameDirtyParser.new
|
16
17
|
|
17
18
|
output = ARGV[1] || 'parsed.json'
|
18
19
|
o = File.open(output,'w')
|
@@ -30,7 +31,7 @@ IO.foreach(ARGV[0]) do |n|
|
|
30
31
|
p count2 if count2 % 5000 == 0
|
31
32
|
n.strip!
|
32
33
|
name_dict = {:input => n}
|
33
|
-
parsed = parser.parse n
|
34
|
+
parsed = parser.parse(n) || dirty_parser.parse(n)
|
34
35
|
unless parsed
|
35
36
|
name_dict[:details] = {:parsed => false}
|
36
37
|
last_result = JSON.generate name_dict
|
data/lib/biodiversity/parser.rb
CHANGED
@@ -1,3 +1,21 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
dir = File.dirname(__FILE__)
|
3
|
-
require File.join(dir, *%w[parser
|
3
|
+
require File.join(dir, *%w[parser scientific_name_clean])
|
4
|
+
require File.join(dir, *%w[parser scientific_name_dirty])
|
5
|
+
require File.join(dir, *%w[parser scientific_name_canonical])
|
6
|
+
|
7
|
+
|
8
|
+
class ScientificNameParser
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@clean = ScientificNameCleanParser.new
|
12
|
+
@dirty = ScientificNameDirtyParser.new
|
13
|
+
@canonical = ScientificNameCanonicalParser.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def parse(a_string)
|
17
|
+
@clean.parse(a_string) || @dirty.parse(a_string) || @canonical.parse(a_string)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,214 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
module ScientificNameCanonical
|
3
|
+
include Treetop::Runtime
|
4
|
+
|
5
|
+
def root
|
6
|
+
@root || :composite_scientific_name
|
7
|
+
end
|
8
|
+
|
9
|
+
include ScientificNameClean
|
10
|
+
|
11
|
+
include ScientificNameDirty
|
12
|
+
|
13
|
+
def _nt_composite_scientific_name
|
14
|
+
start_index = index
|
15
|
+
if node_cache[:composite_scientific_name].has_key?(index)
|
16
|
+
cached = node_cache[:composite_scientific_name][index]
|
17
|
+
@index = cached.interval.end if cached
|
18
|
+
return cached
|
19
|
+
end
|
20
|
+
|
21
|
+
r0 = _nt_name_part_with_garbage
|
22
|
+
|
23
|
+
node_cache[:composite_scientific_name][start_index] = r0
|
24
|
+
|
25
|
+
return r0
|
26
|
+
end
|
27
|
+
|
28
|
+
module NamePartWithGarbage0
|
29
|
+
def a
|
30
|
+
elements[0]
|
31
|
+
end
|
32
|
+
|
33
|
+
def space
|
34
|
+
elements[1]
|
35
|
+
end
|
36
|
+
|
37
|
+
def b
|
38
|
+
elements[2]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module NamePartWithGarbage1
|
43
|
+
def value
|
44
|
+
a.value
|
45
|
+
end
|
46
|
+
def canonical
|
47
|
+
a.canonical
|
48
|
+
end
|
49
|
+
def details
|
50
|
+
a.details.merge(:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module NamePartWithGarbage2
|
55
|
+
def a
|
56
|
+
elements[0]
|
57
|
+
end
|
58
|
+
|
59
|
+
def space
|
60
|
+
elements[1]
|
61
|
+
end
|
62
|
+
|
63
|
+
def b
|
64
|
+
elements[2]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
module NamePartWithGarbage3
|
69
|
+
def value
|
70
|
+
a.value
|
71
|
+
end
|
72
|
+
def canonical
|
73
|
+
a.canonical
|
74
|
+
end
|
75
|
+
def details
|
76
|
+
a.details.merge(:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def _nt_name_part_with_garbage
|
81
|
+
start_index = index
|
82
|
+
if node_cache[:name_part_with_garbage].has_key?(index)
|
83
|
+
cached = node_cache[:name_part_with_garbage][index]
|
84
|
+
@index = cached.interval.end if cached
|
85
|
+
return cached
|
86
|
+
end
|
87
|
+
|
88
|
+
i0 = index
|
89
|
+
i1, s1 = index, []
|
90
|
+
r2 = _nt_species_name
|
91
|
+
s1 << r2
|
92
|
+
if r2
|
93
|
+
r3 = _nt_space
|
94
|
+
s1 << r3
|
95
|
+
if r3
|
96
|
+
s4, i4 = [], index
|
97
|
+
loop do
|
98
|
+
if input.index(Regexp.new('[^ш]'), index) == index
|
99
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
100
|
+
@index += 1
|
101
|
+
else
|
102
|
+
r5 = nil
|
103
|
+
end
|
104
|
+
if r5
|
105
|
+
s4 << r5
|
106
|
+
else
|
107
|
+
break
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if s4.empty?
|
111
|
+
self.index = i4
|
112
|
+
r4 = nil
|
113
|
+
else
|
114
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
115
|
+
end
|
116
|
+
s1 << r4
|
117
|
+
end
|
118
|
+
end
|
119
|
+
if s1.last
|
120
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
121
|
+
r1.extend(NamePartWithGarbage0)
|
122
|
+
r1.extend(NamePartWithGarbage1)
|
123
|
+
else
|
124
|
+
self.index = i1
|
125
|
+
r1 = nil
|
126
|
+
end
|
127
|
+
if r1
|
128
|
+
r0 = r1
|
129
|
+
else
|
130
|
+
i6, s6 = index, []
|
131
|
+
r7 = _nt_name_part
|
132
|
+
s6 << r7
|
133
|
+
if r7
|
134
|
+
r8 = _nt_space
|
135
|
+
s6 << r8
|
136
|
+
if r8
|
137
|
+
s9, i9 = [], index
|
138
|
+
loop do
|
139
|
+
if input.index(Regexp.new('[^ш]'), index) == index
|
140
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
141
|
+
@index += 1
|
142
|
+
else
|
143
|
+
r10 = nil
|
144
|
+
end
|
145
|
+
if r10
|
146
|
+
s9 << r10
|
147
|
+
else
|
148
|
+
break
|
149
|
+
end
|
150
|
+
end
|
151
|
+
if s9.empty?
|
152
|
+
self.index = i9
|
153
|
+
r9 = nil
|
154
|
+
else
|
155
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
156
|
+
end
|
157
|
+
s6 << r9
|
158
|
+
end
|
159
|
+
end
|
160
|
+
if s6.last
|
161
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
162
|
+
r6.extend(NamePartWithGarbage2)
|
163
|
+
r6.extend(NamePartWithGarbage3)
|
164
|
+
else
|
165
|
+
self.index = i6
|
166
|
+
r6 = nil
|
167
|
+
end
|
168
|
+
if r6
|
169
|
+
r0 = r6
|
170
|
+
else
|
171
|
+
self.index = i0
|
172
|
+
r0 = nil
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
node_cache[:name_part_with_garbage][start_index] = r0
|
177
|
+
|
178
|
+
return r0
|
179
|
+
end
|
180
|
+
|
181
|
+
def _nt_garbage
|
182
|
+
start_index = index
|
183
|
+
if node_cache[:garbage].has_key?(index)
|
184
|
+
cached = node_cache[:garbage][index]
|
185
|
+
@index = cached.interval.end if cached
|
186
|
+
return cached
|
187
|
+
end
|
188
|
+
|
189
|
+
s0, i0 = [], index
|
190
|
+
loop do
|
191
|
+
if input.index(Regexp.new('[.]'), index) == index
|
192
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
193
|
+
@index += 1
|
194
|
+
else
|
195
|
+
r1 = nil
|
196
|
+
end
|
197
|
+
if r1
|
198
|
+
s0 << r1
|
199
|
+
else
|
200
|
+
break
|
201
|
+
end
|
202
|
+
end
|
203
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
204
|
+
|
205
|
+
node_cache[:garbage][start_index] = r0
|
206
|
+
|
207
|
+
return r0
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
class ScientificNameCanonicalParser < Treetop::Runtime::CompiledParser
|
213
|
+
include ScientificNameCanonical
|
214
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
grammar ScientificNameCanonical
|
3
|
+
include ScientificNameClean
|
4
|
+
include ScientificNameDirty
|
5
|
+
|
6
|
+
rule composite_scientific_name
|
7
|
+
name_part_with_garbage
|
8
|
+
end
|
9
|
+
|
10
|
+
rule name_part_with_garbage
|
11
|
+
a:species_name space b:[^ш]+ {
|
12
|
+
def value
|
13
|
+
a.value
|
14
|
+
end
|
15
|
+
def canonical
|
16
|
+
a.canonical
|
17
|
+
end
|
18
|
+
def details
|
19
|
+
a.details.merge(:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value)
|
20
|
+
end
|
21
|
+
}
|
22
|
+
/
|
23
|
+
a:name_part space b:[^ш]+ {
|
24
|
+
def value
|
25
|
+
a.value
|
26
|
+
end
|
27
|
+
def canonical
|
28
|
+
a.canonical
|
29
|
+
end
|
30
|
+
def details
|
31
|
+
a.details.merge(:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value)
|
32
|
+
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
rule garbage
|
37
|
+
[.]*
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
module
|
2
|
+
module ScientificNameClean
|
3
3
|
include Treetop::Runtime
|
4
4
|
|
5
5
|
def root
|
@@ -203,17 +203,27 @@ module ScientificName
|
|
203
203
|
def space
|
204
204
|
elements[6]
|
205
205
|
end
|
206
|
+
|
207
|
+
def d
|
208
|
+
elements[7]
|
209
|
+
end
|
210
|
+
|
211
|
+
def space
|
212
|
+
elements[8]
|
213
|
+
end
|
206
214
|
end
|
207
215
|
|
208
216
|
module ScientificName1
|
209
217
|
def value
|
210
|
-
a.value + " " + b.value + " " + c.
|
218
|
+
a.value + " " + b.value + " " + c.apply(d)
|
211
219
|
end
|
220
|
+
|
212
221
|
def canonical
|
213
222
|
a.canonical
|
214
223
|
end
|
224
|
+
|
215
225
|
def details
|
216
|
-
a.details.merge(b.details).merge(c.details)
|
226
|
+
a.details.merge(b.details).merge(c.details(d)).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => (b.text_value + " " + c.text_value + " " + d.text_value).gsub(/\s{2,}/, ' ').strip})
|
217
227
|
end
|
218
228
|
end
|
219
229
|
|
@@ -237,17 +247,27 @@ module ScientificName
|
|
237
247
|
def space
|
238
248
|
elements[4]
|
239
249
|
end
|
250
|
+
|
251
|
+
def c
|
252
|
+
elements[5]
|
253
|
+
end
|
254
|
+
|
255
|
+
def space
|
256
|
+
elements[6]
|
257
|
+
end
|
240
258
|
end
|
241
259
|
|
242
260
|
module ScientificName3
|
243
261
|
def value
|
244
|
-
a.value + " " + b.
|
262
|
+
a.value + " " + b.apply(c)
|
245
263
|
end
|
264
|
+
|
246
265
|
def canonical
|
247
266
|
a.canonical
|
248
267
|
end
|
268
|
+
|
249
269
|
def details
|
250
|
-
a.details.merge(b.details)
|
270
|
+
a.details.merge(b.details(c)).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => (b.text_value + " " + c.text_value).gsub(/\s{2,}/, ' ').strip})
|
251
271
|
end
|
252
272
|
end
|
253
273
|
|
@@ -271,9 +291,85 @@ module ScientificName
|
|
271
291
|
def space
|
272
292
|
elements[4]
|
273
293
|
end
|
294
|
+
|
295
|
+
def c
|
296
|
+
elements[5]
|
297
|
+
end
|
298
|
+
|
299
|
+
def space
|
300
|
+
elements[6]
|
301
|
+
end
|
274
302
|
end
|
275
303
|
|
276
304
|
module ScientificName5
|
305
|
+
def value
|
306
|
+
a.value + " " + b.value + " " + c.value
|
307
|
+
end
|
308
|
+
def canonical
|
309
|
+
a.canonical
|
310
|
+
end
|
311
|
+
def details
|
312
|
+
a.details.merge(b.details).merge(c.details).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => (b.text_value + " " + c.text_value).gsub(/\s{2,}/, ' ').strip})
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
module ScientificName6
|
317
|
+
def space
|
318
|
+
elements[0]
|
319
|
+
end
|
320
|
+
|
321
|
+
def a
|
322
|
+
elements[1]
|
323
|
+
end
|
324
|
+
|
325
|
+
def space
|
326
|
+
elements[2]
|
327
|
+
end
|
328
|
+
|
329
|
+
def b
|
330
|
+
elements[3]
|
331
|
+
end
|
332
|
+
|
333
|
+
def space
|
334
|
+
elements[4]
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
module ScientificName7
|
339
|
+
def value
|
340
|
+
a.value + " " + b.value
|
341
|
+
end
|
342
|
+
def canonical
|
343
|
+
a.canonical
|
344
|
+
end
|
345
|
+
def details
|
346
|
+
a.details.merge(b.details).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value.gsub(/\s{2,}/, ' ')})
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
module ScientificName8
|
351
|
+
def space
|
352
|
+
elements[0]
|
353
|
+
end
|
354
|
+
|
355
|
+
def a
|
356
|
+
elements[1]
|
357
|
+
end
|
358
|
+
|
359
|
+
def space
|
360
|
+
elements[2]
|
361
|
+
end
|
362
|
+
|
363
|
+
def b
|
364
|
+
elements[3]
|
365
|
+
end
|
366
|
+
|
367
|
+
def space
|
368
|
+
elements[4]
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
module ScientificName9
|
277
373
|
def value
|
278
374
|
a.value + " " + b.value
|
279
375
|
end
|
@@ -283,7 +379,7 @@ module ScientificName
|
|
283
379
|
end
|
284
380
|
|
285
381
|
def details
|
286
|
-
a.details.merge(b.details).merge({:is_valid => false})
|
382
|
+
a.details.merge(b.details).merge({:is_valid => false}).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value.gsub(/\s{2,}/, ' ')})
|
287
383
|
end
|
288
384
|
end
|
289
385
|
|
@@ -316,11 +412,19 @@ module ScientificName
|
|
316
412
|
r7 = _nt_space
|
317
413
|
s2 << r7
|
318
414
|
if r7
|
319
|
-
r8 =
|
415
|
+
r8 = _nt_taxon_concept_rank
|
320
416
|
s2 << r8
|
321
417
|
if r8
|
322
418
|
r9 = _nt_space
|
323
419
|
s2 << r9
|
420
|
+
if r9
|
421
|
+
r10 = _nt_authors_part
|
422
|
+
s2 << r10
|
423
|
+
if r10
|
424
|
+
r11 = _nt_space
|
425
|
+
s2 << r11
|
426
|
+
end
|
427
|
+
end
|
324
428
|
end
|
325
429
|
end
|
326
430
|
end
|
@@ -338,72 +442,150 @@ module ScientificName
|
|
338
442
|
if r2
|
339
443
|
r0 = r2
|
340
444
|
else
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
if
|
345
|
-
|
346
|
-
|
347
|
-
if
|
348
|
-
|
349
|
-
|
350
|
-
if
|
351
|
-
|
352
|
-
|
353
|
-
if
|
354
|
-
|
355
|
-
|
445
|
+
i12, s12 = index, []
|
446
|
+
r13 = _nt_space
|
447
|
+
s12 << r13
|
448
|
+
if r13
|
449
|
+
r14 = _nt_name_part
|
450
|
+
s12 << r14
|
451
|
+
if r14
|
452
|
+
r15 = _nt_space
|
453
|
+
s12 << r15
|
454
|
+
if r15
|
455
|
+
r16 = _nt_taxon_concept_rank
|
456
|
+
s12 << r16
|
457
|
+
if r16
|
458
|
+
r17 = _nt_space
|
459
|
+
s12 << r17
|
460
|
+
if r17
|
461
|
+
r18 = _nt_authors_part
|
462
|
+
s12 << r18
|
463
|
+
if r18
|
464
|
+
r19 = _nt_space
|
465
|
+
s12 << r19
|
466
|
+
end
|
467
|
+
end
|
356
468
|
end
|
357
469
|
end
|
358
470
|
end
|
359
471
|
end
|
360
|
-
if
|
361
|
-
|
362
|
-
|
363
|
-
|
472
|
+
if s12.last
|
473
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
474
|
+
r12.extend(ScientificName2)
|
475
|
+
r12.extend(ScientificName3)
|
364
476
|
else
|
365
|
-
self.index =
|
366
|
-
|
477
|
+
self.index = i12
|
478
|
+
r12 = nil
|
367
479
|
end
|
368
|
-
if
|
369
|
-
r0 =
|
480
|
+
if r12
|
481
|
+
r0 = r12
|
370
482
|
else
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
if
|
375
|
-
|
376
|
-
|
377
|
-
if
|
378
|
-
|
379
|
-
|
380
|
-
if
|
381
|
-
|
382
|
-
|
383
|
-
if
|
384
|
-
|
385
|
-
|
483
|
+
i20, s20 = index, []
|
484
|
+
r21 = _nt_space
|
485
|
+
s20 << r21
|
486
|
+
if r21
|
487
|
+
r22 = _nt_name_part
|
488
|
+
s20 << r22
|
489
|
+
if r22
|
490
|
+
r23 = _nt_space
|
491
|
+
s20 << r23
|
492
|
+
if r23
|
493
|
+
r24 = _nt_authors_part
|
494
|
+
s20 << r24
|
495
|
+
if r24
|
496
|
+
r25 = _nt_space
|
497
|
+
s20 << r25
|
498
|
+
if r25
|
499
|
+
r26 = _nt_status_part
|
500
|
+
s20 << r26
|
501
|
+
if r26
|
502
|
+
r27 = _nt_space
|
503
|
+
s20 << r27
|
504
|
+
end
|
505
|
+
end
|
386
506
|
end
|
387
507
|
end
|
388
508
|
end
|
389
509
|
end
|
390
|
-
if
|
391
|
-
|
392
|
-
|
393
|
-
|
510
|
+
if s20.last
|
511
|
+
r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
|
512
|
+
r20.extend(ScientificName4)
|
513
|
+
r20.extend(ScientificName5)
|
394
514
|
else
|
395
|
-
self.index =
|
396
|
-
|
515
|
+
self.index = i20
|
516
|
+
r20 = nil
|
397
517
|
end
|
398
|
-
if
|
399
|
-
r0 =
|
518
|
+
if r20
|
519
|
+
r0 = r20
|
400
520
|
else
|
401
|
-
|
402
|
-
|
403
|
-
|
521
|
+
i28, s28 = index, []
|
522
|
+
r29 = _nt_space
|
523
|
+
s28 << r29
|
524
|
+
if r29
|
525
|
+
r30 = _nt_name_part
|
526
|
+
s28 << r30
|
527
|
+
if r30
|
528
|
+
r31 = _nt_space
|
529
|
+
s28 << r31
|
530
|
+
if r31
|
531
|
+
r32 = _nt_authors_part
|
532
|
+
s28 << r32
|
533
|
+
if r32
|
534
|
+
r33 = _nt_space
|
535
|
+
s28 << r33
|
536
|
+
end
|
537
|
+
end
|
538
|
+
end
|
539
|
+
end
|
540
|
+
if s28.last
|
541
|
+
r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
|
542
|
+
r28.extend(ScientificName6)
|
543
|
+
r28.extend(ScientificName7)
|
404
544
|
else
|
405
|
-
self.index =
|
406
|
-
|
545
|
+
self.index = i28
|
546
|
+
r28 = nil
|
547
|
+
end
|
548
|
+
if r28
|
549
|
+
r0 = r28
|
550
|
+
else
|
551
|
+
i34, s34 = index, []
|
552
|
+
r35 = _nt_space
|
553
|
+
s34 << r35
|
554
|
+
if r35
|
555
|
+
r36 = _nt_name_part
|
556
|
+
s34 << r36
|
557
|
+
if r36
|
558
|
+
r37 = _nt_space
|
559
|
+
s34 << r37
|
560
|
+
if r37
|
561
|
+
r38 = _nt_year
|
562
|
+
s34 << r38
|
563
|
+
if r38
|
564
|
+
r39 = _nt_space
|
565
|
+
s34 << r39
|
566
|
+
end
|
567
|
+
end
|
568
|
+
end
|
569
|
+
end
|
570
|
+
if s34.last
|
571
|
+
r34 = instantiate_node(SyntaxNode,input, i34...index, s34)
|
572
|
+
r34.extend(ScientificName8)
|
573
|
+
r34.extend(ScientificName9)
|
574
|
+
else
|
575
|
+
self.index = i34
|
576
|
+
r34 = nil
|
577
|
+
end
|
578
|
+
if r34
|
579
|
+
r0 = r34
|
580
|
+
else
|
581
|
+
r40 = _nt_name_part
|
582
|
+
if r40
|
583
|
+
r0 = r40
|
584
|
+
else
|
585
|
+
self.index = i0
|
586
|
+
r0 = nil
|
587
|
+
end
|
588
|
+
end
|
407
589
|
end
|
408
590
|
end
|
409
591
|
end
|
@@ -577,13 +759,13 @@ module ScientificName
|
|
577
759
|
|
578
760
|
module NamePartAuthorsMix1
|
579
761
|
def value
|
580
|
-
a.value + " " + b.value + " " + c.value + " " + d.value
|
762
|
+
(a.value + " " + b.value + " " + c.value + " " + d.value).gsub(/\s+/,' ')
|
581
763
|
end
|
582
764
|
def canonical
|
583
|
-
a.canonical + " " + c.canonical
|
765
|
+
(a.canonical + " " + c.canonical).gsub(/\s+/,' ')
|
584
766
|
end
|
585
767
|
def details
|
586
|
-
a.details.merge(c.details).merge({:species_authors=>b.details, :subspecies_authors => d.details})
|
768
|
+
a.details.merge(c.details).merge({:species_authors=>b.details, :subspecies_authors => d.details}).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => (b.text_value + " " + c.text_value + " " + d.text_value).gsub(/\s{2,}/, ' ')})
|
587
769
|
end
|
588
770
|
end
|
589
771
|
|
@@ -611,13 +793,13 @@ module ScientificName
|
|
611
793
|
|
612
794
|
module NamePartAuthorsMix3
|
613
795
|
def value
|
614
|
-
a.value + " " + b.value + " " + c.value
|
796
|
+
(a.value + " " + b.value + " " + c.value).gsub(/\s+/,' ')
|
615
797
|
end
|
616
798
|
def canonical
|
617
|
-
a.canonical + " " + c.canonical
|
799
|
+
(a.canonical + " " + c.canonical).gsub(/\s+/,' ')
|
618
800
|
end
|
619
801
|
def details
|
620
|
-
a.details.merge(c.details).merge({:species_authors=>b.details})
|
802
|
+
a.details.merge(c.details).merge({:species_authors=>b.details}).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => (b.text_value + " " + c.text_value).gsub(/\s{2,}/, ' ')})
|
621
803
|
end
|
622
804
|
end
|
623
805
|
|
@@ -970,6 +1152,10 @@ module ScientificName
|
|
970
1152
|
end
|
971
1153
|
|
972
1154
|
module OriginalAuthorsNamesFull0
|
1155
|
+
def left_bracket
|
1156
|
+
elements[0]
|
1157
|
+
end
|
1158
|
+
|
973
1159
|
def space
|
974
1160
|
elements[1]
|
975
1161
|
end
|
@@ -982,6 +1168,10 @@ module ScientificName
|
|
982
1168
|
elements[3]
|
983
1169
|
end
|
984
1170
|
|
1171
|
+
def right_bracket
|
1172
|
+
elements[4]
|
1173
|
+
end
|
1174
|
+
|
985
1175
|
def space
|
986
1176
|
elements[5]
|
987
1177
|
end
|
@@ -1005,6 +1195,10 @@ module ScientificName
|
|
1005
1195
|
end
|
1006
1196
|
|
1007
1197
|
module OriginalAuthorsNamesFull2
|
1198
|
+
def left_bracket
|
1199
|
+
elements[0]
|
1200
|
+
end
|
1201
|
+
|
1008
1202
|
def space
|
1009
1203
|
elements[1]
|
1010
1204
|
end
|
@@ -1017,6 +1211,9 @@ module ScientificName
|
|
1017
1211
|
elements[3]
|
1018
1212
|
end
|
1019
1213
|
|
1214
|
+
def right_bracket
|
1215
|
+
elements[4]
|
1216
|
+
end
|
1020
1217
|
end
|
1021
1218
|
|
1022
1219
|
module OriginalAuthorsNamesFull3
|
@@ -1028,6 +1225,88 @@ module ScientificName
|
|
1028
1225
|
end
|
1029
1226
|
end
|
1030
1227
|
|
1228
|
+
module OriginalAuthorsNamesFull4
|
1229
|
+
def space
|
1230
|
+
elements[1]
|
1231
|
+
end
|
1232
|
+
|
1233
|
+
def a
|
1234
|
+
elements[2]
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
def space
|
1238
|
+
elements[3]
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
module OriginalAuthorsNamesFull5
|
1244
|
+
def value
|
1245
|
+
"(" + a.value + ")"
|
1246
|
+
end
|
1247
|
+
def details
|
1248
|
+
{:orig_authors => a.details[:authors]}
|
1249
|
+
end
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
module OriginalAuthorsNamesFull6
|
1253
|
+
def left_bracket
|
1254
|
+
elements[0]
|
1255
|
+
end
|
1256
|
+
|
1257
|
+
def space
|
1258
|
+
elements[1]
|
1259
|
+
end
|
1260
|
+
|
1261
|
+
def a
|
1262
|
+
elements[2]
|
1263
|
+
end
|
1264
|
+
|
1265
|
+
def space
|
1266
|
+
elements[3]
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
def right_bracket
|
1270
|
+
elements[4]
|
1271
|
+
end
|
1272
|
+
end
|
1273
|
+
|
1274
|
+
module OriginalAuthorsNamesFull7
|
1275
|
+
def value
|
1276
|
+
"(" + a.value + ")"
|
1277
|
+
end
|
1278
|
+
def details
|
1279
|
+
{:orig_authors => a.details[:authors]}
|
1280
|
+
end
|
1281
|
+
end
|
1282
|
+
|
1283
|
+
module OriginalAuthorsNamesFull8
|
1284
|
+
def left_bracket
|
1285
|
+
elements[0]
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
def space
|
1289
|
+
elements[1]
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
def space
|
1293
|
+
elements[3]
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
def right_bracket
|
1297
|
+
elements[4]
|
1298
|
+
end
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
module OriginalAuthorsNamesFull9
|
1302
|
+
def value
|
1303
|
+
"(?)"
|
1304
|
+
end
|
1305
|
+
def details
|
1306
|
+
{:orig_authors => "unknown"}
|
1307
|
+
end
|
1308
|
+
end
|
1309
|
+
|
1031
1310
|
def _nt_original_authors_names_full
|
1032
1311
|
start_index = index
|
1033
1312
|
if node_cache[:original_authors_names_full].has_key?(index)
|
@@ -1038,13 +1317,7 @@ module ScientificName
|
|
1038
1317
|
|
1039
1318
|
i0 = index
|
1040
1319
|
i1, s1 = index, []
|
1041
|
-
|
1042
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1043
|
-
@index += 1
|
1044
|
-
else
|
1045
|
-
terminal_parse_failure("(")
|
1046
|
-
r2 = nil
|
1047
|
-
end
|
1320
|
+
r2 = _nt_left_bracket
|
1048
1321
|
s1 << r2
|
1049
1322
|
if r2
|
1050
1323
|
r3 = _nt_space
|
@@ -1056,13 +1329,7 @@ module ScientificName
|
|
1056
1329
|
r5 = _nt_space
|
1057
1330
|
s1 << r5
|
1058
1331
|
if r5
|
1059
|
-
|
1060
|
-
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1061
|
-
@index += 1
|
1062
|
-
else
|
1063
|
-
terminal_parse_failure(")")
|
1064
|
-
r6 = nil
|
1065
|
-
end
|
1332
|
+
r6 = _nt_right_bracket
|
1066
1333
|
s1 << r6
|
1067
1334
|
if r6
|
1068
1335
|
r7 = _nt_space
|
@@ -1106,13 +1373,7 @@ module ScientificName
|
|
1106
1373
|
r0 = r1
|
1107
1374
|
else
|
1108
1375
|
i12, s12 = index, []
|
1109
|
-
|
1110
|
-
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1111
|
-
@index += 1
|
1112
|
-
else
|
1113
|
-
terminal_parse_failure("(")
|
1114
|
-
r13 = nil
|
1115
|
-
end
|
1376
|
+
r13 = _nt_left_bracket
|
1116
1377
|
s12 << r13
|
1117
1378
|
if r13
|
1118
1379
|
r14 = _nt_space
|
@@ -1124,13 +1385,7 @@ module ScientificName
|
|
1124
1385
|
r16 = _nt_space
|
1125
1386
|
s12 << r16
|
1126
1387
|
if r16
|
1127
|
-
|
1128
|
-
r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1129
|
-
@index += 1
|
1130
|
-
else
|
1131
|
-
terminal_parse_failure(")")
|
1132
|
-
r17 = nil
|
1133
|
-
end
|
1388
|
+
r17 = _nt_right_bracket
|
1134
1389
|
s12 << r17
|
1135
1390
|
end
|
1136
1391
|
end
|
@@ -1147,22 +1402,137 @@ module ScientificName
|
|
1147
1402
|
if r12
|
1148
1403
|
r0 = r12
|
1149
1404
|
else
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1405
|
+
i18, s18 = index, []
|
1406
|
+
if input.index("[", index) == index
|
1407
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1408
|
+
@index += 1
|
1409
|
+
else
|
1410
|
+
terminal_parse_failure("[")
|
1411
|
+
r19 = nil
|
1412
|
+
end
|
1413
|
+
s18 << r19
|
1414
|
+
if r19
|
1415
|
+
r20 = _nt_space
|
1416
|
+
s18 << r20
|
1417
|
+
if r20
|
1418
|
+
r21 = _nt_authors_names_full
|
1419
|
+
s18 << r21
|
1420
|
+
if r21
|
1421
|
+
r22 = _nt_space
|
1422
|
+
s18 << r22
|
1423
|
+
if r22
|
1424
|
+
if input.index("]", index) == index
|
1425
|
+
r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1426
|
+
@index += 1
|
1427
|
+
else
|
1428
|
+
terminal_parse_failure("]")
|
1429
|
+
r23 = nil
|
1430
|
+
end
|
1431
|
+
s18 << r23
|
1432
|
+
end
|
1433
|
+
end
|
1434
|
+
end
|
1435
|
+
end
|
1436
|
+
if s18.last
|
1437
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
1438
|
+
r18.extend(OriginalAuthorsNamesFull4)
|
1439
|
+
r18.extend(OriginalAuthorsNamesFull5)
|
1440
|
+
else
|
1441
|
+
self.index = i18
|
1442
|
+
r18 = nil
|
1443
|
+
end
|
1444
|
+
if r18
|
1445
|
+
r0 = r18
|
1446
|
+
else
|
1447
|
+
i24, s24 = index, []
|
1448
|
+
r25 = _nt_left_bracket
|
1449
|
+
s24 << r25
|
1450
|
+
if r25
|
1451
|
+
r26 = _nt_space
|
1452
|
+
s24 << r26
|
1453
|
+
if r26
|
1454
|
+
r27 = _nt_unknown_auth
|
1455
|
+
s24 << r27
|
1456
|
+
if r27
|
1457
|
+
r28 = _nt_space
|
1458
|
+
s24 << r28
|
1459
|
+
if r28
|
1460
|
+
r29 = _nt_right_bracket
|
1461
|
+
s24 << r29
|
1462
|
+
end
|
1463
|
+
end
|
1464
|
+
end
|
1465
|
+
end
|
1466
|
+
if s24.last
|
1467
|
+
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
1468
|
+
r24.extend(OriginalAuthorsNamesFull6)
|
1469
|
+
r24.extend(OriginalAuthorsNamesFull7)
|
1470
|
+
else
|
1471
|
+
self.index = i24
|
1472
|
+
r24 = nil
|
1473
|
+
end
|
1474
|
+
if r24
|
1475
|
+
r0 = r24
|
1476
|
+
else
|
1477
|
+
i30, s30 = index, []
|
1478
|
+
r31 = _nt_left_bracket
|
1479
|
+
s30 << r31
|
1480
|
+
if r31
|
1481
|
+
r32 = _nt_space
|
1482
|
+
s30 << r32
|
1483
|
+
if r32
|
1484
|
+
if input.index("?", index) == index
|
1485
|
+
r33 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1486
|
+
@index += 1
|
1487
|
+
else
|
1488
|
+
terminal_parse_failure("?")
|
1489
|
+
r33 = nil
|
1490
|
+
end
|
1491
|
+
s30 << r33
|
1492
|
+
if r33
|
1493
|
+
r34 = _nt_space
|
1494
|
+
s30 << r34
|
1495
|
+
if r34
|
1496
|
+
r35 = _nt_right_bracket
|
1497
|
+
s30 << r35
|
1498
|
+
end
|
1499
|
+
end
|
1500
|
+
end
|
1501
|
+
end
|
1502
|
+
if s30.last
|
1503
|
+
r30 = instantiate_node(SyntaxNode,input, i30...index, s30)
|
1504
|
+
r30.extend(OriginalAuthorsNamesFull8)
|
1505
|
+
r30.extend(OriginalAuthorsNamesFull9)
|
1506
|
+
else
|
1507
|
+
self.index = i30
|
1508
|
+
r30 = nil
|
1509
|
+
end
|
1510
|
+
if r30
|
1511
|
+
r0 = r30
|
1512
|
+
else
|
1513
|
+
self.index = i0
|
1514
|
+
r0 = nil
|
1515
|
+
end
|
1516
|
+
end
|
1517
|
+
end
|
1518
|
+
end
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
node_cache[:original_authors_names_full][start_index] = r0
|
1522
|
+
|
1523
|
+
return r0
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
module OriginalAuthorsRevisedName0
|
1527
|
+
def left_bracket
|
1528
|
+
elements[0]
|
1529
|
+
end
|
1530
|
+
|
1531
|
+
def space
|
1532
|
+
elements[1]
|
1533
|
+
end
|
1534
|
+
|
1535
|
+
def a
|
1166
1536
|
elements[2]
|
1167
1537
|
end
|
1168
1538
|
|
@@ -1170,6 +1540,9 @@ module ScientificName
|
|
1170
1540
|
elements[3]
|
1171
1541
|
end
|
1172
1542
|
|
1543
|
+
def right_bracket
|
1544
|
+
elements[4]
|
1545
|
+
end
|
1173
1546
|
end
|
1174
1547
|
|
1175
1548
|
module OriginalAuthorsRevisedName1
|
@@ -1191,13 +1564,7 @@ module ScientificName
|
|
1191
1564
|
end
|
1192
1565
|
|
1193
1566
|
i0, s0 = index, []
|
1194
|
-
|
1195
|
-
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1196
|
-
@index += 1
|
1197
|
-
else
|
1198
|
-
terminal_parse_failure("(")
|
1199
|
-
r1 = nil
|
1200
|
-
end
|
1567
|
+
r1 = _nt_left_bracket
|
1201
1568
|
s0 << r1
|
1202
1569
|
if r1
|
1203
1570
|
r2 = _nt_space
|
@@ -1209,13 +1576,7 @@ module ScientificName
|
|
1209
1576
|
r4 = _nt_space
|
1210
1577
|
s0 << r4
|
1211
1578
|
if r4
|
1212
|
-
|
1213
|
-
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1214
|
-
@index += 1
|
1215
|
-
else
|
1216
|
-
terminal_parse_failure(")")
|
1217
|
-
r5 = nil
|
1218
|
-
end
|
1579
|
+
r5 = _nt_right_bracket
|
1219
1580
|
s0 << r5
|
1220
1581
|
end
|
1221
1582
|
end
|
@@ -1387,8 +1748,13 @@ module ScientificName
|
|
1387
1748
|
if r8
|
1388
1749
|
r0 = r8
|
1389
1750
|
else
|
1390
|
-
|
1391
|
-
|
1751
|
+
r9 = _nt_unknown_auth
|
1752
|
+
if r9
|
1753
|
+
r0 = r9
|
1754
|
+
else
|
1755
|
+
self.index = i0
|
1756
|
+
r0 = nil
|
1757
|
+
end
|
1392
1758
|
end
|
1393
1759
|
end
|
1394
1760
|
|
@@ -1397,6 +1763,80 @@ module ScientificName
|
|
1397
1763
|
return r0
|
1398
1764
|
end
|
1399
1765
|
|
1766
|
+
module UnknownAuth0
|
1767
|
+
def value
|
1768
|
+
text_value
|
1769
|
+
end
|
1770
|
+
def details
|
1771
|
+
{:authors => "unknown"}
|
1772
|
+
end
|
1773
|
+
end
|
1774
|
+
|
1775
|
+
def _nt_unknown_auth
|
1776
|
+
start_index = index
|
1777
|
+
if node_cache[:unknown_auth].has_key?(index)
|
1778
|
+
cached = node_cache[:unknown_auth][index]
|
1779
|
+
@index = cached.interval.end if cached
|
1780
|
+
return cached
|
1781
|
+
end
|
1782
|
+
|
1783
|
+
i0 = index
|
1784
|
+
if input.index("auct.", index) == index
|
1785
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
1786
|
+
@index += 5
|
1787
|
+
else
|
1788
|
+
terminal_parse_failure("auct.")
|
1789
|
+
r1 = nil
|
1790
|
+
end
|
1791
|
+
if r1
|
1792
|
+
r0 = r1
|
1793
|
+
r0.extend(UnknownAuth0)
|
1794
|
+
else
|
1795
|
+
if input.index("hort.", index) == index
|
1796
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
1797
|
+
@index += 5
|
1798
|
+
else
|
1799
|
+
terminal_parse_failure("hort.")
|
1800
|
+
r2 = nil
|
1801
|
+
end
|
1802
|
+
if r2
|
1803
|
+
r0 = r2
|
1804
|
+
r0.extend(UnknownAuth0)
|
1805
|
+
else
|
1806
|
+
if input.index("anon.", index) == index
|
1807
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
1808
|
+
@index += 5
|
1809
|
+
else
|
1810
|
+
terminal_parse_failure("anon.")
|
1811
|
+
r3 = nil
|
1812
|
+
end
|
1813
|
+
if r3
|
1814
|
+
r0 = r3
|
1815
|
+
r0.extend(UnknownAuth0)
|
1816
|
+
else
|
1817
|
+
if input.index("ht.", index) == index
|
1818
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1819
|
+
@index += 3
|
1820
|
+
else
|
1821
|
+
terminal_parse_failure("ht.")
|
1822
|
+
r4 = nil
|
1823
|
+
end
|
1824
|
+
if r4
|
1825
|
+
r0 = r4
|
1826
|
+
r0.extend(UnknownAuth0)
|
1827
|
+
else
|
1828
|
+
self.index = i0
|
1829
|
+
r0 = nil
|
1830
|
+
end
|
1831
|
+
end
|
1832
|
+
end
|
1833
|
+
end
|
1834
|
+
|
1835
|
+
node_cache[:unknown_auth][start_index] = r0
|
1836
|
+
|
1837
|
+
return r0
|
1838
|
+
end
|
1839
|
+
|
1400
1840
|
def _nt_ex_sep
|
1401
1841
|
start_index = index
|
1402
1842
|
if node_cache[:ex_sep].has_key?(index)
|
@@ -1693,9 +2133,18 @@ module ScientificName
|
|
1693
2133
|
end
|
1694
2134
|
|
1695
2135
|
module AuthorWord1
|
2136
|
+
def value
|
2137
|
+
text_value.strip
|
2138
|
+
end
|
2139
|
+
def details
|
2140
|
+
{:authors => {:names => [value]}}
|
2141
|
+
end
|
1696
2142
|
end
|
1697
2143
|
|
1698
2144
|
module AuthorWord2
|
2145
|
+
end
|
2146
|
+
|
2147
|
+
module AuthorWord3
|
1699
2148
|
def value
|
1700
2149
|
text_value.gsub(/\s+/, " ").strip
|
1701
2150
|
end
|
@@ -1715,6 +2164,7 @@ module ScientificName
|
|
1715
2164
|
i0 = index
|
1716
2165
|
if input.index("A S. Xu", index) == index
|
1717
2166
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
2167
|
+
r1.extend(AuthorWord0)
|
1718
2168
|
@index += 7
|
1719
2169
|
else
|
1720
2170
|
terminal_parse_failure("A S. Xu")
|
@@ -1733,7 +2183,7 @@ module ScientificName
|
|
1733
2183
|
end
|
1734
2184
|
if r3
|
1735
2185
|
r2 = r3
|
1736
|
-
r2.extend(
|
2186
|
+
r2.extend(AuthorWord1)
|
1737
2187
|
else
|
1738
2188
|
if input.index("f.", index) == index
|
1739
2189
|
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
@@ -1744,7 +2194,7 @@ module ScientificName
|
|
1744
2194
|
end
|
1745
2195
|
if r4
|
1746
2196
|
r2 = r4
|
1747
|
-
r2.extend(
|
2197
|
+
r2.extend(AuthorWord1)
|
1748
2198
|
else
|
1749
2199
|
if input.index("bis", index) == index
|
1750
2200
|
r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
@@ -1755,7 +2205,7 @@ module ScientificName
|
|
1755
2205
|
end
|
1756
2206
|
if r5
|
1757
2207
|
r2 = r5
|
1758
|
-
r2.extend(
|
2208
|
+
r2.extend(AuthorWord1)
|
1759
2209
|
else
|
1760
2210
|
if input.index("arg.", index) == index
|
1761
2211
|
r6 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
@@ -1766,7 +2216,7 @@ module ScientificName
|
|
1766
2216
|
end
|
1767
2217
|
if r6
|
1768
2218
|
r2 = r6
|
1769
|
-
r2.extend(
|
2219
|
+
r2.extend(AuthorWord1)
|
1770
2220
|
else
|
1771
2221
|
if input.index("da", index) == index
|
1772
2222
|
r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
@@ -1777,7 +2227,7 @@ module ScientificName
|
|
1777
2227
|
end
|
1778
2228
|
if r7
|
1779
2229
|
r2 = r7
|
1780
|
-
r2.extend(
|
2230
|
+
r2.extend(AuthorWord1)
|
1781
2231
|
else
|
1782
2232
|
if input.index("der", index) == index
|
1783
2233
|
r8 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
@@ -1788,7 +2238,7 @@ module ScientificName
|
|
1788
2238
|
end
|
1789
2239
|
if r8
|
1790
2240
|
r2 = r8
|
1791
|
-
r2.extend(
|
2241
|
+
r2.extend(AuthorWord1)
|
1792
2242
|
else
|
1793
2243
|
if input.index("den", index) == index
|
1794
2244
|
r9 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
@@ -1799,7 +2249,7 @@ module ScientificName
|
|
1799
2249
|
end
|
1800
2250
|
if r9
|
1801
2251
|
r2 = r9
|
1802
|
-
r2.extend(
|
2252
|
+
r2.extend(AuthorWord1)
|
1803
2253
|
else
|
1804
2254
|
if input.index("de", index) == index
|
1805
2255
|
r10 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
@@ -1810,7 +2260,7 @@ module ScientificName
|
|
1810
2260
|
end
|
1811
2261
|
if r10
|
1812
2262
|
r2 = r10
|
1813
|
-
r2.extend(
|
2263
|
+
r2.extend(AuthorWord1)
|
1814
2264
|
else
|
1815
2265
|
if input.index("du", index) == index
|
1816
2266
|
r11 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
@@ -1821,7 +2271,7 @@ module ScientificName
|
|
1821
2271
|
end
|
1822
2272
|
if r11
|
1823
2273
|
r2 = r11
|
1824
|
-
r2.extend(
|
2274
|
+
r2.extend(AuthorWord1)
|
1825
2275
|
else
|
1826
2276
|
if input.index("la", index) == index
|
1827
2277
|
r12 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
@@ -1832,7 +2282,7 @@ module ScientificName
|
|
1832
2282
|
end
|
1833
2283
|
if r12
|
1834
2284
|
r2 = r12
|
1835
|
-
r2.extend(
|
2285
|
+
r2.extend(AuthorWord1)
|
1836
2286
|
else
|
1837
2287
|
if input.index("ter", index) == index
|
1838
2288
|
r13 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
@@ -1843,7 +2293,7 @@ module ScientificName
|
|
1843
2293
|
end
|
1844
2294
|
if r13
|
1845
2295
|
r2 = r13
|
1846
|
-
r2.extend(
|
2296
|
+
r2.extend(AuthorWord1)
|
1847
2297
|
else
|
1848
2298
|
if input.index("van", index) == index
|
1849
2299
|
r14 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
@@ -1854,7 +2304,7 @@ module ScientificName
|
|
1854
2304
|
end
|
1855
2305
|
if r14
|
1856
2306
|
r2 = r14
|
1857
|
-
r2.extend(
|
2307
|
+
r2.extend(AuthorWord1)
|
1858
2308
|
else
|
1859
2309
|
if input.index("et al.\{\?\}", index) == index
|
1860
2310
|
r15 = instantiate_node(SyntaxNode,input, index...(index + 9))
|
@@ -1865,7 +2315,7 @@ module ScientificName
|
|
1865
2315
|
end
|
1866
2316
|
if r15
|
1867
2317
|
r2 = r15
|
1868
|
-
r2.extend(
|
2318
|
+
r2.extend(AuthorWord1)
|
1869
2319
|
else
|
1870
2320
|
if input.index("et al.", index) == index
|
1871
2321
|
r16 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
@@ -1876,7 +2326,7 @@ module ScientificName
|
|
1876
2326
|
end
|
1877
2327
|
if r16
|
1878
2328
|
r2 = r16
|
1879
|
-
r2.extend(
|
2329
|
+
r2.extend(AuthorWord1)
|
1880
2330
|
else
|
1881
2331
|
self.index = i2
|
1882
2332
|
r2 = nil
|
@@ -2069,8 +2519,8 @@ module ScientificName
|
|
2069
2519
|
end
|
2070
2520
|
if s17.last
|
2071
2521
|
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
2072
|
-
r17.extend(AuthorWord1)
|
2073
2522
|
r17.extend(AuthorWord2)
|
2523
|
+
r17.extend(AuthorWord3)
|
2074
2524
|
else
|
2075
2525
|
self.index = i17
|
2076
2526
|
r17 = nil
|
@@ -2658,371 +3108,372 @@ module ScientificName
|
|
2658
3108
|
end
|
2659
3109
|
|
2660
3110
|
i0 = index
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
3111
|
+
i1 = index
|
3112
|
+
if input.index("morph.", index) == index
|
3113
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
3114
|
+
@index += 6
|
2664
3115
|
else
|
2665
|
-
terminal_parse_failure("
|
2666
|
-
|
3116
|
+
terminal_parse_failure("morph.")
|
3117
|
+
r2 = nil
|
2667
3118
|
end
|
2668
|
-
if
|
2669
|
-
|
2670
|
-
|
3119
|
+
if r2
|
3120
|
+
r1 = r2
|
3121
|
+
r1.extend(Rank0)
|
2671
3122
|
else
|
2672
|
-
if input.index("f.", index) == index
|
2673
|
-
|
2674
|
-
@index +=
|
3123
|
+
if input.index("f.sp.", index) == index
|
3124
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
3125
|
+
@index += 5
|
2675
3126
|
else
|
2676
|
-
terminal_parse_failure("f.")
|
2677
|
-
|
3127
|
+
terminal_parse_failure("f.sp.")
|
3128
|
+
r3 = nil
|
2678
3129
|
end
|
2679
|
-
if
|
2680
|
-
|
2681
|
-
|
3130
|
+
if r3
|
3131
|
+
r1 = r3
|
3132
|
+
r1.extend(Rank0)
|
2682
3133
|
else
|
2683
3134
|
if input.index("B", index) == index
|
2684
|
-
|
3135
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2685
3136
|
@index += 1
|
2686
3137
|
else
|
2687
3138
|
terminal_parse_failure("B")
|
2688
|
-
|
3139
|
+
r4 = nil
|
2689
3140
|
end
|
2690
|
-
if
|
2691
|
-
|
2692
|
-
|
3141
|
+
if r4
|
3142
|
+
r1 = r4
|
3143
|
+
r1.extend(Rank0)
|
2693
3144
|
else
|
2694
3145
|
if input.index("ssp.", index) == index
|
2695
|
-
|
3146
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2696
3147
|
@index += 4
|
2697
3148
|
else
|
2698
3149
|
terminal_parse_failure("ssp.")
|
2699
|
-
|
3150
|
+
r5 = nil
|
2700
3151
|
end
|
2701
|
-
if
|
2702
|
-
|
2703
|
-
|
3152
|
+
if r5
|
3153
|
+
r1 = r5
|
3154
|
+
r1.extend(Rank0)
|
2704
3155
|
else
|
2705
3156
|
if input.index("mut.", index) == index
|
2706
|
-
|
3157
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2707
3158
|
@index += 4
|
2708
3159
|
else
|
2709
3160
|
terminal_parse_failure("mut.")
|
2710
|
-
|
3161
|
+
r6 = nil
|
2711
3162
|
end
|
2712
|
-
if
|
2713
|
-
|
2714
|
-
|
3163
|
+
if r6
|
3164
|
+
r1 = r6
|
3165
|
+
r1.extend(Rank0)
|
2715
3166
|
else
|
2716
3167
|
if input.index("pseudovar.", index) == index
|
2717
|
-
|
3168
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 10))
|
2718
3169
|
@index += 10
|
2719
3170
|
else
|
2720
3171
|
terminal_parse_failure("pseudovar.")
|
2721
|
-
|
3172
|
+
r7 = nil
|
2722
3173
|
end
|
2723
|
-
if
|
2724
|
-
|
2725
|
-
|
3174
|
+
if r7
|
3175
|
+
r1 = r7
|
3176
|
+
r1.extend(Rank0)
|
2726
3177
|
else
|
2727
3178
|
if input.index("sect.", index) == index
|
2728
|
-
|
3179
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
2729
3180
|
@index += 5
|
2730
3181
|
else
|
2731
3182
|
terminal_parse_failure("sect.")
|
2732
|
-
|
3183
|
+
r8 = nil
|
2733
3184
|
end
|
2734
|
-
if
|
2735
|
-
|
2736
|
-
|
3185
|
+
if r8
|
3186
|
+
r1 = r8
|
3187
|
+
r1.extend(Rank0)
|
2737
3188
|
else
|
2738
3189
|
if input.index("ser.", index) == index
|
2739
|
-
|
3190
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2740
3191
|
@index += 4
|
2741
3192
|
else
|
2742
3193
|
terminal_parse_failure("ser.")
|
2743
|
-
|
3194
|
+
r9 = nil
|
2744
3195
|
end
|
2745
|
-
if
|
2746
|
-
|
2747
|
-
|
3196
|
+
if r9
|
3197
|
+
r1 = r9
|
3198
|
+
r1.extend(Rank0)
|
2748
3199
|
else
|
2749
3200
|
if input.index("var.", index) == index
|
2750
|
-
|
3201
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2751
3202
|
@index += 4
|
2752
3203
|
else
|
2753
3204
|
terminal_parse_failure("var.")
|
2754
|
-
|
3205
|
+
r10 = nil
|
2755
3206
|
end
|
2756
|
-
if
|
2757
|
-
|
2758
|
-
|
3207
|
+
if r10
|
3208
|
+
r1 = r10
|
3209
|
+
r1.extend(Rank0)
|
2759
3210
|
else
|
2760
3211
|
if input.index("subvar.", index) == index
|
2761
|
-
|
3212
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
2762
3213
|
@index += 7
|
2763
3214
|
else
|
2764
3215
|
terminal_parse_failure("subvar.")
|
2765
|
-
|
3216
|
+
r11 = nil
|
2766
3217
|
end
|
2767
|
-
if
|
2768
|
-
|
2769
|
-
|
3218
|
+
if r11
|
3219
|
+
r1 = r11
|
3220
|
+
r1.extend(Rank0)
|
2770
3221
|
else
|
2771
3222
|
if input.index("[var.]", index) == index
|
2772
|
-
|
3223
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
2773
3224
|
@index += 6
|
2774
3225
|
else
|
2775
3226
|
terminal_parse_failure("[var.]")
|
2776
|
-
|
3227
|
+
r12 = nil
|
2777
3228
|
end
|
2778
|
-
if
|
2779
|
-
|
2780
|
-
|
3229
|
+
if r12
|
3230
|
+
r1 = r12
|
3231
|
+
r1.extend(Rank0)
|
2781
3232
|
else
|
2782
3233
|
if input.index("subsp.", index) == index
|
2783
|
-
|
3234
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
2784
3235
|
@index += 6
|
2785
3236
|
else
|
2786
3237
|
terminal_parse_failure("subsp.")
|
2787
|
-
|
3238
|
+
r13 = nil
|
2788
3239
|
end
|
2789
|
-
if
|
2790
|
-
|
2791
|
-
|
3240
|
+
if r13
|
3241
|
+
r1 = r13
|
3242
|
+
r1.extend(Rank0)
|
2792
3243
|
else
|
2793
3244
|
if input.index("subf.", index) == index
|
2794
|
-
|
3245
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
2795
3246
|
@index += 5
|
2796
3247
|
else
|
2797
3248
|
terminal_parse_failure("subf.")
|
2798
|
-
|
3249
|
+
r14 = nil
|
2799
3250
|
end
|
2800
|
-
if
|
2801
|
-
|
2802
|
-
|
3251
|
+
if r14
|
3252
|
+
r1 = r14
|
3253
|
+
r1.extend(Rank0)
|
2803
3254
|
else
|
2804
3255
|
if input.index("race", index) == index
|
2805
|
-
|
3256
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2806
3257
|
@index += 4
|
2807
3258
|
else
|
2808
3259
|
terminal_parse_failure("race")
|
2809
|
-
|
3260
|
+
r15 = nil
|
2810
3261
|
end
|
2811
|
-
if
|
2812
|
-
|
2813
|
-
|
3262
|
+
if r15
|
3263
|
+
r1 = r15
|
3264
|
+
r1.extend(Rank0)
|
2814
3265
|
else
|
2815
3266
|
if input.index("α", index) == index
|
2816
|
-
|
3267
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2817
3268
|
@index += 1
|
2818
3269
|
else
|
2819
3270
|
terminal_parse_failure("α")
|
2820
|
-
|
3271
|
+
r16 = nil
|
2821
3272
|
end
|
2822
|
-
if
|
2823
|
-
|
2824
|
-
|
3273
|
+
if r16
|
3274
|
+
r1 = r16
|
3275
|
+
r1.extend(Rank0)
|
2825
3276
|
else
|
2826
3277
|
if input.index("ββ", index) == index
|
2827
|
-
|
3278
|
+
r17 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2828
3279
|
@index += 2
|
2829
3280
|
else
|
2830
3281
|
terminal_parse_failure("ββ")
|
2831
|
-
|
3282
|
+
r17 = nil
|
2832
3283
|
end
|
2833
|
-
if
|
2834
|
-
|
2835
|
-
|
3284
|
+
if r17
|
3285
|
+
r1 = r17
|
3286
|
+
r1.extend(Rank0)
|
2836
3287
|
else
|
2837
3288
|
if input.index("β", index) == index
|
2838
|
-
|
3289
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2839
3290
|
@index += 1
|
2840
3291
|
else
|
2841
3292
|
terminal_parse_failure("β")
|
2842
|
-
|
3293
|
+
r18 = nil
|
2843
3294
|
end
|
2844
|
-
if
|
2845
|
-
|
2846
|
-
|
3295
|
+
if r18
|
3296
|
+
r1 = r18
|
3297
|
+
r1.extend(Rank0)
|
2847
3298
|
else
|
2848
3299
|
if input.index("γ", index) == index
|
2849
|
-
|
3300
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2850
3301
|
@index += 1
|
2851
3302
|
else
|
2852
3303
|
terminal_parse_failure("γ")
|
2853
|
-
|
3304
|
+
r19 = nil
|
2854
3305
|
end
|
2855
|
-
if
|
2856
|
-
|
2857
|
-
|
3306
|
+
if r19
|
3307
|
+
r1 = r19
|
3308
|
+
r1.extend(Rank0)
|
2858
3309
|
else
|
2859
3310
|
if input.index("δ", index) == index
|
2860
|
-
|
3311
|
+
r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2861
3312
|
@index += 1
|
2862
3313
|
else
|
2863
3314
|
terminal_parse_failure("δ")
|
2864
|
-
|
3315
|
+
r20 = nil
|
2865
3316
|
end
|
2866
|
-
if
|
2867
|
-
|
2868
|
-
|
3317
|
+
if r20
|
3318
|
+
r1 = r20
|
3319
|
+
r1.extend(Rank0)
|
2869
3320
|
else
|
2870
3321
|
if input.index("ε", index) == index
|
2871
|
-
|
3322
|
+
r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2872
3323
|
@index += 1
|
2873
3324
|
else
|
2874
3325
|
terminal_parse_failure("ε")
|
2875
|
-
|
3326
|
+
r21 = nil
|
2876
3327
|
end
|
2877
|
-
if
|
2878
|
-
|
2879
|
-
|
3328
|
+
if r21
|
3329
|
+
r1 = r21
|
3330
|
+
r1.extend(Rank0)
|
2880
3331
|
else
|
2881
3332
|
if input.index("φ", index) == index
|
2882
|
-
|
3333
|
+
r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2883
3334
|
@index += 1
|
2884
3335
|
else
|
2885
3336
|
terminal_parse_failure("φ")
|
2886
|
-
|
3337
|
+
r22 = nil
|
2887
3338
|
end
|
2888
|
-
if
|
2889
|
-
|
2890
|
-
|
3339
|
+
if r22
|
3340
|
+
r1 = r22
|
3341
|
+
r1.extend(Rank0)
|
2891
3342
|
else
|
2892
3343
|
if input.index("θ", index) == index
|
2893
|
-
|
3344
|
+
r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2894
3345
|
@index += 1
|
2895
3346
|
else
|
2896
3347
|
terminal_parse_failure("θ")
|
2897
|
-
|
3348
|
+
r23 = nil
|
2898
3349
|
end
|
2899
|
-
if
|
2900
|
-
|
2901
|
-
|
3350
|
+
if r23
|
3351
|
+
r1 = r23
|
3352
|
+
r1.extend(Rank0)
|
2902
3353
|
else
|
2903
3354
|
if input.index("μ", index) == index
|
2904
|
-
|
3355
|
+
r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2905
3356
|
@index += 1
|
2906
3357
|
else
|
2907
3358
|
terminal_parse_failure("μ")
|
2908
|
-
|
3359
|
+
r24 = nil
|
2909
3360
|
end
|
2910
|
-
if
|
2911
|
-
|
2912
|
-
|
3361
|
+
if r24
|
3362
|
+
r1 = r24
|
3363
|
+
r1.extend(Rank0)
|
2913
3364
|
else
|
2914
3365
|
if input.index("a.", index) == index
|
2915
|
-
|
3366
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2916
3367
|
@index += 2
|
2917
3368
|
else
|
2918
3369
|
terminal_parse_failure("a.")
|
2919
|
-
|
3370
|
+
r25 = nil
|
2920
3371
|
end
|
2921
|
-
if
|
2922
|
-
|
2923
|
-
|
3372
|
+
if r25
|
3373
|
+
r1 = r25
|
3374
|
+
r1.extend(Rank0)
|
2924
3375
|
else
|
2925
3376
|
if input.index("b.", index) == index
|
2926
|
-
|
3377
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2927
3378
|
@index += 2
|
2928
3379
|
else
|
2929
3380
|
terminal_parse_failure("b.")
|
2930
|
-
|
3381
|
+
r26 = nil
|
2931
3382
|
end
|
2932
|
-
if
|
2933
|
-
|
2934
|
-
|
3383
|
+
if r26
|
3384
|
+
r1 = r26
|
3385
|
+
r1.extend(Rank0)
|
2935
3386
|
else
|
2936
3387
|
if input.index("c.", index) == index
|
2937
|
-
|
3388
|
+
r27 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2938
3389
|
@index += 2
|
2939
3390
|
else
|
2940
3391
|
terminal_parse_failure("c.")
|
2941
|
-
|
3392
|
+
r27 = nil
|
2942
3393
|
end
|
2943
|
-
if
|
2944
|
-
|
2945
|
-
|
3394
|
+
if r27
|
3395
|
+
r1 = r27
|
3396
|
+
r1.extend(Rank0)
|
2946
3397
|
else
|
2947
3398
|
if input.index("d.", index) == index
|
2948
|
-
|
3399
|
+
r28 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2949
3400
|
@index += 2
|
2950
3401
|
else
|
2951
3402
|
terminal_parse_failure("d.")
|
2952
|
-
|
3403
|
+
r28 = nil
|
2953
3404
|
end
|
2954
|
-
if
|
2955
|
-
|
2956
|
-
|
3405
|
+
if r28
|
3406
|
+
r1 = r28
|
3407
|
+
r1.extend(Rank0)
|
2957
3408
|
else
|
2958
3409
|
if input.index("e.", index) == index
|
2959
|
-
|
3410
|
+
r29 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2960
3411
|
@index += 2
|
2961
3412
|
else
|
2962
3413
|
terminal_parse_failure("e.")
|
2963
|
-
|
3414
|
+
r29 = nil
|
2964
3415
|
end
|
2965
|
-
if
|
2966
|
-
|
2967
|
-
|
3416
|
+
if r29
|
3417
|
+
r1 = r29
|
3418
|
+
r1.extend(Rank0)
|
2968
3419
|
else
|
2969
3420
|
if input.index("g.", index) == index
|
2970
|
-
|
3421
|
+
r30 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2971
3422
|
@index += 2
|
2972
3423
|
else
|
2973
3424
|
terminal_parse_failure("g.")
|
2974
|
-
|
3425
|
+
r30 = nil
|
2975
3426
|
end
|
2976
|
-
if
|
2977
|
-
|
2978
|
-
|
3427
|
+
if r30
|
3428
|
+
r1 = r30
|
3429
|
+
r1.extend(Rank0)
|
2979
3430
|
else
|
2980
3431
|
if input.index("k.", index) == index
|
2981
|
-
|
3432
|
+
r31 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
2982
3433
|
@index += 2
|
2983
3434
|
else
|
2984
3435
|
terminal_parse_failure("k.")
|
2985
|
-
|
3436
|
+
r31 = nil
|
2986
3437
|
end
|
2987
|
-
if
|
2988
|
-
|
2989
|
-
|
3438
|
+
if r31
|
3439
|
+
r1 = r31
|
3440
|
+
r1.extend(Rank0)
|
2990
3441
|
else
|
2991
3442
|
if input.index("****", index) == index
|
2992
|
-
|
3443
|
+
r32 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
2993
3444
|
@index += 4
|
2994
3445
|
else
|
2995
3446
|
terminal_parse_failure("****")
|
2996
|
-
|
3447
|
+
r32 = nil
|
2997
3448
|
end
|
2998
|
-
if
|
2999
|
-
|
3000
|
-
|
3449
|
+
if r32
|
3450
|
+
r1 = r32
|
3451
|
+
r1.extend(Rank0)
|
3001
3452
|
else
|
3002
3453
|
if input.index("**", index) == index
|
3003
|
-
|
3454
|
+
r33 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
3004
3455
|
@index += 2
|
3005
3456
|
else
|
3006
3457
|
terminal_parse_failure("**")
|
3007
|
-
|
3458
|
+
r33 = nil
|
3008
3459
|
end
|
3009
|
-
if
|
3010
|
-
|
3011
|
-
|
3460
|
+
if r33
|
3461
|
+
r1 = r33
|
3462
|
+
r1.extend(Rank0)
|
3012
3463
|
else
|
3013
3464
|
if input.index("*", index) == index
|
3014
|
-
|
3465
|
+
r34 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3015
3466
|
@index += 1
|
3016
3467
|
else
|
3017
3468
|
terminal_parse_failure("*")
|
3018
|
-
|
3469
|
+
r34 = nil
|
3019
3470
|
end
|
3020
|
-
if
|
3021
|
-
|
3022
|
-
|
3471
|
+
if r34
|
3472
|
+
r1 = r34
|
3473
|
+
r1.extend(Rank0)
|
3023
3474
|
else
|
3024
|
-
self.index =
|
3025
|
-
|
3475
|
+
self.index = i1
|
3476
|
+
r1 = nil
|
3026
3477
|
end
|
3027
3478
|
end
|
3028
3479
|
end
|
@@ -3056,61 +3507,152 @@ module ScientificName
|
|
3056
3507
|
end
|
3057
3508
|
end
|
3058
3509
|
end
|
3510
|
+
if r1
|
3511
|
+
r0 = r1
|
3512
|
+
else
|
3513
|
+
r35 = _nt_rank_forma
|
3514
|
+
if r35
|
3515
|
+
r0 = r35
|
3516
|
+
else
|
3517
|
+
self.index = i0
|
3518
|
+
r0 = nil
|
3519
|
+
end
|
3520
|
+
end
|
3059
3521
|
|
3060
3522
|
node_cache[:rank][start_index] = r0
|
3061
3523
|
|
3062
3524
|
return r0
|
3063
3525
|
end
|
3064
3526
|
|
3065
|
-
module
|
3066
|
-
def hybrid_separator
|
3067
|
-
elements[0]
|
3068
|
-
end
|
3069
|
-
|
3070
|
-
def space_hard
|
3071
|
-
elements[1]
|
3072
|
-
end
|
3073
|
-
|
3074
|
-
def a
|
3075
|
-
elements[2]
|
3076
|
-
end
|
3077
|
-
|
3078
|
-
def space_hard
|
3079
|
-
elements[3]
|
3080
|
-
end
|
3081
|
-
|
3082
|
-
def b
|
3083
|
-
elements[4]
|
3084
|
-
end
|
3085
|
-
end
|
3086
|
-
|
3087
|
-
module SpeciesName1
|
3527
|
+
module RankForma0
|
3088
3528
|
def value
|
3089
|
-
"
|
3529
|
+
"f."
|
3090
3530
|
end
|
3091
|
-
def
|
3092
|
-
|
3531
|
+
def apply(a)
|
3532
|
+
" " + value + " " + a.value
|
3093
3533
|
end
|
3094
|
-
def
|
3095
|
-
|
3534
|
+
def canonical(a)
|
3535
|
+
" " + a.value
|
3096
3536
|
end
|
3097
|
-
|
3098
|
-
|
3099
|
-
module SpeciesName2
|
3100
|
-
def hybrid_separator
|
3101
|
-
elements[0]
|
3537
|
+
def details(a = nil)
|
3538
|
+
{:subspecies => [{:rank => value, :value => (a.value rescue nil)}]}
|
3102
3539
|
end
|
3540
|
+
end
|
3103
3541
|
|
3104
|
-
|
3105
|
-
|
3542
|
+
def _nt_rank_forma
|
3543
|
+
start_index = index
|
3544
|
+
if node_cache[:rank_forma].has_key?(index)
|
3545
|
+
cached = node_cache[:rank_forma][index]
|
3546
|
+
@index = cached.interval.end if cached
|
3547
|
+
return cached
|
3106
3548
|
end
|
3107
3549
|
|
3108
|
-
|
3109
|
-
|
3550
|
+
i0 = index
|
3551
|
+
if input.index("forma", index) == index
|
3552
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
3553
|
+
@index += 5
|
3554
|
+
else
|
3555
|
+
terminal_parse_failure("forma")
|
3556
|
+
r1 = nil
|
3110
3557
|
end
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3558
|
+
if r1
|
3559
|
+
r0 = r1
|
3560
|
+
r0.extend(RankForma0)
|
3561
|
+
else
|
3562
|
+
if input.index("form.", index) == index
|
3563
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
3564
|
+
@index += 5
|
3565
|
+
else
|
3566
|
+
terminal_parse_failure("form.")
|
3567
|
+
r2 = nil
|
3568
|
+
end
|
3569
|
+
if r2
|
3570
|
+
r0 = r2
|
3571
|
+
r0.extend(RankForma0)
|
3572
|
+
else
|
3573
|
+
if input.index("fo.", index) == index
|
3574
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
3575
|
+
@index += 3
|
3576
|
+
else
|
3577
|
+
terminal_parse_failure("fo.")
|
3578
|
+
r3 = nil
|
3579
|
+
end
|
3580
|
+
if r3
|
3581
|
+
r0 = r3
|
3582
|
+
r0.extend(RankForma0)
|
3583
|
+
else
|
3584
|
+
if input.index("f.", index) == index
|
3585
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
3586
|
+
@index += 2
|
3587
|
+
else
|
3588
|
+
terminal_parse_failure("f.")
|
3589
|
+
r4 = nil
|
3590
|
+
end
|
3591
|
+
if r4
|
3592
|
+
r0 = r4
|
3593
|
+
r0.extend(RankForma0)
|
3594
|
+
else
|
3595
|
+
self.index = i0
|
3596
|
+
r0 = nil
|
3597
|
+
end
|
3598
|
+
end
|
3599
|
+
end
|
3600
|
+
end
|
3601
|
+
|
3602
|
+
node_cache[:rank_forma][start_index] = r0
|
3603
|
+
|
3604
|
+
return r0
|
3605
|
+
end
|
3606
|
+
|
3607
|
+
module SpeciesName0
|
3608
|
+
def hybrid_separator
|
3609
|
+
elements[0]
|
3610
|
+
end
|
3611
|
+
|
3612
|
+
def space_hard
|
3613
|
+
elements[1]
|
3614
|
+
end
|
3615
|
+
|
3616
|
+
def a
|
3617
|
+
elements[2]
|
3618
|
+
end
|
3619
|
+
|
3620
|
+
def space_hard
|
3621
|
+
elements[3]
|
3622
|
+
end
|
3623
|
+
|
3624
|
+
def b
|
3625
|
+
elements[4]
|
3626
|
+
end
|
3627
|
+
end
|
3628
|
+
|
3629
|
+
module SpeciesName1
|
3630
|
+
def value
|
3631
|
+
"× " + a.value + " " + b.value
|
3632
|
+
end
|
3633
|
+
def canonical
|
3634
|
+
a.value + " " + b.value
|
3635
|
+
end
|
3636
|
+
def details
|
3637
|
+
{:genus => a.value, :species => b.value, :cross => 'before'}
|
3638
|
+
end
|
3639
|
+
end
|
3640
|
+
|
3641
|
+
module SpeciesName2
|
3642
|
+
def hybrid_separator
|
3643
|
+
elements[0]
|
3644
|
+
end
|
3645
|
+
|
3646
|
+
def space_hard
|
3647
|
+
elements[1]
|
3648
|
+
end
|
3649
|
+
|
3650
|
+
def a
|
3651
|
+
elements[2]
|
3652
|
+
end
|
3653
|
+
end
|
3654
|
+
|
3655
|
+
module SpeciesName3
|
3114
3656
|
def value
|
3115
3657
|
"× " + a.value
|
3116
3658
|
end
|
@@ -3450,6 +3992,120 @@ module ScientificName
|
|
3450
3992
|
return r0
|
3451
3993
|
end
|
3452
3994
|
|
3995
|
+
module TaxonConceptRank0
|
3996
|
+
def value
|
3997
|
+
"sec."
|
3998
|
+
end
|
3999
|
+
def apply(a)
|
4000
|
+
" " + value + " " + a.value
|
4001
|
+
end
|
4002
|
+
def details(a = nil)
|
4003
|
+
{:taxon_concept => a.details}
|
4004
|
+
end
|
4005
|
+
end
|
4006
|
+
|
4007
|
+
def _nt_taxon_concept_rank
|
4008
|
+
start_index = index
|
4009
|
+
if node_cache[:taxon_concept_rank].has_key?(index)
|
4010
|
+
cached = node_cache[:taxon_concept_rank][index]
|
4011
|
+
@index = cached.interval.end if cached
|
4012
|
+
return cached
|
4013
|
+
end
|
4014
|
+
|
4015
|
+
if input.index("sec.", index) == index
|
4016
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
4017
|
+
r0.extend(TaxonConceptRank0)
|
4018
|
+
@index += 4
|
4019
|
+
else
|
4020
|
+
terminal_parse_failure("sec.")
|
4021
|
+
r0 = nil
|
4022
|
+
end
|
4023
|
+
|
4024
|
+
node_cache[:taxon_concept_rank][start_index] = r0
|
4025
|
+
|
4026
|
+
return r0
|
4027
|
+
end
|
4028
|
+
|
4029
|
+
module GenusRank0
|
4030
|
+
def value
|
4031
|
+
text_value.strip
|
4032
|
+
end
|
4033
|
+
def apply(a)
|
4034
|
+
" " + text_value + " " + a.value
|
4035
|
+
end
|
4036
|
+
def canonical(a)
|
4037
|
+
" " + a.value
|
4038
|
+
end
|
4039
|
+
def details(a = nil)
|
4040
|
+
{:subgenus => [{:rank => text_value, :value => (a.value rescue nil)}]}
|
4041
|
+
end
|
4042
|
+
end
|
4043
|
+
|
4044
|
+
def _nt_genus_rank
|
4045
|
+
start_index = index
|
4046
|
+
if node_cache[:genus_rank].has_key?(index)
|
4047
|
+
cached = node_cache[:genus_rank][index]
|
4048
|
+
@index = cached.interval.end if cached
|
4049
|
+
return cached
|
4050
|
+
end
|
4051
|
+
|
4052
|
+
i0 = index
|
4053
|
+
if input.index("subsect.", index) == index
|
4054
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
4055
|
+
@index += 8
|
4056
|
+
else
|
4057
|
+
terminal_parse_failure("subsect.")
|
4058
|
+
r1 = nil
|
4059
|
+
end
|
4060
|
+
if r1
|
4061
|
+
r0 = r1
|
4062
|
+
r0.extend(GenusRank0)
|
4063
|
+
else
|
4064
|
+
if input.index("subtrib.", index) == index
|
4065
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
4066
|
+
@index += 8
|
4067
|
+
else
|
4068
|
+
terminal_parse_failure("subtrib.")
|
4069
|
+
r2 = nil
|
4070
|
+
end
|
4071
|
+
if r2
|
4072
|
+
r0 = r2
|
4073
|
+
r0.extend(GenusRank0)
|
4074
|
+
else
|
4075
|
+
if input.index("subgen.", index) == index
|
4076
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
|
4077
|
+
@index += 7
|
4078
|
+
else
|
4079
|
+
terminal_parse_failure("subgen.")
|
4080
|
+
r3 = nil
|
4081
|
+
end
|
4082
|
+
if r3
|
4083
|
+
r0 = r3
|
4084
|
+
r0.extend(GenusRank0)
|
4085
|
+
else
|
4086
|
+
if input.index("trib.", index) == index
|
4087
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
4088
|
+
@index += 5
|
4089
|
+
else
|
4090
|
+
terminal_parse_failure("trib.")
|
4091
|
+
r4 = nil
|
4092
|
+
end
|
4093
|
+
if r4
|
4094
|
+
r0 = r4
|
4095
|
+
r0.extend(GenusRank0)
|
4096
|
+
else
|
4097
|
+
self.index = i0
|
4098
|
+
r0 = nil
|
4099
|
+
end
|
4100
|
+
end
|
4101
|
+
end
|
4102
|
+
end
|
4103
|
+
|
4104
|
+
node_cache[:genus_rank][start_index] = r0
|
4105
|
+
|
4106
|
+
return r0
|
4107
|
+
end
|
4108
|
+
|
3453
4109
|
module CapLatinWord0
|
3454
4110
|
def a
|
3455
4111
|
elements[0]
|
@@ -3458,6 +4114,7 @@ module ScientificName
|
|
3458
4114
|
def b
|
3459
4115
|
elements[1]
|
3460
4116
|
end
|
4117
|
+
|
3461
4118
|
end
|
3462
4119
|
|
3463
4120
|
module CapLatinWord1
|
@@ -3474,6 +4131,44 @@ module ScientificName
|
|
3474
4131
|
end
|
3475
4132
|
end
|
3476
4133
|
|
4134
|
+
module CapLatinWord2
|
4135
|
+
def a
|
4136
|
+
elements[0]
|
4137
|
+
end
|
4138
|
+
|
4139
|
+
def b
|
4140
|
+
elements[1]
|
4141
|
+
end
|
4142
|
+
end
|
4143
|
+
|
4144
|
+
module CapLatinWord3
|
4145
|
+
def value
|
4146
|
+
a.text_value + b.value
|
4147
|
+
end
|
4148
|
+
|
4149
|
+
def canonical
|
4150
|
+
value
|
4151
|
+
end
|
4152
|
+
|
4153
|
+
def details
|
4154
|
+
{:uninomial => value}
|
4155
|
+
end
|
4156
|
+
end
|
4157
|
+
|
4158
|
+
module CapLatinWord4
|
4159
|
+
def value
|
4160
|
+
text_value
|
4161
|
+
end
|
4162
|
+
|
4163
|
+
def canonical
|
4164
|
+
value
|
4165
|
+
end
|
4166
|
+
|
4167
|
+
def details
|
4168
|
+
{:uninomial => value}
|
4169
|
+
end
|
4170
|
+
end
|
4171
|
+
|
3477
4172
|
def _nt_cap_latin_word
|
3478
4173
|
start_index = index
|
3479
4174
|
if node_cache[:cap_latin_word].has_key?(index)
|
@@ -3482,25 +4177,301 @@ module ScientificName
|
|
3482
4177
|
return cached
|
3483
4178
|
end
|
3484
4179
|
|
3485
|
-
i0
|
3486
|
-
|
3487
|
-
|
4180
|
+
i0 = index
|
4181
|
+
i1, s1 = index, []
|
4182
|
+
if input.index(Regexp.new('[A-Zή]'), index) == index
|
4183
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3488
4184
|
@index += 1
|
3489
4185
|
else
|
4186
|
+
r2 = nil
|
4187
|
+
end
|
4188
|
+
s1 << r2
|
4189
|
+
if r2
|
4190
|
+
r3 = _nt_latin_word
|
4191
|
+
s1 << r3
|
4192
|
+
if r3
|
4193
|
+
if input.index("?", index) == index
|
4194
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4195
|
+
@index += 1
|
4196
|
+
else
|
4197
|
+
terminal_parse_failure("?")
|
4198
|
+
r4 = nil
|
4199
|
+
end
|
4200
|
+
s1 << r4
|
4201
|
+
end
|
4202
|
+
end
|
4203
|
+
if s1.last
|
4204
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
4205
|
+
r1.extend(CapLatinWord0)
|
4206
|
+
r1.extend(CapLatinWord1)
|
4207
|
+
else
|
4208
|
+
self.index = i1
|
3490
4209
|
r1 = nil
|
3491
4210
|
end
|
3492
|
-
s0 << r1
|
3493
4211
|
if r1
|
3494
|
-
|
3495
|
-
s0 << r2
|
3496
|
-
end
|
3497
|
-
if s0.last
|
3498
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
3499
|
-
r0.extend(CapLatinWord0)
|
3500
|
-
r0.extend(CapLatinWord1)
|
4212
|
+
r0 = r1
|
3501
4213
|
else
|
3502
|
-
|
3503
|
-
|
4214
|
+
i5, s5 = index, []
|
4215
|
+
if input.index(Regexp.new('[A-Zή]'), index) == index
|
4216
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4217
|
+
@index += 1
|
4218
|
+
else
|
4219
|
+
r6 = nil
|
4220
|
+
end
|
4221
|
+
s5 << r6
|
4222
|
+
if r6
|
4223
|
+
r7 = _nt_latin_word
|
4224
|
+
s5 << r7
|
4225
|
+
end
|
4226
|
+
if s5.last
|
4227
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
4228
|
+
r5.extend(CapLatinWord2)
|
4229
|
+
r5.extend(CapLatinWord3)
|
4230
|
+
else
|
4231
|
+
self.index = i5
|
4232
|
+
r5 = nil
|
4233
|
+
end
|
4234
|
+
if r5
|
4235
|
+
r0 = r5
|
4236
|
+
else
|
4237
|
+
i8 = index
|
4238
|
+
if input.index("Ca", index) == index
|
4239
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4240
|
+
@index += 2
|
4241
|
+
else
|
4242
|
+
terminal_parse_failure("Ca")
|
4243
|
+
r9 = nil
|
4244
|
+
end
|
4245
|
+
if r9
|
4246
|
+
r8 = r9
|
4247
|
+
r8.extend(CapLatinWord4)
|
4248
|
+
else
|
4249
|
+
if input.index("Ea", index) == index
|
4250
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4251
|
+
@index += 2
|
4252
|
+
else
|
4253
|
+
terminal_parse_failure("Ea")
|
4254
|
+
r10 = nil
|
4255
|
+
end
|
4256
|
+
if r10
|
4257
|
+
r8 = r10
|
4258
|
+
r8.extend(CapLatinWord4)
|
4259
|
+
else
|
4260
|
+
if input.index("Ge", index) == index
|
4261
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4262
|
+
@index += 2
|
4263
|
+
else
|
4264
|
+
terminal_parse_failure("Ge")
|
4265
|
+
r11 = nil
|
4266
|
+
end
|
4267
|
+
if r11
|
4268
|
+
r8 = r11
|
4269
|
+
r8.extend(CapLatinWord4)
|
4270
|
+
else
|
4271
|
+
if input.index("Ia", index) == index
|
4272
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4273
|
+
@index += 2
|
4274
|
+
else
|
4275
|
+
terminal_parse_failure("Ia")
|
4276
|
+
r12 = nil
|
4277
|
+
end
|
4278
|
+
if r12
|
4279
|
+
r8 = r12
|
4280
|
+
r8.extend(CapLatinWord4)
|
4281
|
+
else
|
4282
|
+
if input.index("Io", index) == index
|
4283
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4284
|
+
@index += 2
|
4285
|
+
else
|
4286
|
+
terminal_parse_failure("Io")
|
4287
|
+
r13 = nil
|
4288
|
+
end
|
4289
|
+
if r13
|
4290
|
+
r8 = r13
|
4291
|
+
r8.extend(CapLatinWord4)
|
4292
|
+
else
|
4293
|
+
if input.index("Io", index) == index
|
4294
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4295
|
+
@index += 2
|
4296
|
+
else
|
4297
|
+
terminal_parse_failure("Io")
|
4298
|
+
r14 = nil
|
4299
|
+
end
|
4300
|
+
if r14
|
4301
|
+
r8 = r14
|
4302
|
+
r8.extend(CapLatinWord4)
|
4303
|
+
else
|
4304
|
+
if input.index("Ix", index) == index
|
4305
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4306
|
+
@index += 2
|
4307
|
+
else
|
4308
|
+
terminal_parse_failure("Ix")
|
4309
|
+
r15 = nil
|
4310
|
+
end
|
4311
|
+
if r15
|
4312
|
+
r8 = r15
|
4313
|
+
r8.extend(CapLatinWord4)
|
4314
|
+
else
|
4315
|
+
if input.index("Lo", index) == index
|
4316
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4317
|
+
@index += 2
|
4318
|
+
else
|
4319
|
+
terminal_parse_failure("Lo")
|
4320
|
+
r16 = nil
|
4321
|
+
end
|
4322
|
+
if r16
|
4323
|
+
r8 = r16
|
4324
|
+
r8.extend(CapLatinWord4)
|
4325
|
+
else
|
4326
|
+
if input.index("Oa", index) == index
|
4327
|
+
r17 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4328
|
+
@index += 2
|
4329
|
+
else
|
4330
|
+
terminal_parse_failure("Oa")
|
4331
|
+
r17 = nil
|
4332
|
+
end
|
4333
|
+
if r17
|
4334
|
+
r8 = r17
|
4335
|
+
r8.extend(CapLatinWord4)
|
4336
|
+
else
|
4337
|
+
if input.index("Ra", index) == index
|
4338
|
+
r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4339
|
+
@index += 2
|
4340
|
+
else
|
4341
|
+
terminal_parse_failure("Ra")
|
4342
|
+
r18 = nil
|
4343
|
+
end
|
4344
|
+
if r18
|
4345
|
+
r8 = r18
|
4346
|
+
r8.extend(CapLatinWord4)
|
4347
|
+
else
|
4348
|
+
if input.index("Ty", index) == index
|
4349
|
+
r19 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4350
|
+
@index += 2
|
4351
|
+
else
|
4352
|
+
terminal_parse_failure("Ty")
|
4353
|
+
r19 = nil
|
4354
|
+
end
|
4355
|
+
if r19
|
4356
|
+
r8 = r19
|
4357
|
+
r8.extend(CapLatinWord4)
|
4358
|
+
else
|
4359
|
+
if input.index("Ua", index) == index
|
4360
|
+
r20 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4361
|
+
@index += 2
|
4362
|
+
else
|
4363
|
+
terminal_parse_failure("Ua")
|
4364
|
+
r20 = nil
|
4365
|
+
end
|
4366
|
+
if r20
|
4367
|
+
r8 = r20
|
4368
|
+
r8.extend(CapLatinWord4)
|
4369
|
+
else
|
4370
|
+
if input.index("Aa", index) == index
|
4371
|
+
r21 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4372
|
+
@index += 2
|
4373
|
+
else
|
4374
|
+
terminal_parse_failure("Aa")
|
4375
|
+
r21 = nil
|
4376
|
+
end
|
4377
|
+
if r21
|
4378
|
+
r8 = r21
|
4379
|
+
r8.extend(CapLatinWord4)
|
4380
|
+
else
|
4381
|
+
if input.index("Ja", index) == index
|
4382
|
+
r22 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4383
|
+
@index += 2
|
4384
|
+
else
|
4385
|
+
terminal_parse_failure("Ja")
|
4386
|
+
r22 = nil
|
4387
|
+
end
|
4388
|
+
if r22
|
4389
|
+
r8 = r22
|
4390
|
+
r8.extend(CapLatinWord4)
|
4391
|
+
else
|
4392
|
+
if input.index("Zu", index) == index
|
4393
|
+
r23 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4394
|
+
@index += 2
|
4395
|
+
else
|
4396
|
+
terminal_parse_failure("Zu")
|
4397
|
+
r23 = nil
|
4398
|
+
end
|
4399
|
+
if r23
|
4400
|
+
r8 = r23
|
4401
|
+
r8.extend(CapLatinWord4)
|
4402
|
+
else
|
4403
|
+
if input.index("La", index) == index
|
4404
|
+
r24 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4405
|
+
@index += 2
|
4406
|
+
else
|
4407
|
+
terminal_parse_failure("La")
|
4408
|
+
r24 = nil
|
4409
|
+
end
|
4410
|
+
if r24
|
4411
|
+
r8 = r24
|
4412
|
+
r8.extend(CapLatinWord4)
|
4413
|
+
else
|
4414
|
+
if input.index("Qu", index) == index
|
4415
|
+
r25 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4416
|
+
@index += 2
|
4417
|
+
else
|
4418
|
+
terminal_parse_failure("Qu")
|
4419
|
+
r25 = nil
|
4420
|
+
end
|
4421
|
+
if r25
|
4422
|
+
r8 = r25
|
4423
|
+
r8.extend(CapLatinWord4)
|
4424
|
+
else
|
4425
|
+
if input.index("As", index) == index
|
4426
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4427
|
+
@index += 2
|
4428
|
+
else
|
4429
|
+
terminal_parse_failure("As")
|
4430
|
+
r26 = nil
|
4431
|
+
end
|
4432
|
+
if r26
|
4433
|
+
r8 = r26
|
4434
|
+
r8.extend(CapLatinWord4)
|
4435
|
+
else
|
4436
|
+
if input.index("Ba", index) == index
|
4437
|
+
r27 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
4438
|
+
@index += 2
|
4439
|
+
else
|
4440
|
+
terminal_parse_failure("Ba")
|
4441
|
+
r27 = nil
|
4442
|
+
end
|
4443
|
+
if r27
|
4444
|
+
r8 = r27
|
4445
|
+
r8.extend(CapLatinWord4)
|
4446
|
+
else
|
4447
|
+
self.index = i8
|
4448
|
+
r8 = nil
|
4449
|
+
end
|
4450
|
+
end
|
4451
|
+
end
|
4452
|
+
end
|
4453
|
+
end
|
4454
|
+
end
|
4455
|
+
end
|
4456
|
+
end
|
4457
|
+
end
|
4458
|
+
end
|
4459
|
+
end
|
4460
|
+
end
|
4461
|
+
end
|
4462
|
+
end
|
4463
|
+
end
|
4464
|
+
end
|
4465
|
+
end
|
4466
|
+
end
|
4467
|
+
end
|
4468
|
+
if r8
|
4469
|
+
r0 = r8
|
4470
|
+
else
|
4471
|
+
self.index = i0
|
4472
|
+
r0 = nil
|
4473
|
+
end
|
4474
|
+
end
|
3504
4475
|
end
|
3505
4476
|
|
3506
4477
|
node_cache[:cap_latin_word][start_index] = r0
|
@@ -3556,7 +4527,7 @@ module ScientificName
|
|
3556
4527
|
|
3557
4528
|
i0 = index
|
3558
4529
|
i1, s1 = index, []
|
3559
|
-
if input.index(Regexp.new('[a-
|
4530
|
+
if input.index(Regexp.new('[a-zëüäöïé]'), index) == index
|
3560
4531
|
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3561
4532
|
@index += 1
|
3562
4533
|
else
|
@@ -3731,7 +4702,7 @@ module ScientificName
|
|
3731
4702
|
|
3732
4703
|
s0, i0 = [], index
|
3733
4704
|
loop do
|
3734
|
-
if input.index(Regexp.new('[a-z
|
4705
|
+
if input.index(Regexp.new('[a-z\\-ëüäöïé]'), index) == index
|
3735
4706
|
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
3736
4707
|
@index += 1
|
3737
4708
|
else
|
@@ -3994,6 +4965,98 @@ module ScientificName
|
|
3994
4965
|
return r0
|
3995
4966
|
end
|
3996
4967
|
|
4968
|
+
module LeftBracket0
|
4969
|
+
def value
|
4970
|
+
"("
|
4971
|
+
end
|
4972
|
+
end
|
4973
|
+
|
4974
|
+
def _nt_left_bracket
|
4975
|
+
start_index = index
|
4976
|
+
if node_cache[:left_bracket].has_key?(index)
|
4977
|
+
cached = node_cache[:left_bracket][index]
|
4978
|
+
@index = cached.interval.end if cached
|
4979
|
+
return cached
|
4980
|
+
end
|
4981
|
+
|
4982
|
+
i0 = index
|
4983
|
+
if input.index("( (", index) == index
|
4984
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
4985
|
+
@index += 3
|
4986
|
+
else
|
4987
|
+
terminal_parse_failure("( (")
|
4988
|
+
r1 = nil
|
4989
|
+
end
|
4990
|
+
if r1
|
4991
|
+
r0 = r1
|
4992
|
+
else
|
4993
|
+
if input.index("(", index) == index
|
4994
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
4995
|
+
r2.extend(LeftBracket0)
|
4996
|
+
@index += 1
|
4997
|
+
else
|
4998
|
+
terminal_parse_failure("(")
|
4999
|
+
r2 = nil
|
5000
|
+
end
|
5001
|
+
if r2
|
5002
|
+
r0 = r2
|
5003
|
+
else
|
5004
|
+
self.index = i0
|
5005
|
+
r0 = nil
|
5006
|
+
end
|
5007
|
+
end
|
5008
|
+
|
5009
|
+
node_cache[:left_bracket][start_index] = r0
|
5010
|
+
|
5011
|
+
return r0
|
5012
|
+
end
|
5013
|
+
|
5014
|
+
module RightBracket0
|
5015
|
+
def value
|
5016
|
+
")"
|
5017
|
+
end
|
5018
|
+
end
|
5019
|
+
|
5020
|
+
def _nt_right_bracket
|
5021
|
+
start_index = index
|
5022
|
+
if node_cache[:right_bracket].has_key?(index)
|
5023
|
+
cached = node_cache[:right_bracket][index]
|
5024
|
+
@index = cached.interval.end if cached
|
5025
|
+
return cached
|
5026
|
+
end
|
5027
|
+
|
5028
|
+
i0 = index
|
5029
|
+
if input.index(") )", index) == index
|
5030
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
5031
|
+
@index += 3
|
5032
|
+
else
|
5033
|
+
terminal_parse_failure(") )")
|
5034
|
+
r1 = nil
|
5035
|
+
end
|
5036
|
+
if r1
|
5037
|
+
r0 = r1
|
5038
|
+
else
|
5039
|
+
if input.index(")", index) == index
|
5040
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
5041
|
+
r2.extend(RightBracket0)
|
5042
|
+
@index += 1
|
5043
|
+
else
|
5044
|
+
terminal_parse_failure(")")
|
5045
|
+
r2 = nil
|
5046
|
+
end
|
5047
|
+
if r2
|
5048
|
+
r0 = r2
|
5049
|
+
else
|
5050
|
+
self.index = i0
|
5051
|
+
r0 = nil
|
5052
|
+
end
|
5053
|
+
end
|
5054
|
+
|
5055
|
+
node_cache[:right_bracket][start_index] = r0
|
5056
|
+
|
5057
|
+
return r0
|
5058
|
+
end
|
5059
|
+
|
3997
5060
|
module Space0
|
3998
5061
|
def details
|
3999
5062
|
{
|
@@ -4074,6 +5137,6 @@ module ScientificName
|
|
4074
5137
|
|
4075
5138
|
end
|
4076
5139
|
|
4077
|
-
class
|
4078
|
-
include
|
5140
|
+
class ScientificNameCleanParser < Treetop::Runtime::CompiledParser
|
5141
|
+
include ScientificNameClean
|
4079
5142
|
end
|