lib/biodiversity/parser/scientific_name_clean.rb in dimus-biodiversity-0.0.18 vs lib/biodiversity/parser/scientific_name_clean.rb in dimus-biodiversity-0.5.1
- old
+ new
@@ -1,631 +1,519 @@
# encoding: UTF-8
module ScientificNameClean
include Treetop::Runtime
def root
- @root || :composite_scientific_name
+ @root || :root
end
- module CompositeScientificName0
- def a
+ module Root0
+ def space
elements[0]
end
- def space
+ def a
elements[1]
end
- def hybrid_separator
+ def space
elements[2]
end
-
- def space
- elements[3]
- end
-
- def b
- elements[4]
- end
-
- def space
- elements[5]
- end
end
- module CompositeScientificName1
+ module Root1
def value
- a.value + " × " + b.value
+ a.value.gsub(/\s{2,}/, ' ').strip
end
+
def canonical
- a.canonical + " × " + b.canonical
+ a.canonical.gsub(/\s{2,}/, ' ').strip
end
def pos
- a.pos.merge(b.pos)
+ a.pos
end
def details
- {:hybrid => {:scientific_name1 => a.details, :scientific_name2 => b.details}}
+ a.details
end
end
- module CompositeScientificName2
+ def _nt_root
+ start_index = index
+ if node_cache[:root].has_key?(index)
+ cached = node_cache[:root][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0, s0 = index, []
+ r1 = _nt_space
+ s0 << r1
+ if r1
+ r2 = _nt_scientific_name_5
+ s0 << r2
+ if r2
+ r3 = _nt_space
+ s0 << r3
+ end
+ end
+ if s0.last
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
+ r0.extend(Root0)
+ r0.extend(Root1)
+ else
+ self.index = i0
+ r0 = nil
+ end
+
+ node_cache[:root][start_index] = r0
+
+ return r0
+ end
+
+ module ScientificName50
def a
elements[0]
end
def space
elements[1]
end
- def hybrid_separator
+ def b
elements[2]
end
def space
elements[3]
end
+ def c
+ elements[4]
+ end
end
- module CompositeScientificName3
+ module ScientificName51
def value
- a.value + " × ?"
+ a.value + " " + b.apply(c)
end
-
+
def canonical
a.canonical
end
def pos
- a.pos
+ a.pos.merge(c.pos)
end
-
+
def details
- {:hybrid => {:scientific_name1 => a.details, :scientific_name2 => "?"}}
+ a.details.merge(b.details(c))
end
end
- def _nt_composite_scientific_name
+ def _nt_scientific_name_5
start_index = index
- if node_cache[:composite_scientific_name].has_key?(index)
- cached = node_cache[:composite_scientific_name][index]
+ if node_cache[:scientific_name_5].has_key?(index)
+ cached = node_cache[:scientific_name_5][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
i1, s1 = index, []
- r2 = _nt_scientific_name
+ r2 = _nt_scientific_name_1
s1 << r2
if r2
r3 = _nt_space
s1 << r3
if r3
- r4 = _nt_hybrid_separator
+ r4 = _nt_taxon_concept_rank
s1 << r4
if r4
r5 = _nt_space
s1 << r5
if r5
- r6 = _nt_scientific_name
+ r6 = _nt_authorship
s1 << r6
- if r6
- r7 = _nt_space
- s1 << r7
- end
end
end
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(CompositeScientificName0)
- r1.extend(CompositeScientificName1)
+ r1.extend(ScientificName50)
+ r1.extend(ScientificName51)
else
self.index = i1
r1 = nil
end
if r1
r0 = r1
else
- i8, s8 = index, []
- r9 = _nt_scientific_name
- s8 << r9
- if r9
- r10 = _nt_space
- s8 << r10
- if r10
- r11 = _nt_hybrid_separator
- s8 << r11
- if r11
- r12 = _nt_space
- s8 << r12
- if r12
- if input.index(Regexp.new('[\\?]'), index) == index
- r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- r14 = nil
- end
- if r14
- r13 = r14
- else
- r13 = instantiate_node(SyntaxNode,input, index...index)
- end
- s8 << r13
- end
- end
- end
- end
- if s8.last
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
- r8.extend(CompositeScientificName2)
- r8.extend(CompositeScientificName3)
+ r7 = _nt_scientific_name_4
+ if r7
+ r0 = r7
else
- self.index = i8
- r8 = nil
+ self.index = i0
+ r0 = nil
end
- if r8
- r0 = r8
- else
- r15 = _nt_scientific_name
- if r15
- r0 = r15
- else
- self.index = i0
- r0 = nil
- end
- end
end
- node_cache[:composite_scientific_name][start_index] = r0
+ node_cache[:scientific_name_5][start_index] = r0
return r0
end
- module ScientificName0
- def space
+ module ScientificName40
+ def a
elements[0]
end
- def a
+ def space
elements[1]
end
- def space
+ def hybrid_character
elements[2]
end
- def b
+ def space
elements[3]
end
- def space
+ def b
elements[4]
end
-
- def c
- elements[5]
- end
-
- def space
- elements[6]
- end
-
- def d
- elements[7]
- end
-
- def space
- elements[8]
- end
end
- module ScientificName1
+ module ScientificName41
def value
- a.value + " " + b.value + " " + c.apply(d)
+ a.value + " × " + b.value
end
-
+
def canonical
- a.canonical
+ a.canonical + " " + b.canonical
end
def pos
- a.pos.merge(b.pos).merge(d.pos)
+ a.pos.merge(b.pos)
end
-
+
def details
- 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})
+ {:hybridFormula => [a.details, b.details]}
end
end
- module ScientificName2
- def space
+ module ScientificName42
+ def a
elements[0]
end
- def a
+ def space
elements[1]
end
- def space
+ def hybrid_character
elements[2]
end
- def b
+ def space
elements[3]
end
- def space
- elements[4]
- end
-
- def c
- elements[5]
- end
-
- def space
- elements[6]
- end
end
- module ScientificName3
+ module ScientificName43
def value
- a.value + " " + b.apply(c)
+ a.value + " × ?"
end
-
+
def canonical
a.canonical
end
def pos
- a.pos.merge(c.pos)
+ a.pos
end
-
+
def details
- 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})
+ {:hybridFormula => [a.details, "?"]}
end
end
- module ScientificName4
- def space
- elements[0]
+ def _nt_scientific_name_4
+ start_index = index
+ if node_cache[:scientific_name_4].has_key?(index)
+ cached = node_cache[:scientific_name_4][index]
+ @index = cached.interval.end if cached
+ return cached
end
- def a
- elements[1]
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_scientific_name_1
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ r4 = _nt_hybrid_character
+ s1 << r4
+ if r4
+ r5 = _nt_space
+ s1 << r5
+ if r5
+ r6 = _nt_scientific_name_1
+ s1 << r6
+ end
+ end
+ end
end
-
- def space
- elements[2]
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(ScientificName40)
+ r1.extend(ScientificName41)
+ else
+ self.index = i1
+ r1 = nil
end
-
- def b
- elements[3]
+ if r1
+ r0 = r1
+ else
+ i7, s7 = index, []
+ r8 = _nt_scientific_name_1
+ s7 << r8
+ if r8
+ r9 = _nt_space
+ s7 << r9
+ if r9
+ r10 = _nt_hybrid_character
+ s7 << r10
+ if r10
+ r11 = _nt_space
+ s7 << r11
+ if r11
+ if input.index(Regexp.new('[\\?]'), index) == index
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r13 = nil
+ end
+ if r13
+ r12 = r13
+ else
+ r12 = instantiate_node(SyntaxNode,input, index...index)
+ end
+ s7 << r12
+ end
+ end
+ end
+ end
+ if s7.last
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
+ r7.extend(ScientificName42)
+ r7.extend(ScientificName43)
+ else
+ self.index = i7
+ r7 = nil
+ end
+ if r7
+ r0 = r7
+ else
+ r14 = _nt_scientific_name_3
+ if r14
+ r0 = r14
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
end
- def space
- elements[4]
- end
+ node_cache[:scientific_name_4][start_index] = r0
- def c
- elements[5]
+ return r0
+ end
+
+ module ScientificName30
+ def a
+ elements[0]
end
def space
- elements[6]
+ elements[1]
end
+
+ def b
+ elements[2]
+ end
end
- module ScientificName5
- def value
- a.value + " " + b.value + " " + c.value
+ module ScientificName31
+ def value
+ a.value + " " + b.value
end
+
def canonical
- a.canonical
+ b.canonical
end
def pos
- a.pos.merge(b.pos)
+ b.pos
end
def details
- 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})
+ {:namedHybrid => b.details}
end
end
- module ScientificName6
- def space
- elements[0]
+ def _nt_scientific_name_3
+ start_index = index
+ if node_cache[:scientific_name_3].has_key?(index)
+ cached = node_cache[:scientific_name_3][index]
+ @index = cached.interval.end if cached
+ return cached
end
- def a
- elements[1]
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_hybrid_character
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ r4 = _nt_scientific_name_2
+ s1 << r4
+ end
end
-
- def space
- elements[2]
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(ScientificName30)
+ r1.extend(ScientificName31)
+ else
+ self.index = i1
+ r1 = nil
end
-
- def b
- elements[3]
+ if r1
+ r0 = r1
+ else
+ r5 = _nt_scientific_name_2
+ if r5
+ r0 = r5
+ else
+ self.index = i0
+ r0 = nil
+ end
end
- def space
- elements[4]
- end
- end
+ node_cache[:scientific_name_3][start_index] = r0
- module ScientificName7
- def value
- a.value + " " + b.value
- end
- def canonical
- a.canonical
- end
-
- def pos
- a.pos.merge(b.pos)
- end
-
- def details
- a.details.merge(b.details).merge({:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value.gsub(/\s{2,}/, ' ')})
- end
+ return r0
end
- module ScientificName8
- def space
+ module ScientificName20
+ def a
elements[0]
end
- def a
+ def space
elements[1]
end
- def space
+ def b
elements[2]
end
-
- def b
- elements[3]
- end
-
- def space
- elements[4]
- end
end
- module ScientificName9
+ module ScientificName21
def value
a.value + " " + b.value
end
def canonical
a.canonical
end
def pos
- a.pos.merge(b.pos)
+ a.pos
end
def details
- 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,}/, ' ')})
+ a.details.merge(b.details)
end
end
- def _nt_scientific_name
+ def _nt_scientific_name_2
start_index = index
- if node_cache[:scientific_name].has_key?(index)
- cached = node_cache[:scientific_name][index]
+ if node_cache[:scientific_name_2].has_key?(index)
+ cached = node_cache[:scientific_name_2][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
- r1 = _nt_name_part_authors_mix
- if r1
- r0 = r1
- else
- i2, s2 = index, []
+ i1, s1 = index, []
+ r2 = _nt_scientific_name_1
+ s1 << r2
+ if r2
r3 = _nt_space
- s2 << r3
+ s1 << r3
if r3
- r4 = _nt_name_part
- s2 << r4
- if r4
- r5 = _nt_space
- s2 << r5
- if r5
- r6 = _nt_authors_part
- s2 << r6
- if r6
- r7 = _nt_space
- s2 << r7
- if r7
- r8 = _nt_taxon_concept_rank
- s2 << r8
- if r8
- r9 = _nt_space
- s2 << r9
- if r9
- r10 = _nt_authors_part
- s2 << r10
- if r10
- r11 = _nt_space
- s2 << r11
- end
- end
- end
- end
- end
- end
- end
+ r4 = _nt_status_part
+ s1 << r4
end
- if s2.last
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
- r2.extend(ScientificName0)
- r2.extend(ScientificName1)
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(ScientificName20)
+ r1.extend(ScientificName21)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ r5 = _nt_scientific_name_1
+ if r5
+ r0 = r5
else
- self.index = i2
- r2 = nil
+ self.index = i0
+ r0 = nil
end
+ end
+
+ node_cache[:scientific_name_2][start_index] = r0
+
+ return r0
+ end
+
+ def _nt_scientific_name_1
+ start_index = index
+ if node_cache[:scientific_name_1].has_key?(index)
+ cached = node_cache[:scientific_name_1][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ r1 = _nt_multinomial_name
+ if r1
+ r0 = r1
+ else
+ r2 = _nt_uninomial_name
if r2
r0 = r2
else
- i12, s12 = index, []
- r13 = _nt_space
- s12 << r13
- if r13
- r14 = _nt_name_part
- s12 << r14
- if r14
- r15 = _nt_space
- s12 << r15
- if r15
- r16 = _nt_taxon_concept_rank
- s12 << r16
- if r16
- r17 = _nt_space
- s12 << r17
- if r17
- r18 = _nt_authors_part
- s12 << r18
- if r18
- r19 = _nt_space
- s12 << r19
- end
- end
- end
- end
- end
- end
- if s12.last
- r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
- r12.extend(ScientificName2)
- r12.extend(ScientificName3)
- else
- self.index = i12
- r12 = nil
- end
- if r12
- r0 = r12
- else
- i20, s20 = index, []
- r21 = _nt_space
- s20 << r21
- if r21
- r22 = _nt_name_part
- s20 << r22
- if r22
- r23 = _nt_space
- s20 << r23
- if r23
- r24 = _nt_authors_part
- s20 << r24
- if r24
- r25 = _nt_space
- s20 << r25
- if r25
- r26 = _nt_status_part
- s20 << r26
- if r26
- r27 = _nt_space
- s20 << r27
- end
- end
- end
- end
- end
- end
- if s20.last
- r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
- r20.extend(ScientificName4)
- r20.extend(ScientificName5)
- else
- self.index = i20
- r20 = nil
- end
- if r20
- r0 = r20
- else
- i28, s28 = index, []
- r29 = _nt_space
- s28 << r29
- if r29
- r30 = _nt_name_part
- s28 << r30
- if r30
- r31 = _nt_space
- s28 << r31
- if r31
- r32 = _nt_authors_part
- s28 << r32
- if r32
- r33 = _nt_space
- s28 << r33
- end
- end
- end
- end
- if s28.last
- r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
- r28.extend(ScientificName6)
- r28.extend(ScientificName7)
- else
- self.index = i28
- r28 = nil
- end
- if r28
- r0 = r28
- else
- i34, s34 = index, []
- r35 = _nt_space
- s34 << r35
- if r35
- r36 = _nt_name_part
- s34 << r36
- if r36
- r37 = _nt_space
- s34 << r37
- if r37
- r38 = _nt_year
- s34 << r38
- if r38
- r39 = _nt_space
- s34 << r39
- end
- end
- end
- end
- if s34.last
- r34 = instantiate_node(SyntaxNode,input, i34...index, s34)
- r34.extend(ScientificName8)
- r34.extend(ScientificName9)
- else
- self.index = i34
- r34 = nil
- end
- if r34
- r0 = r34
- else
- r40 = _nt_name_part
- if r40
- r0 = r40
- else
- self.index = i0
- r0 = nil
- end
- end
- end
- end
- end
+ self.index = i0
+ r0 = nil
end
end
- node_cache[:scientific_name][start_index] = r0
+ node_cache[:scientific_name_1][start_index] = r0
return r0
end
module StatusPart0
@@ -718,49 +606,37 @@
cached = node_cache[:status_word][index]
@index = cached.interval.end if cached
return cached
end
- i0 = index
- i1, s1 = index, []
- r2 = _nt_latin_word
- s1 << r2
- if r2
+ i0, s0 = index, []
+ r1 = _nt_latin_word
+ s0 << r1
+ if r1
if input.index(Regexp.new('[\\.]'), index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
- r3 = nil
+ r2 = nil
end
- s1 << r3
+ s0 << r2
end
- if s1.last
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(StatusWord0)
- r1.extend(StatusWord1)
+ if s0.last
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
+ r0.extend(StatusWord0)
+ r0.extend(StatusWord1)
else
- self.index = i1
- r1 = nil
+ self.index = i0
+ r0 = nil
end
- if r1
- r0 = r1
- else
- r4 = _nt_latin_word
- if r4
- r0 = r4
- else
- self.index = i0
- r0 = nil
- end
- end
node_cache[:status_word][start_index] = r0
return r0
end
- module NamePartAuthorsMix0
+ module MultinomialName0
def a
elements[0]
end
def space
@@ -777,37 +653,38 @@
def c
elements[4]
end
- def space
+ def space_hard
elements[5]
end
def d
elements[6]
end
end
- module NamePartAuthorsMix1
+ module MultinomialName1
def value
- (a.value + " " + b.value + " " + c.value + " " + d.value).gsub(/\s+/,' ')
+ a.value + " " + b.value + " " + c.value + " " + d.value
end
+
def canonical
- (a.canonical + " " + c.canonical).gsub(/\s+/,' ')
+ a.canonical + " " + c.canonical + " " + d.canonical
end
-
+
def pos
a.pos.merge(b.pos).merge(c.pos).merge(d.pos)
end
-
+
def details
- 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,}/, ' ')})
+ a.details.merge(b.details).merge(c.details).merge(d.details)
end
end
- module NamePartAuthorsMix2
+ module MultinomialName2
def a
elements[0]
end
def space
@@ -825,110 +702,242 @@
def c
elements[4]
end
end
- module NamePartAuthorsMix3
- def value
- (a.value + " " + b.value + " " + c.value).gsub(/\s+/,' ')
+ module MultinomialName3
+ def value
+ a.value + " " + b.value + " " + c.value
end
+
def canonical
- (a.canonical + " " + c.canonical).gsub(/\s+/,' ')
+ a.canonical + " " + c.canonical
end
+
+ def pos
+ a.pos.merge(b.pos).merge(c.pos)
+ end
+
def details
- 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,}/, ' ')})
+ a.details.merge(b.details).merge(c.details)
end
end
- def _nt_name_part_authors_mix
+ module MultinomialName4
+ def a
+ elements[0]
+ end
+
+ def space_hard
+ elements[1]
+ end
+
+ def b
+ elements[2]
+ end
+
+ def space_hard
+ elements[3]
+ end
+
+ def c
+ elements[4]
+ end
+ end
+
+ module MultinomialName5
+ def value
+ a.value + " " + b.value + " " + c.value
+ end
+
+ def canonical
+ a.canonical + " " + b.canonical + " " + c.canonical
+ end
+
+ def pos
+ a.pos.merge(b.pos).merge(c.pos)
+ end
+
+ def details
+ a.details.merge(b.details).merge(c.details)
+ end
+ end
+
+ module MultinomialName6
+ def a
+ elements[0]
+ end
+
+ def space_hard
+ elements[1]
+ end
+
+ def b
+ elements[2]
+ end
+ end
+
+ module MultinomialName7
+ def value
+ a.value + " " + b.value
+ end
+
+ def canonical
+ a.canonical + " " + b.canonical
+ end
+
+ def pos
+ a.pos.merge(b.pos)
+ end
+
+ def details
+ a.details.merge(b.details)
+ end
+ end
+
+ def _nt_multinomial_name
start_index = index
- if node_cache[:name_part_authors_mix].has_key?(index)
- cached = node_cache[:name_part_authors_mix][index]
+ if node_cache[:multinomial_name].has_key?(index)
+ cached = node_cache[:multinomial_name][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
i1, s1 = index, []
- r2 = _nt_species_name
+ r2 = _nt_genus
s1 << r2
if r2
r3 = _nt_space
s1 << r3
if r3
- r4 = _nt_authors_part
+ r4 = _nt_subgenus
s1 << r4
if r4
r5 = _nt_space
s1 << r5
if r5
- r6 = _nt_subspecies_name
+ r6 = _nt_species
s1 << r6
if r6
- r7 = _nt_space
+ r7 = _nt_space_hard
s1 << r7
if r7
- r8 = _nt_authors_part
+ r8 = _nt_infraspecies_mult
s1 << r8
end
end
end
end
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(NamePartAuthorsMix0)
- r1.extend(NamePartAuthorsMix1)
+ r1.extend(MultinomialName0)
+ r1.extend(MultinomialName1)
else
self.index = i1
r1 = nil
end
if r1
r0 = r1
else
i9, s9 = index, []
- r10 = _nt_species_name
+ r10 = _nt_genus
s9 << r10
if r10
r11 = _nt_space
s9 << r11
if r11
- r12 = _nt_authors_part
+ r12 = _nt_subgenus
s9 << r12
if r12
r13 = _nt_space
s9 << r13
if r13
- r14 = _nt_subspecies_name
+ r14 = _nt_species
s9 << r14
end
end
end
end
if s9.last
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
- r9.extend(NamePartAuthorsMix2)
- r9.extend(NamePartAuthorsMix3)
+ r9.extend(MultinomialName2)
+ r9.extend(MultinomialName3)
else
self.index = i9
r9 = nil
end
if r9
r0 = r9
else
- self.index = i0
- r0 = nil
+ i15, s15 = index, []
+ r16 = _nt_genus
+ s15 << r16
+ if r16
+ r17 = _nt_space_hard
+ s15 << r17
+ if r17
+ r18 = _nt_species
+ s15 << r18
+ if r18
+ r19 = _nt_space_hard
+ s15 << r19
+ if r19
+ r20 = _nt_infraspecies_mult
+ s15 << r20
+ end
+ end
+ end
+ end
+ if s15.last
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
+ r15.extend(MultinomialName4)
+ r15.extend(MultinomialName5)
+ else
+ self.index = i15
+ r15 = nil
+ end
+ if r15
+ r0 = r15
+ else
+ i21, s21 = index, []
+ r22 = _nt_genus
+ s21 << r22
+ if r22
+ r23 = _nt_space_hard
+ s21 << r23
+ if r23
+ r24 = _nt_species
+ s21 << r24
+ end
+ end
+ if s21.last
+ r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
+ r21.extend(MultinomialName6)
+ r21.extend(MultinomialName7)
+ else
+ self.index = i21
+ r21 = nil
+ end
+ if r21
+ r0 = r21
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
end
end
- node_cache[:name_part_authors_mix][start_index] = r0
+ node_cache[:multinomial_name][start_index] = r0
return r0
end
- module AuthorsPart0
+ module InfraspeciesMult0
def a
elements[0]
end
def space
@@ -938,198 +947,862 @@
def b
elements[2]
end
end
- module AuthorsPart1
- def value
+ module InfraspeciesMult1
+ def value
a.value + " " + b.value
end
+ def canonical
+ a.canonical + " " + b.canonical
+ end
+
def pos
a.pos.merge(b.pos)
end
def details
- a.details.merge(b.details)
+ #{:infraspecies => a.details[:infraspceies] << b.details[:infraspecies]}
+ a_array = a.details[:infraspecies].class == Array ? a.details[:infraspecies] : [a.details[:infraspecies]]
+ b_array = b.details[:infraspecies].class == Array ? b.details[:infraspecies] : [b.details[:infraspecies]]
+ a.details.merge({:infraspecies => a_array + b_array})
end
end
- module AuthorsPart2
+ def _nt_infraspecies_mult
+ start_index = index
+ if node_cache[:infraspecies_mult].has_key?(index)
+ cached = node_cache[:infraspecies_mult][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_infraspecies
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ r4 = _nt_infraspecies_mult
+ s1 << r4
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(InfraspeciesMult0)
+ r1.extend(InfraspeciesMult1)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ r5 = _nt_infraspecies
+ if r5
+ r0 = r5
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:infraspecies_mult][start_index] = r0
+
+ return r0
+ end
+
+ module Infraspecies0
def a
elements[0]
end
def space
elements[1]
end
- def ex_sep
+ def b
elements[2]
end
+ end
- def space
- elements[3]
+ module Infraspecies1
+ def value
+ a.value + " " + b.value
end
- def b
- elements[4]
+ def canonical
+ a.canonical
end
- end
- module AuthorsPart3
- def value
- a.value + " ex " + b.value
- end
-
def pos
a.pos.merge(b.pos)
end
-
+
def details
- {:revised_name_authors => {:revised_authors => a.details[:authors], :authors => b.details[:authors]}}
+ {:infraspecies => a.details[:infraspecies].merge(b.details)}
end
end
- module AuthorsPart4
- def a
+ def _nt_infraspecies
+ start_index = index
+ if node_cache[:infraspecies].has_key?(index)
+ cached = node_cache[:infraspecies][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_infraspecies_epitheton
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ r4 = _nt_authorship
+ s1 << r4
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(Infraspecies0)
+ r1.extend(Infraspecies1)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ r5 = _nt_infraspecies_epitheton
+ if r5
+ r0 = r5
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:infraspecies][start_index] = r0
+
+ return r0
+ end
+
+ module InfraspeciesEpitheton0
+ def sel
elements[0]
end
- def space
+ def space_hard
elements[1]
end
- def b
+ def a
elements[2]
end
end
- module AuthorsPart5
- def value
- a.value + " " + b.value
+ module InfraspeciesEpitheton1
+ def value
+ sel.apply(a)
end
+ def canonical
+ sel.canonical(a)
+ end
def pos
- a.pos.merge(b.pos)
+ {a.interval.begin => ['infraspecies', a.interval.end]}
end
+
+ def details
+ sel.details(a)
+ end
+ end
+
+ module InfraspeciesEpitheton2
+ def species_word
+ elements[0]
+ end
+
+ end
+
+ module InfraspeciesEpitheton3
+ def value
+ text_value
+ end
+ def canonical
+ value
+ end
+
+ def pos
+ {interval.begin => ['infraspecies', interval.end]}
+ end
+
def details
- a.details.merge(b.details)
+ {:infraspecies => {:epitheton => value, :rank => 'n/a'}}
end
end
- def _nt_authors_part
+ def _nt_infraspecies_epitheton
start_index = index
- if node_cache[:authors_part].has_key?(index)
- cached = node_cache[:authors_part][index]
+ if node_cache[:infraspecies_epitheton].has_key?(index)
+ cached = node_cache[:infraspecies_epitheton][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
i1, s1 = index, []
- r2 = _nt_original_authors_revised_name
+ r2 = _nt_rank
s1 << r2
if r2
- r3 = _nt_space
+ r3 = _nt_space_hard
s1 << r3
if r3
- r4 = _nt_authors_revised_name
+ r4 = _nt_species_word
s1 << r4
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(AuthorsPart0)
- r1.extend(AuthorsPart1)
+ r1.extend(InfraspeciesEpitheton0)
+ r1.extend(InfraspeciesEpitheton1)
else
self.index = i1
r1 = nil
end
if r1
r0 = r1
else
i5, s5 = index, []
- r6 = _nt_simple_authors_part
+ r6 = _nt_species_word
s5 << r6
if r6
- r7 = _nt_space
- s5 << r7
- if r7
- r8 = _nt_ex_sep
- s5 << r8
- if r8
- r9 = _nt_space
- s5 << r9
- if r9
- r10 = _nt_simple_authors_part
- s5 << r10
- end
- end
+ i7 = index
+ if input.index(Regexp.new('[\\.]'), index) == index
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r8 = nil
end
+ if r8
+ r7 = nil
+ else
+ self.index = i7
+ r7 = instantiate_node(SyntaxNode,input, index...index)
+ end
+ s5 << r7
end
if s5.last
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
- r5.extend(AuthorsPart2)
- r5.extend(AuthorsPart3)
+ r5.extend(InfraspeciesEpitheton2)
+ r5.extend(InfraspeciesEpitheton3)
else
self.index = i5
r5 = nil
end
if r5
r0 = r5
else
- i11, s11 = index, []
- r12 = _nt_original_authors_revised_name
- s11 << r12
- if r12
- r13 = _nt_space
- s11 << r13
- if r13
- r14 = _nt_authors_names_full
- s11 << r14
- end
- end
- if s11.last
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
- r11.extend(AuthorsPart4)
- r11.extend(AuthorsPart5)
+ self.index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:infraspecies_epitheton][start_index] = r0
+
+ return r0
+ end
+
+ module TaxonConceptRank0
+ def value
+ "sec."
+ end
+ def apply(a)
+ " " + value + " " + a.value
+ end
+ def details(a = nil)
+ {:taxon_concept => a.details}
+ end
+ end
+
+ def _nt_taxon_concept_rank
+ start_index = index
+ if node_cache[:taxon_concept_rank].has_key?(index)
+ cached = node_cache[:taxon_concept_rank][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ if input.index("sec.", index) == index
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ r0.extend(TaxonConceptRank0)
+ @index += 4
+ else
+ terminal_parse_failure("sec.")
+ r0 = nil
+ end
+
+ node_cache[:taxon_concept_rank][start_index] = r0
+
+ return r0
+ end
+
+ module Rank0
+ def value
+ text_value.strip
+ end
+
+ def apply(a)
+ " " + text_value + " " + a.value
+ end
+
+ def canonical(a)
+ " " + a.value
+ end
+
+ def details(a = nil)
+ {:infraspecies => {:epitheton => (a.value rescue nil), :rank => text_value}}
+ end
+ end
+
+ def _nt_rank
+ start_index = index
+ if node_cache[:rank].has_key?(index)
+ cached = node_cache[:rank][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1 = index
+ if input.index("morph.", index) == index
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
+ @index += 6
+ else
+ terminal_parse_failure("morph.")
+ r2 = nil
+ end
+ if r2
+ r1 = r2
+ r1.extend(Rank0)
+ else
+ if input.index("f.sp.", index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
+ @index += 5
+ else
+ terminal_parse_failure("f.sp.")
+ r3 = nil
+ end
+ if r3
+ r1 = r3
+ r1.extend(Rank0)
+ else
+ if input.index("B", index) == index
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- self.index = i11
- r11 = nil
+ terminal_parse_failure("B")
+ r4 = nil
end
- if r11
- r0 = r11
+ if r4
+ r1 = r4
+ r1.extend(Rank0)
else
- r15 = _nt_authors_revised_name
- if r15
- r0 = r15
+ if input.index("ssp.", index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
else
- r16 = _nt_original_authors_revised_name
- if r16
- r0 = r16
+ terminal_parse_failure("ssp.")
+ r5 = nil
+ end
+ if r5
+ r1 = r5
+ r1.extend(Rank0)
+ else
+ if input.index("mut.", index) == index
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
else
- r17 = _nt_simple_authors_part
- if r17
- r0 = r17
+ terminal_parse_failure("mut.")
+ r6 = nil
+ end
+ if r6
+ r1 = r6
+ r1.extend(Rank0)
+ else
+ if input.index("nat", index) == index
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- self.index = i0
- r0 = nil
+ terminal_parse_failure("nat")
+ r7 = nil
end
+ if r7
+ r1 = r7
+ r1.extend(Rank0)
+ else
+ if input.index("nothosubsp.", index) == index
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 11))
+ @index += 11
+ else
+ terminal_parse_failure("nothosubsp.")
+ r8 = nil
+ end
+ if r8
+ r1 = r8
+ r1.extend(Rank0)
+ else
+ if input.index("pseudovar.", index) == index
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 10))
+ @index += 10
+ else
+ terminal_parse_failure("pseudovar.")
+ r9 = nil
+ end
+ if r9
+ r1 = r9
+ r1.extend(Rank0)
+ else
+ if input.index("sect.", index) == index
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 5))
+ @index += 5
+ else
+ terminal_parse_failure("sect.")
+ r10 = nil
+ end
+ if r10
+ r1 = r10
+ r1.extend(Rank0)
+ else
+ if input.index("ser.", index) == index
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
+ else
+ terminal_parse_failure("ser.")
+ r11 = nil
+ end
+ if r11
+ r1 = r11
+ r1.extend(Rank0)
+ else
+ if input.index("var.", index) == index
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
+ else
+ terminal_parse_failure("var.")
+ r12 = nil
+ end
+ if r12
+ r1 = r12
+ r1.extend(Rank0)
+ else
+ if input.index("subvar.", index) == index
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 7))
+ @index += 7
+ else
+ terminal_parse_failure("subvar.")
+ r13 = nil
+ end
+ if r13
+ r1 = r13
+ r1.extend(Rank0)
+ else
+ if input.index("[var.]", index) == index
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 6))
+ @index += 6
+ else
+ terminal_parse_failure("[var.]")
+ r14 = nil
+ end
+ if r14
+ r1 = r14
+ r1.extend(Rank0)
+ else
+ if input.index("subsp.", index) == index
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 6))
+ @index += 6
+ else
+ terminal_parse_failure("subsp.")
+ r15 = nil
+ end
+ if r15
+ r1 = r15
+ r1.extend(Rank0)
+ else
+ if input.index("subf.", index) == index
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 5))
+ @index += 5
+ else
+ terminal_parse_failure("subf.")
+ r16 = nil
+ end
+ if r16
+ r1 = r16
+ r1.extend(Rank0)
+ else
+ if input.index("race", index) == index
+ r17 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
+ else
+ terminal_parse_failure("race")
+ r17 = nil
+ end
+ if r17
+ r1 = r17
+ r1.extend(Rank0)
+ else
+ if input.index("α", index) == index
+ r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("α")
+ r18 = nil
+ end
+ if r18
+ r1 = r18
+ r1.extend(Rank0)
+ else
+ if input.index("ββ", index) == index
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("ββ")
+ r19 = nil
+ end
+ if r19
+ r1 = r19
+ r1.extend(Rank0)
+ else
+ if input.index("β", index) == index
+ r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("β")
+ r20 = nil
+ end
+ if r20
+ r1 = r20
+ r1.extend(Rank0)
+ else
+ if input.index("γ", index) == index
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("γ")
+ r21 = nil
+ end
+ if r21
+ r1 = r21
+ r1.extend(Rank0)
+ else
+ if input.index("δ", index) == index
+ r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("δ")
+ r22 = nil
+ end
+ if r22
+ r1 = r22
+ r1.extend(Rank0)
+ else
+ if input.index("ε", index) == index
+ r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("ε")
+ r23 = nil
+ end
+ if r23
+ r1 = r23
+ r1.extend(Rank0)
+ else
+ if input.index("φ", index) == index
+ r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("φ")
+ r24 = nil
+ end
+ if r24
+ r1 = r24
+ r1.extend(Rank0)
+ else
+ if input.index("θ", index) == index
+ r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("θ")
+ r25 = nil
+ end
+ if r25
+ r1 = r25
+ r1.extend(Rank0)
+ else
+ if input.index("μ", index) == index
+ r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("μ")
+ r26 = nil
+ end
+ if r26
+ r1 = r26
+ r1.extend(Rank0)
+ else
+ if input.index("a.", index) == index
+ r27 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("a.")
+ r27 = nil
+ end
+ if r27
+ r1 = r27
+ r1.extend(Rank0)
+ else
+ if input.index("b.", index) == index
+ r28 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("b.")
+ r28 = nil
+ end
+ if r28
+ r1 = r28
+ r1.extend(Rank0)
+ else
+ if input.index("c.", index) == index
+ r29 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("c.")
+ r29 = nil
+ end
+ if r29
+ r1 = r29
+ r1.extend(Rank0)
+ else
+ if input.index("d.", index) == index
+ r30 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("d.")
+ r30 = nil
+ end
+ if r30
+ r1 = r30
+ r1.extend(Rank0)
+ else
+ if input.index("e.", index) == index
+ r31 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("e.")
+ r31 = nil
+ end
+ if r31
+ r1 = r31
+ r1.extend(Rank0)
+ else
+ if input.index("g.", index) == index
+ r32 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("g.")
+ r32 = nil
+ end
+ if r32
+ r1 = r32
+ r1.extend(Rank0)
+ else
+ if input.index("k.", index) == index
+ r33 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("k.")
+ r33 = nil
+ end
+ if r33
+ r1 = r33
+ r1.extend(Rank0)
+ else
+ if input.index("****", index) == index
+ r34 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
+ else
+ terminal_parse_failure("****")
+ r34 = nil
+ end
+ if r34
+ r1 = r34
+ r1.extend(Rank0)
+ else
+ if input.index("**", index) == index
+ r35 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("**")
+ r35 = nil
+ end
+ if r35
+ r1 = r35
+ r1.extend(Rank0)
+ else
+ if input.index("*", index) == index
+ r36 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("*")
+ r36 = nil
+ end
+ if r36
+ r1 = r36
+ r1.extend(Rank0)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
end
end
end
end
end
+ if r1
+ r0 = r1
+ else
+ r37 = _nt_rank_forma
+ if r37
+ r0 = r37
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
- node_cache[:authors_part][start_index] = r0
+ node_cache[:rank][start_index] = r0
return r0
end
- module SimpleAuthorsPart0
+ module RankForma0
+ def value
+ "f."
+ end
+ def apply(a)
+ " " + value + " " + a.value
+ end
+ def canonical(a)
+ " " + a.value
+ end
+ def details(a = nil)
+ {:infraspecies => {:epitheton => (a.value rescue nil), :rank => value}}
+ end
+ end
+
+ def _nt_rank_forma
+ start_index = index
+ if node_cache[:rank_forma].has_key?(index)
+ cached = node_cache[:rank_forma][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ if input.index("forma", index) == index
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
+ @index += 5
+ else
+ terminal_parse_failure("forma")
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ r0.extend(RankForma0)
+ else
+ if input.index("form.", index) == index
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
+ @index += 5
+ else
+ terminal_parse_failure("form.")
+ r2 = nil
+ end
+ if r2
+ r0 = r2
+ r0.extend(RankForma0)
+ else
+ if input.index("fo.", index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
+ else
+ terminal_parse_failure("fo.")
+ r3 = nil
+ end
+ if r3
+ r0 = r3
+ r0.extend(RankForma0)
+ else
+ if input.index("f.", index) == index
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
+ else
+ terminal_parse_failure("f.")
+ r4 = nil
+ end
+ if r4
+ r0 = r4
+ r0.extend(RankForma0)
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+ end
+ end
+
+ node_cache[:rank_forma][start_index] = r0
+
+ return r0
+ end
+
+ module Species0
def a
elements[0]
end
def space
@@ -1139,76 +1812,199 @@
def b
elements[2]
end
end
- module SimpleAuthorsPart1
+ module Species1
def value
a.value + " " + b.value
end
+ def canonical
+ a.canonical
+ end
+
def pos
a.pos.merge(b.pos)
end
def details
- a.details.merge(b.details)
+ {:species => a.details[:species].merge(b.details)}
end
end
- def _nt_simple_authors_part
+ def _nt_species
start_index = index
- if node_cache[:simple_authors_part].has_key?(index)
- cached = node_cache[:simple_authors_part][index]
+ if node_cache[:species].has_key?(index)
+ cached = node_cache[:species][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
i1, s1 = index, []
- r2 = _nt_original_authors_names_full
+ r2 = _nt_species_epitheton
s1 << r2
if r2
r3 = _nt_space
s1 << r3
if r3
- r4 = _nt_authors_names_full
+ r4 = _nt_authorship
s1 << r4
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(SimpleAuthorsPart0)
- r1.extend(SimpleAuthorsPart1)
+ r1.extend(Species0)
+ r1.extend(Species1)
else
self.index = i1
r1 = nil
end
if r1
r0 = r1
else
- r5 = _nt_original_authors_names_full
+ r5 = _nt_species_epitheton
if r5
r0 = r5
else
- r6 = _nt_authors_names_full
+ self.index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:species][start_index] = r0
+
+ return r0
+ end
+
+ module SpeciesEpitheton0
+ def space_hard
+ elements[0]
+ end
+
+ def author_prefix_word
+ elements[1]
+ end
+
+ def space_hard
+ elements[2]
+ end
+ end
+
+ module SpeciesEpitheton1
+ def a
+ elements[0]
+ end
+
+ end
+
+ module SpeciesEpitheton2
+ def value
+ a.value
+ end
+
+ def canonical
+ a.value
+ end
+
+ def pos
+ {a.interval.begin => ['species', a.interval.end]}
+ end
+
+ def details
+ {:species => {:epitheton => a.value}}
+ end
+ end
+
+ module SpeciesEpitheton3
+ def canonical
+ value
+ end
+
+ def pos
+ {interval.begin => ['species', interval.end]}
+ end
+
+ def details
+ {:species => {:epitheton => value}}
+ end
+ end
+
+ def _nt_species_epitheton
+ start_index = index
+ if node_cache[:species_epitheton].has_key?(index)
+ cached = node_cache[:species_epitheton][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_species_word
+ s1 << r2
+ if r2
+ i3 = index
+ i4, s4 = index, []
+ r5 = _nt_space_hard
+ s4 << r5
+ if r5
+ r6 = _nt_author_prefix_word
+ s4 << r6
if r6
- r0 = r6
+ r7 = _nt_space_hard
+ s4 << r7
+ end
+ end
+ if s4.last
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
+ r4.extend(SpeciesEpitheton0)
+ else
+ self.index = i4
+ r4 = nil
+ end
+ if r4
+ self.index = i3
+ r3 = instantiate_node(SyntaxNode,input, index...index)
+ else
+ r3 = nil
+ end
+ s1 << r3
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(SpeciesEpitheton1)
+ r1.extend(SpeciesEpitheton2)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ r8 = _nt_species_word
+ r8.extend(SpeciesEpitheton3)
+ if r8
+ r0 = r8
+ else
+ r9 = _nt_species_word_hybrid
+ if r9
+ r0 = r9
else
self.index = i0
r0 = nil
end
end
end
- node_cache[:simple_authors_part][start_index] = r0
+ node_cache[:species_epitheton][start_index] = r0
return r0
end
- module OriginalAuthorsNamesFull0
- def left_bracket
+ module Subgenus0
+ def left_paren
elements[0]
end
def space
elements[1]
@@ -1220,78 +2016,467 @@
def space
elements[3]
end
- def right_bracket
+ def right_paren
elements[4]
end
+ end
+ module Subgenus1
+ def value
+ "(" + a.value + ")"
+ end
+
+ def canonical
+ a.value
+ end
+
+ def pos
+ {a.interval.begin => ['subgenus', a.interval.end]}
+ end
+
+ def details
+ {:subgenus => {:epitheton => a.value}}
+ end
+ end
+
+ def _nt_subgenus
+ start_index = index
+ if node_cache[:subgenus].has_key?(index)
+ cached = node_cache[:subgenus][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0, s0 = index, []
+ r1 = _nt_left_paren
+ s0 << r1
+ if r1
+ r2 = _nt_space
+ s0 << r2
+ if r2
+ r3 = _nt_cap_latin_word
+ s0 << r3
+ if r3
+ r4 = _nt_space
+ s0 << r4
+ if r4
+ r5 = _nt_right_paren
+ s0 << r5
+ end
+ end
+ end
+ end
+ if s0.last
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
+ r0.extend(Subgenus0)
+ r0.extend(Subgenus1)
+ else
+ self.index = i0
+ r0 = nil
+ end
+
+ node_cache[:subgenus][start_index] = r0
+
+ return r0
+ end
+
+ module Genus0
+ def pos
+ {interval.begin => ['genus', interval.end]}
+ end
+
+ def canonical
+ value
+ end
+
+ def details
+ {:genus => {:epitheton => value}}
+ end
+ end
+
+ def _nt_genus
+ start_index = index
+ if node_cache[:genus].has_key?(index)
+ cached = node_cache[:genus][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ r0 = _nt_cap_latin_word
+ r0.extend(Genus0)
+
+ node_cache[:genus][start_index] = r0
+
+ return r0
+ end
+
+ module UninomialName0
+ def a
+ elements[0]
+ end
+
+ def space_hard
+ elements[1]
+ end
+
+ def b
+ elements[2]
+ end
+ end
+
+ module UninomialName1
+ def value
+ a.value + " " + b.value
+ end
+
+ def canonical
+ a.canonical
+ end
+
+ def pos
+ a.pos.merge(b.pos)
+ end
+
+ def details
+ {:uninomial => a.details[:uninomial].merge(b.details)}
+ end
+ end
+
+ def _nt_uninomial_name
+ start_index = index
+ if node_cache[:uninomial_name].has_key?(index)
+ cached = node_cache[:uninomial_name][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_uninomial_epitheton
+ s1 << r2
+ if r2
+ r3 = _nt_space_hard
+ s1 << r3
+ if r3
+ r4 = _nt_authorship
+ s1 << r4
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(UninomialName0)
+ r1.extend(UninomialName1)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ r5 = _nt_uninomial_epitheton
+ if r5
+ r0 = r5
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:uninomial_name][start_index] = r0
+
+ return r0
+ end
+
+ module UninomialEpitheton0
+ def canonical
+ value
+ end
+
+ def pos
+ {interval.begin => ['uninomial', interval.end]}
+ end
+
+ def details
+ {:uninomial => {:epitheton => value}}
+ end
+ end
+
+ def _nt_uninomial_epitheton
+ start_index = index
+ if node_cache[:uninomial_epitheton].has_key?(index)
+ cached = node_cache[:uninomial_epitheton][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ r0 = _nt_cap_latin_word
+ r0.extend(UninomialEpitheton0)
+
+ node_cache[:uninomial_epitheton][start_index] = r0
+
+ return r0
+ end
+
+ module Authorship0
+ def a
+ elements[0]
+ end
+
def space
- elements[5]
+ elements[1]
end
+ def b
+ elements[2]
+ end
+
def space
- elements[7]
+ elements[3]
end
+ def c
+ elements[4]
+ end
+ end
+
+ module Authorship1
+ def value
+ a.value + " " + b.value + " " + c.value
+ end
+
+ def pos
+ a.pos.merge(b.pos).merge(c.pos)
+ end
+
+ def details
+ val = {:authorship => text_value.strip, :combinationAuthorTeam => b.details[:basionymAuthorTeam], :basionymAuthorTeam => a.details[:basionymAuthorTeam]}
+ val[:combinationAuthorTeam].merge!(c.details)
+ val
+ end
+ end
+
+ module Authorship2
+ def a
+ elements[0]
+ end
+
+ def space
+ elements[1]
+ end
+
def b
- elements[8]
+ elements[2]
end
end
- module OriginalAuthorsNamesFull1
+ module Authorship3
def value
- "(" + a.value + " " + b.value + ")"
+ a.value + " " + b.value
end
def pos
a.pos.merge(b.pos)
end
def details
- {:orig_authors => a.details[:authors], :year => b.details[:year]}
+ {:authorship => text_value.strip, :combinationAuthorTeam => b.details[:basionymAuthorTeam], :basionymAuthorTeam => a.details[:basionymAuthorTeam]}
end
end
- module OriginalAuthorsNamesFull2
- def left_bracket
+ module Authorship4
+ def a
elements[0]
end
def space
elements[1]
end
+ def b
+ elements[2]
+ end
+ end
+
+ module Authorship5
+ def value
+ a.value + " " + b.value
+ end
+
+ def pos
+ a.pos.merge(b.pos)
+ end
+
+ def details
+ val = a.details
+ val[:authorship] = text_value.strip
+ val[:basionymAuthorTeam].merge!(b.details)
+ val
+ end
+ end
+
+ def _nt_authorship
+ start_index = index
+ if node_cache[:authorship].has_key?(index)
+ cached = node_cache[:authorship][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_basionym_authorship_with_parenthesis
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ r4 = _nt_simple_authorship
+ s1 << r4
+ if r4
+ r5 = _nt_space
+ s1 << r5
+ if r5
+ r6 = _nt_ex_authorship
+ s1 << r6
+ end
+ end
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(Authorship0)
+ r1.extend(Authorship1)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ i7, s7 = index, []
+ r8 = _nt_basionym_authorship_with_parenthesis
+ s7 << r8
+ if r8
+ r9 = _nt_space
+ s7 << r9
+ if r9
+ r10 = _nt_simple_authorship
+ s7 << r10
+ end
+ end
+ if s7.last
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
+ r7.extend(Authorship2)
+ r7.extend(Authorship3)
+ else
+ self.index = i7
+ r7 = nil
+ end
+ if r7
+ r0 = r7
+ else
+ r11 = _nt_basionym_authorship_with_parenthesis
+ if r11
+ r0 = r11
+ else
+ i12, s12 = index, []
+ r13 = _nt_simple_authorship
+ s12 << r13
+ if r13
+ r14 = _nt_space
+ s12 << r14
+ if r14
+ r15 = _nt_ex_authorship
+ s12 << r15
+ end
+ end
+ if s12.last
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
+ r12.extend(Authorship4)
+ r12.extend(Authorship5)
+ else
+ self.index = i12
+ r12 = nil
+ end
+ if r12
+ r0 = r12
+ else
+ r16 = _nt_simple_authorship
+ if r16
+ r0 = r16
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+ end
+ end
+ end
+
+ node_cache[:authorship][start_index] = r0
+
+ return r0
+ end
+
+ module BasionymAuthorshipWithParenthesis0
+ def left_paren
+ elements[0]
+ end
+
+ def space
+ elements[1]
+ end
+
def a
elements[2]
end
def space
elements[3]
end
- def right_bracket
+ def right_paren
elements[4]
end
+
+ def space
+ elements[5]
+ end
+
+ def space
+ elements[7]
+ end
+
+ def b
+ elements[8]
+ end
end
- module OriginalAuthorsNamesFull3
+ module BasionymAuthorshipWithParenthesis1
def value
- "(" + a.value + ")"
+ "(" + a.value + " " + b.value + ")"
end
def pos
- a.pos
- end
+ a.pos.merge(b.pos)
+ end
def details
- {:orig_authors => a.details[:authors]}
+ { :authorship => text_value,
+ :basionymAuthorTeam => {:author_team => text_value}.merge(a.details).merge(b.details)
+ }
end
end
- module OriginalAuthorsNamesFull4
+ module BasionymAuthorshipWithParenthesis2
+ def left_paren
+ elements[0]
+ end
+
def space
elements[1]
end
def a
@@ -1300,28 +2485,42 @@
def space
elements[3]
end
+ def b
+ elements[4]
+ end
+
+ def space
+ elements[5]
+ end
+
+ def right_paren
+ elements[6]
+ end
end
- module OriginalAuthorsNamesFull5
+ module BasionymAuthorshipWithParenthesis3
def value
- "(" + a.value + ")"
+ "(" + a.value + " " + b.value + ")"
end
def pos
- a.pos
+ a.pos.merge(b.pos)
end
def details
- {:orig_authors => a.details[:authors]}
+ val = a.details
+ val[:basionymAuthorTeam].merge!(b.details)
+ val[:authorship] = text_value.strip
+ val
end
end
- module OriginalAuthorsNamesFull6
- def left_bracket
+ module BasionymAuthorshipWithParenthesis4
+ def left_paren
elements[0]
end
def space
elements[1]
@@ -1333,67 +2532,78 @@
def space
elements[3]
end
- def right_bracket
+ def right_paren
elements[4]
end
end
- module OriginalAuthorsNamesFull7
+ module BasionymAuthorshipWithParenthesis5
def value
"(" + a.value + ")"
end
def pos
a.pos
end
def details
- {:orig_authors => a.details[:authors]}
+ val = a.details
+ val[:authorship] = text_value
+ val
end
end
- module OriginalAuthorsNamesFull8
- def left_bracket
+ module BasionymAuthorshipWithParenthesis6
+ def left_paren
elements[0]
end
def space
elements[1]
end
+ def a
+ elements[2]
+ end
+
def space
elements[3]
end
- def right_bracket
+ def right_paren
elements[4]
end
end
- module OriginalAuthorsNamesFull9
+ module BasionymAuthorshipWithParenthesis7
def value
"(?)"
end
+
+ def pos
+ {a.interval.begin => ['unknown_author', a.interval.end]}
+ end
+
def details
- {:orig_authors => "unknown"}
+ {:authorship => text_value, :basionymAuthorTeam => {:authorTeam => text_value, :author => ['?']}}
end
end
- def _nt_original_authors_names_full
+ def _nt_basionym_authorship_with_parenthesis
start_index = index
- if node_cache[:original_authors_names_full].has_key?(index)
- cached = node_cache[:original_authors_names_full][index]
+ if node_cache[:basionym_authorship_with_parenthesis].has_key?(index)
+ cached = node_cache[:basionym_authorship_with_parenthesis][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
i1, s1 = index, []
- r2 = _nt_left_bracket
+ r2 = _nt_left_paren
s1 << r2
if r2
r3 = _nt_space
s1 << r3
if r3
@@ -1401,11 +2611,11 @@
s1 << r4
if r4
r5 = _nt_space
s1 << r5
if r5
- r6 = _nt_right_bracket
+ r6 = _nt_right_paren
s1 << r6
if r6
r7 = _nt_space
s1 << r7
if r7
@@ -1435,420 +2645,407 @@
end
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(OriginalAuthorsNamesFull0)
- r1.extend(OriginalAuthorsNamesFull1)
+ r1.extend(BasionymAuthorshipWithParenthesis0)
+ r1.extend(BasionymAuthorshipWithParenthesis1)
else
self.index = i1
r1 = nil
end
if r1
r0 = r1
else
i12, s12 = index, []
- r13 = _nt_left_bracket
+ r13 = _nt_left_paren
s12 << r13
if r13
r14 = _nt_space
s12 << r14
if r14
- r15 = _nt_authors_names_full
+ r15 = _nt_simple_authorship
s12 << r15
if r15
r16 = _nt_space
s12 << r16
if r16
- r17 = _nt_right_bracket
+ r17 = _nt_ex_authorship
s12 << r17
+ if r17
+ r18 = _nt_space
+ s12 << r18
+ if r18
+ r19 = _nt_right_paren
+ s12 << r19
+ end
+ end
end
end
end
end
if s12.last
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
- r12.extend(OriginalAuthorsNamesFull2)
- r12.extend(OriginalAuthorsNamesFull3)
+ r12.extend(BasionymAuthorshipWithParenthesis2)
+ r12.extend(BasionymAuthorshipWithParenthesis3)
else
self.index = i12
r12 = nil
end
if r12
r0 = r12
else
- i18, s18 = index, []
- if input.index("[", index) == index
- r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("[")
- r19 = nil
- end
- s18 << r19
- if r19
- r20 = _nt_space
- s18 << r20
- if r20
- r21 = _nt_authors_names_full
- s18 << r21
- if r21
- r22 = _nt_space
- s18 << r22
- if r22
- if input.index("]", index) == index
- r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("]")
- r23 = nil
- end
- s18 << r23
+ i20, s20 = index, []
+ r21 = _nt_left_paren
+ s20 << r21
+ if r21
+ r22 = _nt_space
+ s20 << r22
+ if r22
+ r23 = _nt_simple_authorship
+ s20 << r23
+ if r23
+ r24 = _nt_space
+ s20 << r24
+ if r24
+ r25 = _nt_right_paren
+ s20 << r25
end
end
end
end
- if s18.last
- r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
- r18.extend(OriginalAuthorsNamesFull4)
- r18.extend(OriginalAuthorsNamesFull5)
+ if s20.last
+ r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
+ r20.extend(BasionymAuthorshipWithParenthesis4)
+ r20.extend(BasionymAuthorshipWithParenthesis5)
else
- self.index = i18
- r18 = nil
+ self.index = i20
+ r20 = nil
end
- if r18
- r0 = r18
+ if r20
+ r0 = r20
else
- i24, s24 = index, []
- r25 = _nt_left_bracket
- s24 << r25
- if r25
- r26 = _nt_space
- s24 << r26
- if r26
- r27 = _nt_unknown_auth
- s24 << r27
- if r27
- r28 = _nt_space
- s24 << r28
- if r28
- r29 = _nt_right_bracket
- s24 << r29
+ i26, s26 = index, []
+ r27 = _nt_left_paren
+ s26 << r27
+ if r27
+ r28 = _nt_space
+ s26 << r28
+ if r28
+ if input.index("?", index) == index
+ r29 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("?")
+ r29 = nil
+ end
+ s26 << r29
+ if r29
+ r30 = _nt_space
+ s26 << r30
+ if r30
+ r31 = _nt_right_paren
+ s26 << r31
end
end
end
end
- if s24.last
- r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
- r24.extend(OriginalAuthorsNamesFull6)
- r24.extend(OriginalAuthorsNamesFull7)
+ if s26.last
+ r26 = instantiate_node(SyntaxNode,input, i26...index, s26)
+ r26.extend(BasionymAuthorshipWithParenthesis6)
+ r26.extend(BasionymAuthorshipWithParenthesis7)
else
- self.index = i24
- r24 = nil
+ self.index = i26
+ r26 = nil
end
- if r24
- r0 = r24
+ if r26
+ r0 = r26
else
- i30, s30 = index, []
- r31 = _nt_left_bracket
- s30 << r31
- if r31
- r32 = _nt_space
- s30 << r32
- if r32
- if input.index("?", index) == index
- r33 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("?")
- r33 = nil
- end
- s30 << r33
- if r33
- r34 = _nt_space
- s30 << r34
- if r34
- r35 = _nt_right_bracket
- s30 << r35
- end
- end
- end
- end
- if s30.last
- r30 = instantiate_node(SyntaxNode,input, i30...index, s30)
- r30.extend(OriginalAuthorsNamesFull8)
- r30.extend(OriginalAuthorsNamesFull9)
- else
- self.index = i30
- r30 = nil
- end
- if r30
- r0 = r30
- else
- self.index = i0
- r0 = nil
- end
+ self.index = i0
+ r0 = nil
end
end
end
end
- node_cache[:original_authors_names_full][start_index] = r0
+ node_cache[:basionym_authorship_with_parenthesis][start_index] = r0
return r0
end
- module OriginalAuthorsRevisedName0
- def left_bracket
+ module ExAuthorship0
+ def ex_sep
elements[0]
end
def space
elements[1]
end
- def a
+ def b
elements[2]
end
-
- def space
- elements[3]
- end
-
- def right_bracket
- elements[4]
- end
end
- module OriginalAuthorsRevisedName1
+ module ExAuthorship1
def value
- "(" + a.value + ")"
+ " ex " + b.value
end
def pos
- a.pos
+ b.pos
end
def details
- {:original_revised_name_authors => a.details[:revised_name_authors]}
+ val = {:exAuthorTeam => {:authorTeam => b.text_value.strip}.merge(b.details[:basionymAuthorTeam])}
+ val
end
end
- def _nt_original_authors_revised_name
+ def _nt_ex_authorship
start_index = index
- if node_cache[:original_authors_revised_name].has_key?(index)
- cached = node_cache[:original_authors_revised_name][index]
+ if node_cache[:ex_authorship].has_key?(index)
+ cached = node_cache[:ex_authorship][index]
@index = cached.interval.end if cached
return cached
end
i0, s0 = index, []
- r1 = _nt_left_bracket
+ r1 = _nt_ex_sep
s0 << r1
if r1
r2 = _nt_space
s0 << r2
if r2
- r3 = _nt_authors_revised_name
+ r3 = _nt_simple_authorship
s0 << r3
- if r3
- r4 = _nt_space
- s0 << r4
- if r4
- r5 = _nt_right_bracket
- s0 << r5
- end
- end
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(OriginalAuthorsRevisedName0)
- r0.extend(OriginalAuthorsRevisedName1)
+ r0.extend(ExAuthorship0)
+ r0.extend(ExAuthorship1)
else
self.index = i0
r0 = nil
end
- node_cache[:original_authors_revised_name][start_index] = r0
+ node_cache[:ex_authorship][start_index] = r0
return r0
end
- module AuthorsRevisedName0
+ module SimpleAuthorship0
def a
elements[0]
end
def space
elements[1]
end
- def ex_sep
- elements[2]
- end
-
def space
elements[3]
end
def b
elements[4]
end
end
- module AuthorsRevisedName1
+ module SimpleAuthorship1
def value
- a.value + " ex " + b.value
+ a.value + " " + b.value
end
def pos
a.pos.merge(b.pos)
end
def details
- {:revised_name_authors =>{:revised_authors => a.details[:authors], :authors => b.details[:authors]}}
+ details_with_arg(:basionymAuthorTeam)
end
+
+ def details_with_arg(authorTeamType = 'basionymAuthorTeam')
+ { :authorship => text_value,
+ authorTeamType.to_sym => {
+ :authorTeam => a.text_value.strip
+ }.merge(a.details).merge(b.details)
+ }
+ end
end
- def _nt_authors_revised_name
+ module SimpleAuthorship2
+ def details
+ details = details_with_arg(:basionymAuthorTeam)
+ details[:basionymAuthorTeam].merge!(super)
+ details
+ end
+
+ def details_with_arg(authorTeamType = 'basionymAuthorTeam')
+ { :authorship => text_value,
+ authorTeamType.to_sym => {
+ :authorTeam => text_value,
+ }
+ }
+ end
+ end
+
+ def _nt_simple_authorship
start_index = index
- if node_cache[:authors_revised_name].has_key?(index)
- cached = node_cache[:authors_revised_name][index]
+ if node_cache[:simple_authorship].has_key?(index)
+ cached = node_cache[:simple_authorship][index]
@index = cached.interval.end if cached
return cached
end
- i0, s0 = index, []
- r1 = _nt_authors_names_full
- s0 << r1
- if r1
- r2 = _nt_space
- s0 << r2
- if r2
- r3 = _nt_ex_sep
- s0 << r3
- if r3
- r4 = _nt_space
- s0 << r4
- if r4
- r5 = _nt_authors_names_full
- s0 << r5
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_authors_names
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ if input.index(Regexp.new('[,]'), index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r5 = nil
+ end
+ if r5
+ r4 = r5
+ else
+ r4 = instantiate_node(SyntaxNode,input, index...index)
+ end
+ s1 << r4
+ if r4
+ r6 = _nt_space
+ s1 << r6
+ if r6
+ r7 = _nt_year
+ s1 << r7
end
end
end
end
- if s0.last
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(AuthorsRevisedName0)
- r0.extend(AuthorsRevisedName1)
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(SimpleAuthorship0)
+ r1.extend(SimpleAuthorship1)
else
- self.index = i0
- r0 = nil
+ self.index = i1
+ r1 = nil
end
+ if r1
+ r0 = r1
+ else
+ r8 = _nt_authors_names
+ r8.extend(SimpleAuthorship2)
+ if r8
+ r0 = r8
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
- node_cache[:authors_revised_name][start_index] = r0
+ node_cache[:simple_authorship][start_index] = r0
return r0
end
- module AuthorsNamesFull0
+ module AuthorsNames0
def a
elements[0]
end
def space
elements[1]
end
+ def sep
+ elements[2]
+ end
+
def space
elements[3]
end
def b
elements[4]
end
end
- module AuthorsNamesFull1
- def value
- a.value + " " + b.value
+ module AuthorsNames1
+ def value
+ sep.apply(a,b)
end
def pos
- a.pos.merge(b.pos)
+ sep.pos(a,b)
end
def details
- {:authors => {:names => a.details[:authors][:names]}.merge(b.details)}
+ sep.details(a,b)
end
end
- def _nt_authors_names_full
+ def _nt_authors_names
start_index = index
- if node_cache[:authors_names_full].has_key?(index)
- cached = node_cache[:authors_names_full][index]
+ if node_cache[:authors_names].has_key?(index)
+ cached = node_cache[:authors_names][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
i1, s1 = index, []
- r2 = _nt_authors_names
+ r2 = _nt_author_name
s1 << r2
if r2
r3 = _nt_space
s1 << r3
if r3
- if input.index(Regexp.new('[,]'), index) == index
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- r5 = nil
- end
- if r5
- r4 = r5
- else
- r4 = instantiate_node(SyntaxNode,input, index...index)
- end
+ r4 = _nt_author_separator
s1 << r4
if r4
- r6 = _nt_space
- s1 << r6
- if r6
- r7 = _nt_year
- s1 << r7
+ r5 = _nt_space
+ s1 << r5
+ if r5
+ r6 = _nt_authors_names
+ s1 << r6
end
end
end
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(AuthorsNamesFull0)
- r1.extend(AuthorsNamesFull1)
+ r1.extend(AuthorsNames0)
+ r1.extend(AuthorsNames1)
else
self.index = i1
r1 = nil
end
if r1
r0 = r1
else
- r8 = _nt_authors_names
- if r8
- r0 = r8
+ r7 = _nt_author_name
+ if r7
+ r0 = r7
else
- r9 = _nt_unknown_auth
- if r9
- r0 = r9
+ r8 = _nt_unknown_auth
+ if r8
+ r0 = r8
else
self.index = i0
r0 = nil
end
end
end
- node_cache[:authors_names_full][start_index] = r0
+ node_cache[:authors_names][start_index] = r0
return r0
end
module UnknownAuth0
@@ -1859,11 +3056,11 @@
def pos
{interval.begin => ['unknown_author', interval.end]}
end
def details
- {:authors => "unknown"}
+ {:author => ["unknown"]}
end
end
def _nt_unknown_auth
start_index = index
@@ -1928,139 +3125,78 @@
node_cache[:unknown_auth][start_index] = r0
return r0
end
+ module ExSep0
+ end
+
def _nt_ex_sep
start_index = index
if node_cache[:ex_sep].has_key?(index)
cached = node_cache[:ex_sep][index]
@index = cached.interval.end if cached
return cached
end
- i0 = index
+ i0, s0 = index, []
+ i1 = index
if input.index("ex", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
@index += 2
else
terminal_parse_failure("ex")
- r1 = nil
+ r2 = nil
end
- if r1
- r0 = r1
+ if r2
+ r1 = r2
else
if input.index("in", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
@index += 2
else
terminal_parse_failure("in")
- r2 = nil
+ r3 = nil
end
- if r2
- r0 = r2
+ if r3
+ r1 = r3
else
- self.index = i0
- r0 = nil
+ self.index = i1
+ r1 = nil
end
end
-
- node_cache[:ex_sep][start_index] = r0
-
- return r0
- end
-
- module AuthorsNames0
- def a
- elements[0]
- end
-
- def space
- elements[1]
- end
-
- def sep
- elements[2]
- end
-
- def space
- elements[3]
- end
-
- def b
- elements[4]
- end
- end
-
- module AuthorsNames1
- def value
- sep.apply(a,b)
- end
-
- def pos
- sep.pos(a,b)
- end
-
- def details
- sep.details(a,b)
- end
- end
-
- def _nt_authors_names
- start_index = index
- if node_cache[:authors_names].has_key?(index)
- cached = node_cache[:authors_names][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- i1, s1 = index, []
- r2 = _nt_author_name
- s1 << r2
- if r2
- r3 = _nt_space
- s1 << r3
- if r3
- r4 = _nt_author_name_separator
- s1 << r4
- if r4
- r5 = _nt_space
- s1 << r5
- if r5
- r6 = _nt_authors_names
- s1 << r6
- end
- end
- end
- end
- if s1.last
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(AuthorsNames0)
- r1.extend(AuthorsNames1)
- else
- self.index = i1
- r1 = nil
- end
+ s0 << r1
if r1
- r0 = r1
- else
- r7 = _nt_author_name
- if r7
- r0 = r7
+ i4 = index
+ if input.index(Regexp.new('[\\s]'), index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- self.index = i0
- r0 = nil
+ r5 = nil
end
+ if r5
+ self.index = i4
+ r4 = instantiate_node(SyntaxNode,input, index...index)
+ else
+ r4 = nil
+ end
+ s0 << r4
end
+ if s0.last
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
+ r0.extend(ExSep0)
+ else
+ self.index = i0
+ r0 = nil
+ end
- node_cache[:authors_names][start_index] = r0
+ node_cache[:ex_sep][start_index] = r0
return r0
end
- module AuthorNameSeparator0
+ module AuthorSeparator0
def apply(a,b)
sep = text_value.strip
sep = " et" if ["&","and","et"].include? sep
a.value + sep + " " + b.value
end
@@ -2068,18 +3204,18 @@
def pos(a,b)
a.pos.merge(b.pos)
end
def details(a,b)
- {:authors => {:names => a.details[:authors][:names] + b.details[:authors][:names]}}
+ {:author => a.details[:author] + b.details[:author]}
end
end
- def _nt_author_name_separator
+ def _nt_author_separator
start_index = index
- if node_cache[:author_name_separator].has_key?(index)
- cached = node_cache[:author_name_separator][index]
+ if node_cache[:author_separator].has_key?(index)
+ cached = node_cache[:author_separator][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
@@ -2090,53 +3226,53 @@
terminal_parse_failure("&")
r1 = nil
end
if r1
r0 = r1
- r0.extend(AuthorNameSeparator0)
+ r0.extend(AuthorSeparator0)
else
if input.index(",", index) == index
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure(",")
r2 = nil
end
if r2
r0 = r2
- r0.extend(AuthorNameSeparator0)
+ r0.extend(AuthorSeparator0)
else
if input.index("and", index) == index
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
@index += 3
else
terminal_parse_failure("and")
r3 = nil
end
if r3
r0 = r3
- r0.extend(AuthorNameSeparator0)
+ r0.extend(AuthorSeparator0)
else
if input.index("et", index) == index
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
@index += 2
else
terminal_parse_failure("et")
r4 = nil
end
if r4
r0 = r4
- r0.extend(AuthorNameSeparator0)
+ r0.extend(AuthorSeparator0)
else
self.index = i0
r0 = nil
end
end
end
end
- node_cache[:author_name_separator][start_index] = r0
+ node_cache[:author_separator][start_index] = r0
return r0
end
module AuthorName0
@@ -2169,14 +3305,50 @@
def pos
a.pos.merge(b.pos)
end
def details
- {:authors => {:names => [value]}}
+ {:author => [value]}
end
end
+ module AuthorName2
+ def space
+ elements[0]
+ end
+
+ def a
+ elements[1]
+ end
+
+ def space
+ elements[2]
+ end
+
+ def b
+ elements[3]
+ end
+
+ def space
+ elements[4]
+ end
+ end
+
+ module AuthorName3
+ def value
+ a.value + " " + b.value
+ end
+
+ def pos
+ a.pos.merge(b.pos)
+ end
+
+ def details
+ {:author => [value]}
+ end
+ end
+
def _nt_author_name
start_index = index
if node_cache[:author_name].has_key?(index)
cached = node_cache[:author_name][index]
@index = cached.interval.end if cached
@@ -2186,11 +3358,11 @@
i0 = index
i1, s1 = index, []
r2 = _nt_space
s1 << r2
if r2
- r3 = _nt_author_word
+ r3 = _nt_author_prefix_word
s1 << r3
if r3
r4 = _nt_space
s1 << r4
if r4
@@ -2212,16 +3384,47 @@
r1 = nil
end
if r1
r0 = r1
else
- r7 = _nt_author_word
+ i7, s7 = index, []
+ r8 = _nt_space
+ s7 << r8
+ if r8
+ r9 = _nt_author_word
+ s7 << r9
+ if r9
+ r10 = _nt_space
+ s7 << r10
+ if r10
+ r11 = _nt_author_name
+ s7 << r11
+ if r11
+ r12 = _nt_space
+ s7 << r12
+ end
+ end
+ end
+ end
+ if s7.last
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
+ r7.extend(AuthorName2)
+ r7.extend(AuthorName3)
+ else
+ self.index = i7
+ r7 = nil
+ end
if r7
r0 = r7
else
- self.index = i0
- r0 = nil
+ r13 = _nt_author_word
+ if r13
+ r0 = r13
+ else
+ self.index = i0
+ r0 = nil
+ end
end
end
node_cache[:author_name][start_index] = r0
@@ -2236,11 +3439,11 @@
def pos
{interval.begin => ['author_word', 1], (interval.begin + 2) => ['author_word', 2], (interval.begin + 5) => ['author_word', 2]}
end
def details
- {:authors => {:names => [value]}}
+ {:author => [value]}
end
end
module AuthorWord1
def value
@@ -2251,31 +3454,48 @@
#cheating because there are several words in some of them
{interval.begin => ['author_word', interval.end]}
end
def details
- {:authors => {:names => [value]}}
+ {:author => [value]}
end
end
module AuthorWord2
end
module AuthorWord3
def value
- text_value.gsub(/\s+/, " ").strip
+ text_value
end
def pos
{interval.begin => ['author_word', interval.end]}
end
def details
- {:authors => {:names => [value]}}
+ {:author => [value]}
end
end
+ module AuthorWord4
+ end
+
+ module AuthorWord5
+ def value
+ text_value
+ end
+
+ def pos
+ {interval.begin => ['author_word', interval.end]}
+ end
+
+ def details
+ {:author => [value]}
+ end
+ end
+
def _nt_author_word
start_index = index
if node_cache[:author_word].has_key?(index)
cached = node_cache[:author_word][index]
@index = cached.interval.end if cached
@@ -2293,226 +3513,206 @@
end
if r1
r0 = r1
else
i2 = index
- if input.index("anon.", index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
+ if input.index("bis", index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure("anon.")
+ terminal_parse_failure("bis")
r3 = nil
end
if r3
r2 = r3
r2.extend(AuthorWord1)
else
- if input.index("f.", index) == index
- r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
+ if input.index("arg.", index) == index
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 4))
+ @index += 4
else
- terminal_parse_failure("f.")
+ terminal_parse_failure("arg.")
r4 = nil
end
if r4
r2 = r4
r2.extend(AuthorWord1)
else
- if input.index("bis", index) == index
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
+ if input.index("et al.\{\?\}", index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 9))
+ @index += 9
else
- terminal_parse_failure("bis")
+ terminal_parse_failure("et al.\{\?\}")
r5 = nil
end
if r5
r2 = r5
r2.extend(AuthorWord1)
else
- if input.index("arg.", index) == index
- r6 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
+ if input.index("et al.", index) == index
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 6))
+ @index += 6
else
- terminal_parse_failure("arg.")
+ terminal_parse_failure("et al.")
r6 = nil
end
if r6
r2 = r6
r2.extend(AuthorWord1)
else
- r7 = _nt_author_prefix
- if r7
- r2 = r7
- r2.extend(AuthorWord1)
- else
- if input.index("et al.\{\?\}", index) == index
- r8 = instantiate_node(SyntaxNode,input, index...(index + 9))
- @index += 9
- else
- terminal_parse_failure("et al.\{\?\}")
- r8 = nil
- end
- if r8
- r2 = r8
- r2.extend(AuthorWord1)
- else
- if input.index("et al.", index) == index
- r9 = instantiate_node(SyntaxNode,input, index...(index + 6))
- @index += 6
- else
- terminal_parse_failure("et al.")
- r9 = nil
- end
- if r9
- r2 = r9
- r2.extend(AuthorWord1)
- else
- self.index = i2
- r2 = nil
- end
- end
- end
+ self.index = i2
+ r2 = nil
end
end
end
end
if r2
r0 = r2
else
- i10, s10 = index, []
- i11 = index
+ i7, s7 = index, []
+ i8 = index
if input.index("Å", index) == index
- r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Å")
- r12 = nil
+ r9 = nil
end
- if r12
- r11 = r12
+ if r9
+ r8 = r9
else
if input.index("Ö", index) == index
- r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ö")
- r13 = nil
+ r10 = nil
end
- if r13
- r11 = r13
+ if r10
+ r8 = r10
else
if input.index("Á", index) == index
- r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Á")
- r14 = nil
+ r11 = nil
end
- if r14
- r11 = r14
+ if r11
+ r8 = r11
else
if input.index("Ø", index) == index
- r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ø")
- r15 = nil
+ r12 = nil
end
- if r15
- r11 = r15
+ if r12
+ r8 = r12
else
if input.index("Ô", index) == index
- r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ô")
- r16 = nil
+ r13 = nil
end
- if r16
- r11 = r16
+ if r13
+ r8 = r13
else
if input.index("Š", index) == index
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Š")
- r17 = nil
+ r14 = nil
end
- if r17
- r11 = r17
+ if r14
+ r8 = r14
else
if input.index("Ś", index) == index
- r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ś")
- r18 = nil
+ r15 = nil
end
- if r18
- r11 = r18
+ if r15
+ r8 = r15
else
if input.index("Č", index) == index
- r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Č")
- r19 = nil
+ r16 = nil
end
- if r19
- r11 = r19
+ if r16
+ r8 = r16
else
if input.index("Ķ", index) == index
- r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ķ")
- r20 = nil
+ r17 = nil
end
- if r20
- r11 = r20
+ if r17
+ r8 = r17
else
if input.index("Ł", index) == index
- r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ł")
- r21 = nil
+ r18 = nil
end
- if r21
- r11 = r21
+ if r18
+ r8 = r18
else
if input.index("É", index) == index
- r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("É")
- r22 = nil
+ r19 = nil
end
- if r22
- r11 = r22
+ if r19
+ r8 = r19
else
if input.index("Ž", index) == index
- r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure("Ž")
- r23 = nil
+ r20 = nil
end
- if r23
- r11 = r23
+ if r20
+ r8 = r20
else
- if input.index(Regexp.new('[A-Z]'), index) == index
- r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ if input.index(Regexp.new('[A-W]'), index) == index
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
- r24 = nil
+ r21 = nil
end
- if r24
- r11 = r24
+ if r21
+ r8 = r21
else
- self.index = i11
- r11 = nil
+ if input.index(Regexp.new('[Y-Z]'), index) == index
+ r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r22 = nil
+ end
+ if r22
+ r8 = r22
+ else
+ self.index = i8
+ r8 = nil
+ end
end
end
end
end
end
@@ -2522,1876 +3722,259 @@
end
end
end
end
end
- s10 << r11
- if r11
- s25, i25 = [], index
+ s7 << r8
+ if r8
+ s23, i23 = [], index
loop do
- if input.index(Regexp.new('[^0-9()\\s&,]'), index) == index
- r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ if input.index(Regexp.new('[^0-9\\[\\]\\(\\)\\s&,]'), index) == index
+ r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
- r26 = nil
+ r24 = nil
end
- if r26
- s25 << r26
+ if r24
+ s23 << r24
else
break
end
end
- if s25.empty?
- self.index = i25
- r25 = nil
- else
- r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
- end
- s10 << r25
+ r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
+ s7 << r23
end
- if s10.last
- r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
- r10.extend(AuthorWord2)
- r10.extend(AuthorWord3)
+ if s7.last
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
+ r7.extend(AuthorWord2)
+ r7.extend(AuthorWord3)
else
- self.index = i10
- r10 = nil
+ self.index = i7
+ r7 = nil
end
- if r10
- r0 = r10
+ if r7
+ r0 = r7
else
- self.index = i0
- r0 = nil
- end
- end
- end
-
- node_cache[:author_word][start_index] = r0
-
- return r0
- end
-
- def _nt_author_prefix
- start_index = index
- if node_cache[:author_prefix].has_key?(index)
- cached = node_cache[:author_prefix][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- if input.index("da", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("da")
- r1 = nil
- end
- if r1
- r0 = r1
- else
- if input.index("der", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
- else
- terminal_parse_failure("der")
- r2 = nil
- end
- if r2
- r0 = r2
- else
- if input.index("den", index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
- else
- terminal_parse_failure("den")
- r3 = nil
- end
- if r3
- r0 = r3
- else
- if input.index("de", index) == index
- r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
+ i25, s25 = index, []
+ if input.index("X", index) == index
+ r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure("de")
- r4 = nil
+ terminal_parse_failure("X")
+ r26 = nil
end
- if r4
- r0 = r4
- else
- if input.index("du", index) == index
- r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("du")
- r5 = nil
- end
- if r5
- r0 = r5
- else
- if input.index("la", index) == index
- r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
+ s25 << r26
+ if r26
+ s27, i27 = [], index
+ loop do
+ if input.index(Regexp.new('[^0-9\\[\\]\\(\\)\\s&,]'), index) == index
+ r28 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure("la")
- r6 = nil
+ r28 = nil
end
- if r6
- r0 = r6
+ if r28
+ s27 << r28
else
- if input.index("ter", index) == index
- r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
- else
- terminal_parse_failure("ter")
- r7 = nil
- end
- if r7
- r0 = r7
- else
- if input.index("van", index) == index
- r8 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
- else
- terminal_parse_failure("van")
- r8 = nil
- end
- if r8
- r0 = r8
- else
- self.index = i0
- r0 = nil
- end
- end
+ break
end
end
- end
- end
- end
- end
-
- node_cache[:author_prefix][start_index] = r0
-
- return r0
- end
-
- module NamePart0
- def space
- elements[0]
- end
-
- def a
- elements[1]
- end
-
- def space
- elements[2]
- end
-
- def b
- elements[3]
- end
-
- def space_hard
- elements[4]
- end
-
- def c
- elements[5]
- end
- end
-
- module NamePart1
- def value
- a.value + " " + b.value + " " + c.value
- end
- def canonical
- a.canonical
- end
-
- def pos
- a.pos
- end
-
- def details
- a.details.merge(b.details).merge(c.details)
- end
- end
-
- module NamePart2
- def space
- elements[0]
- end
-
- def author_prefix
- elements[1]
- end
- end
-
- module NamePart3
- def space
- elements[0]
- end
-
- def a
- elements[1]
- end
-
- end
-
- module NamePart4
- def value
- a.value
- end
-
- def canonical
- a.canonical
- end
-
- def pos
- a.pos
- end
-
- def details
- a.details
- end
- end
-
- module NamePart5
- def space
- elements[0]
- end
-
- def a
- elements[1]
- end
-
- def space
- elements[2]
- end
-
- def b
- elements[3]
- end
- end
-
- module NamePart6
- def value
- a.value + b.value
- end
- def canonical
- a.canonical + b.canonical
- end
-
- def pos
- a.pos.merge(b.pos)
- end
-
- def details
- a.details.merge(b.details)
- end
- end
-
- module NamePart7
- def space
- elements[0]
- end
-
- def a
- elements[1]
- end
-
- def space
- elements[2]
- end
-
- def b
- elements[3]
- end
-
- end
-
- module NamePart8
- def value
- a.value + " " + b.value
- end
-
- def canonical
- a.canonical + " " + b.value
- end
-
- def pos
- a.pos.merge({b.interval.begin => ['subspecies', b.interval.end]})
- end
-
- def details
- a.details.merge({:subspecies => {:rank => "n/a", :value =>b.value}})
- end
- end
-
- def _nt_name_part
- start_index = index
- if node_cache[:name_part].has_key?(index)
- cached = node_cache[:name_part][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- i1, s1 = index, []
- r2 = _nt_space
- s1 << r2
- if r2
- r3 = _nt_species_name
- s1 << r3
- if r3
- r4 = _nt_space
- s1 << r4
- if r4
- r5 = _nt_rank
- s1 << r5
- if r5
- r6 = _nt_space_hard
- s1 << r6
- if r6
- r7 = _nt_editorials_full
- s1 << r7
+ if s27.empty?
+ self.index = i27
+ r27 = nil
+ else
+ r27 = instantiate_node(SyntaxNode,input, i27...index, s27)
end
+ s25 << r27
end
- end
- end
- end
- if s1.last
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(NamePart0)
- r1.extend(NamePart1)
- else
- self.index = i1
- r1 = nil
- end
- if r1
- r0 = r1
- else
- i8, s8 = index, []
- r9 = _nt_space
- s8 << r9
- if r9
- r10 = _nt_species_name
- s8 << r10
- if r10
- i11 = index
- i12, s12 = index, []
- r13 = _nt_space
- s12 << r13
- if r13
- r14 = _nt_author_prefix
- s12 << r14
- end
- if s12.last
- r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
- r12.extend(NamePart2)
+ if s25.last
+ r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
+ r25.extend(AuthorWord4)
+ r25.extend(AuthorWord5)
else
- self.index = i12
- r12 = nil
+ self.index = i25
+ r25 = nil
end
- if r12
- self.index = i11
- r11 = instantiate_node(SyntaxNode,input, index...index)
+ if r25
+ r0 = r25
else
- r11 = nil
- end
- s8 << r11
- end
- end
- if s8.last
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
- r8.extend(NamePart3)
- r8.extend(NamePart4)
- else
- self.index = i8
- r8 = nil
- end
- if r8
- r0 = r8
- else
- i15, s15 = index, []
- r16 = _nt_space
- s15 << r16
- if r16
- r17 = _nt_species_name
- s15 << r17
- if r17
- r18 = _nt_space
- s15 << r18
- if r18
- r19 = _nt_subspecies_names
- s15 << r19
- end
- end
- end
- if s15.last
- r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
- r15.extend(NamePart5)
- r15.extend(NamePart6)
- else
- self.index = i15
- r15 = nil
- end
- if r15
- r0 = r15
- else
- i20, s20 = index, []
- r21 = _nt_space
- s20 << r21
- if r21
- r22 = _nt_species_name
- s20 << r22
- if r22
- r23 = _nt_space
- s20 << r23
- if r23
- r24 = _nt_latin_word
- s20 << r24
- if r24
- i25 = index
- if input.index(Regexp.new('[\\.]'), index) == index
- r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- r26 = nil
- end
- if r26
- r25 = nil
- else
- self.index = i25
- r25 = instantiate_node(SyntaxNode,input, index...index)
- end
- s20 << r25
- end
- end
- end
- end
- if s20.last
- r20 = instantiate_node(SyntaxNode,input, i20...index, s20)
- r20.extend(NamePart7)
- r20.extend(NamePart8)
- else
- self.index = i20
- r20 = nil
- end
- if r20
- r0 = r20
- else
- r27 = _nt_species_name
- if r27
- r0 = r27
+ r29 = _nt_author_prefix_word
+ if r29
+ r0 = r29
else
- r28 = _nt_cap_latin_word
- if r28
- r0 = r28
- else
- self.index = i0
- r0 = nil
- end
+ self.index = i0
+ r0 = nil
end
end
end
end
end
- node_cache[:name_part][start_index] = r0
+ node_cache[:author_word][start_index] = r0
return r0
end
- module SubspeciesNames0
- def a
+ module AuthorPrefixWord0
+ def space
elements[0]
end
- def space
- elements[1]
- end
-
- def b
- elements[2]
- end
end
- module SubspeciesNames1
+ module AuthorPrefixWord1
def value
- a.value + b.value
+ text_value
end
- def canonical
- a.canonical + b.canonical
- end
-
def pos
- a.pos.merge(b.pos)
+ #cheating because there are several words in some of them
+ {interval.begin => ['author_word', interval.end]}
end
-
- def details
- c = a.details[:subspecies] + b.details_subspecies
- a.details.merge({:subspecies => c, :is_valid => false})
- end
end
- def _nt_subspecies_names
+ def _nt_author_prefix_word
start_index = index
- if node_cache[:subspecies_names].has_key?(index)
- cached = node_cache[:subspecies_names][index]
+ if node_cache[:author_prefix_word].has_key?(index)
+ cached = node_cache[:author_prefix_word][index]
@index = cached.interval.end if cached
return cached
end
- i0 = index
- i1, s1 = index, []
- r2 = _nt_subspecies_name
- s1 << r2
- if r2
- r3 = _nt_space
- s1 << r3
- if r3
- r4 = _nt_subspecies_names
- s1 << r4
- end
- end
- if s1.last
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(SubspeciesNames0)
- r1.extend(SubspeciesNames1)
- else
- self.index = i1
- r1 = nil
- end
- if r1
- r0 = r1
- else
- r5 = _nt_subspecies_name
- if r5
- r0 = r5
- else
- self.index = i0
- r0 = nil
- end
- end
-
- node_cache[:subspecies_names][start_index] = r0
-
- return r0
- end
-
- module SubspeciesName0
- def sel
- elements[0]
- end
-
- def space_hard
- elements[1]
- end
-
- def a
- elements[2]
- end
- end
-
- module SubspeciesName1
- def value
- sel.apply(a)
- end
- def canonical
- sel.canonical(a)
- end
-
- def pos
- {a.interval.begin => ['subspecies', a.interval.end]}
- end
- def details
- sel.details(a)
- end
- def details_subspecies
- details[:subspecies]
- end
- end
-
- def _nt_subspecies_name
- start_index = index
- if node_cache[:subspecies_name].has_key?(index)
- cached = node_cache[:subspecies_name][index]
- @index = cached.interval.end if cached
- return cached
- end
-
i0, s0 = index, []
- r1 = _nt_rank
+ r1 = _nt_space
s0 << r1
if r1
- r2 = _nt_space_hard
- s0 << r2
- if r2
- r3 = _nt_latin_word
- s0 << r3
- end
- end
- if s0.last
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(SubspeciesName0)
- r0.extend(SubspeciesName1)
- else
- self.index = i0
- r0 = nil
- end
-
- node_cache[:subspecies_name][start_index] = r0
-
- return r0
- end
-
- module EditorialsFull0
- def space
- elements[1]
- end
-
- def a
- elements[2]
- end
-
- def space
- elements[3]
- end
-
- end
-
- module EditorialsFull1
- def value
- "(" + a.value + ")"
- end
- def details
- {:editorial_markup => value, :is_valid => false}
- end
- end
-
- def _nt_editorials_full
- start_index = index
- if node_cache[:editorials_full].has_key?(index)
- cached = node_cache[:editorials_full][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0, s0 = index, []
- if input.index("(", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("(")
- r1 = nil
- end
- s0 << r1
- if r1
- r2 = _nt_space
- s0 << r2
- if r2
- r3 = _nt_editorials
- s0 << r3
- if r3
- r4 = _nt_space
- s0 << r4
- if r4
- if input.index(")", index) == index
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure(")")
- r5 = nil
- end
- s0 << r5
- end
- end
- end
- end
- if s0.last
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(EditorialsFull0)
- r0.extend(EditorialsFull1)
- else
- self.index = i0
- r0 = nil
- end
-
- node_cache[:editorials_full][start_index] = r0
-
- return r0
- end
-
- module Editorials0
- def space
- elements[0]
- end
-
- def a
- elements[1]
- end
-
- def space
- elements[2]
- end
-
- def space
- elements[4]
- end
-
- def b
- elements[5]
- end
- end
-
- module Editorials1
- def value
- a.value + b.value
- end
- def details
- {:editorial_markup => value, :is_valid => false}
- end
- end
-
- def _nt_editorials
- start_index = index
- if node_cache[:editorials].has_key?(index)
- cached = node_cache[:editorials][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- i1, s1 = index, []
- r2 = _nt_space
- s1 << r2
- if r2
- r3 = _nt_rank
- s1 << r3
- if r3
- r4 = _nt_space
- s1 << r4
- if r4
- if input.index(Regexp.new('[&]'), index) == index
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- r6 = nil
- end
- if r6
- r5 = r6
- else
- r5 = instantiate_node(SyntaxNode,input, index...index)
- end
- s1 << r5
- if r5
- r7 = _nt_space
- s1 << r7
- if r7
- r8 = _nt_editorials
- s1 << r8
- end
- end
- end
- end
- end
- if s1.last
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(Editorials0)
- r1.extend(Editorials1)
- else
- self.index = i1
- r1 = nil
- end
- if r1
- r0 = r1
- else
- r9 = _nt_rank
- if r9
- r0 = r9
+ i2 = index
+ if input.index("da", index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- self.index = i0
- r0 = nil
- end
- end
-
- node_cache[:editorials][start_index] = r0
-
- return r0
- end
-
- module Rank0
- def value
- text_value.strip
- end
- def apply(a)
- " " + text_value + " " + a.value
- end
- def canonical(a)
- " " + a.value
- end
- def details(a = nil)
- {:subspecies => [{:rank => text_value, :value => (a.value rescue nil)}]}
- end
- end
-
- def _nt_rank
- start_index = index
- if node_cache[:rank].has_key?(index)
- cached = node_cache[:rank][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- i1 = index
- if input.index("morph.", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
- @index += 6
- else
- terminal_parse_failure("morph.")
- r2 = nil
- end
- if r2
- r1 = r2
- r1.extend(Rank0)
- else
- if input.index("f.sp.", index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
- else
- terminal_parse_failure("f.sp.")
+ terminal_parse_failure("da")
r3 = nil
end
if r3
- r1 = r3
- r1.extend(Rank0)
+ r2 = r3
else
- if input.index("B", index) == index
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
+ if input.index("der", index) == index
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure("B")
+ terminal_parse_failure("der")
r4 = nil
end
if r4
- r1 = r4
- r1.extend(Rank0)
+ r2 = r4
else
- if input.index("ssp.", index) == index
- r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
+ if input.index("den", index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure("ssp.")
+ terminal_parse_failure("den")
r5 = nil
end
if r5
- r1 = r5
- r1.extend(Rank0)
+ r2 = r5
else
- if input.index("nat", index) == index
- r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
+ if input.index("de", index) == index
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- terminal_parse_failure("nat")
+ terminal_parse_failure("de")
r6 = nil
end
if r6
- r1 = r6
- r1.extend(Rank0)
+ r2 = r6
else
- if input.index("mut.", index) == index
- r7 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
+ if input.index("du", index) == index
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- terminal_parse_failure("mut.")
+ terminal_parse_failure("du")
r7 = nil
end
if r7
- r1 = r7
- r1.extend(Rank0)
+ r2 = r7
else
- if input.index("pseudovar.", index) == index
- r8 = instantiate_node(SyntaxNode,input, index...(index + 10))
- @index += 10
+ if input.index("la", index) == index
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
+ @index += 2
else
- terminal_parse_failure("pseudovar.")
+ terminal_parse_failure("la")
r8 = nil
end
if r8
- r1 = r8
- r1.extend(Rank0)
+ r2 = r8
else
- if input.index("sect.", index) == index
- r9 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
+ if input.index("ter", index) == index
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure("sect.")
+ terminal_parse_failure("ter")
r9 = nil
end
if r9
- r1 = r9
- r1.extend(Rank0)
+ r2 = r9
else
- if input.index("ser.", index) == index
- r10 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
+ if input.index("van", index) == index
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure("ser.")
+ terminal_parse_failure("van")
r10 = nil
end
if r10
- r1 = r10
- r1.extend(Rank0)
+ r2 = r10
else
- if input.index("var.", index) == index
- r11 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
+ if input.index("von", index) == index
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 3))
+ @index += 3
else
- terminal_parse_failure("var.")
+ terminal_parse_failure("von")
r11 = nil
end
if r11
- r1 = r11
- r1.extend(Rank0)
+ r2 = r11
else
- if input.index("subvar.", index) == index
- r12 = instantiate_node(SyntaxNode,input, index...(index + 7))
- @index += 7
- else
- terminal_parse_failure("subvar.")
- r12 = nil
- end
- if r12
- r1 = r12
- r1.extend(Rank0)
- else
- if input.index("[var.]", index) == index
- r13 = instantiate_node(SyntaxNode,input, index...(index + 6))
- @index += 6
- else
- terminal_parse_failure("[var.]")
- r13 = nil
- end
- if r13
- r1 = r13
- r1.extend(Rank0)
- else
- if input.index("subsp.", index) == index
- r14 = instantiate_node(SyntaxNode,input, index...(index + 6))
- @index += 6
- else
- terminal_parse_failure("subsp.")
- r14 = nil
- end
- if r14
- r1 = r14
- r1.extend(Rank0)
- else
- if input.index("subf.", index) == index
- r15 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
- else
- terminal_parse_failure("subf.")
- r15 = nil
- end
- if r15
- r1 = r15
- r1.extend(Rank0)
- else
- if input.index("race", index) == index
- r16 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
- else
- terminal_parse_failure("race")
- r16 = nil
- end
- if r16
- r1 = r16
- r1.extend(Rank0)
- else
- if input.index("α", index) == index
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("α")
- r17 = nil
- end
- if r17
- r1 = r17
- r1.extend(Rank0)
- else
- if input.index("ββ", index) == index
- r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("ββ")
- r18 = nil
- end
- if r18
- r1 = r18
- r1.extend(Rank0)
- else
- if input.index("β", index) == index
- r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("β")
- r19 = nil
- end
- if r19
- r1 = r19
- r1.extend(Rank0)
- else
- if input.index("γ", index) == index
- r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("γ")
- r20 = nil
- end
- if r20
- r1 = r20
- r1.extend(Rank0)
- else
- if input.index("δ", index) == index
- r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("δ")
- r21 = nil
- end
- if r21
- r1 = r21
- r1.extend(Rank0)
- else
- if input.index("ε", index) == index
- r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("ε")
- r22 = nil
- end
- if r22
- r1 = r22
- r1.extend(Rank0)
- else
- if input.index("φ", index) == index
- r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("φ")
- r23 = nil
- end
- if r23
- r1 = r23
- r1.extend(Rank0)
- else
- if input.index("θ", index) == index
- r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("θ")
- r24 = nil
- end
- if r24
- r1 = r24
- r1.extend(Rank0)
- else
- if input.index("μ", index) == index
- r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("μ")
- r25 = nil
- end
- if r25
- r1 = r25
- r1.extend(Rank0)
- else
- if input.index("a.", index) == index
- r26 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("a.")
- r26 = nil
- end
- if r26
- r1 = r26
- r1.extend(Rank0)
- else
- if input.index("b.", index) == index
- r27 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("b.")
- r27 = nil
- end
- if r27
- r1 = r27
- r1.extend(Rank0)
- else
- if input.index("c.", index) == index
- r28 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("c.")
- r28 = nil
- end
- if r28
- r1 = r28
- r1.extend(Rank0)
- else
- if input.index("d.", index) == index
- r29 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("d.")
- r29 = nil
- end
- if r29
- r1 = r29
- r1.extend(Rank0)
- else
- if input.index("e.", index) == index
- r30 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("e.")
- r30 = nil
- end
- if r30
- r1 = r30
- r1.extend(Rank0)
- else
- if input.index("g.", index) == index
- r31 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("g.")
- r31 = nil
- end
- if r31
- r1 = r31
- r1.extend(Rank0)
- else
- if input.index("k.", index) == index
- r32 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("k.")
- r32 = nil
- end
- if r32
- r1 = r32
- r1.extend(Rank0)
- else
- if input.index("****", index) == index
- r33 = instantiate_node(SyntaxNode,input, index...(index + 4))
- @index += 4
- else
- terminal_parse_failure("****")
- r33 = nil
- end
- if r33
- r1 = r33
- r1.extend(Rank0)
- else
- if input.index("**", index) == index
- r34 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("**")
- r34 = nil
- end
- if r34
- r1 = r34
- r1.extend(Rank0)
- else
- if input.index("*", index) == index
- r35 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("*")
- r35 = nil
- end
- if r35
- r1 = r35
- r1.extend(Rank0)
- else
- self.index = i1
- r1 = nil
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
+ self.index = i2
+ r2 = nil
end
end
end
end
end
end
end
end
end
- end
- if r1
- r0 = r1
- else
- r36 = _nt_rank_forma
- if r36
- r0 = r36
- else
- self.index = i0
- r0 = nil
- end
- end
-
- node_cache[:rank][start_index] = r0
-
- return r0
- end
-
- module RankForma0
- def value
- "f."
- end
- def apply(a)
- " " + value + " " + a.value
- end
- def canonical(a)
- " " + a.value
- end
- def details(a = nil)
- {:subspecies => [{:rank => value, :value => (a.value rescue nil)}]}
- end
- end
-
- def _nt_rank_forma
- start_index = index
- if node_cache[:rank_forma].has_key?(index)
- cached = node_cache[:rank_forma][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- if input.index("forma", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
- else
- terminal_parse_failure("forma")
- r1 = nil
- end
- if r1
- r0 = r1
- r0.extend(RankForma0)
- else
- if input.index("form.", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
- else
- terminal_parse_failure("form.")
- r2 = nil
- end
+ s0 << r2
if r2
- r0 = r2
- r0.extend(RankForma0)
- else
- if input.index("fo.", index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
+ i12 = index
+ r13 = _nt_space_hard
+ if r13
+ self.index = i12
+ r12 = instantiate_node(SyntaxNode,input, index...index)
else
- terminal_parse_failure("fo.")
- r3 = nil
+ r12 = nil
end
- if r3
- r0 = r3
- r0.extend(RankForma0)
- else
- if input.index("f.", index) == index
- r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
- @index += 2
- else
- terminal_parse_failure("f.")
- r4 = nil
- end
- if r4
- r0 = r4
- r0.extend(RankForma0)
- else
- self.index = i0
- r0 = nil
- end
- end
+ s0 << r12
end
end
-
- node_cache[:rank_forma][start_index] = r0
-
- return r0
- end
-
- module SpeciesName0
- def hybrid_separator
- elements[0]
- end
-
- def space_hard
- elements[1]
- end
-
- def a
- elements[2]
- end
-
- def space_hard
- elements[3]
- end
-
- def b
- elements[4]
- end
- end
-
- module SpeciesName1
- def value
- "× " + a.value + " " + b.value
- end
- def canonical
- a.value + " " + b.value
- end
-
- def pos
- {a.interval.begin => ['genus', a.interval.end], b.interval.begin => ['species', b.interval.end]}
- end
-
- def details
- {:genus => a.value, :species => b.value, :cross => 'before'}
- end
- end
-
- module SpeciesName2
- def hybrid_separator
- elements[0]
- end
-
- def space_hard
- elements[1]
- end
-
- def a
- elements[2]
- end
- end
-
- module SpeciesName3
- def value
- "× " + a.value
- end
- def canonical
- a.value
- end
-
- def pos
- {a.interval.begin => ['uninomial', a.interval.end]}
- end
-
- def details
- {:uninomial => a.value, :cross => 'before'}
- end
- end
-
- module SpeciesName4
- def a
- elements[0]
- end
-
- def space_hard
- elements[1]
- end
-
- def hybrid_separator
- elements[2]
- end
-
- def space_hard
- elements[3]
- end
-
- def b
- elements[4]
- end
- end
-
- module SpeciesName5
- def value
- a.value + " × " + b.value
- end
- def canonical
- a.value + " " + b.value
- end
-
- def pos
- {a.interval.begin => ['genus', a.interval.end], b.interval.begin => ['species', b.interval.end]}
- end
-
- def details
- {:genus => a.value, :species => b.value, :cross => 'inside'}
- end
- end
-
- module SpeciesName6
- def a
- elements[0]
- end
-
- def space
- elements[1]
- end
-
- def b
- elements[2]
- end
-
- def space
- elements[3]
- end
-
- def c
- elements[4]
- end
- end
-
- module SpeciesName7
- def value
- a.value + " " + b.value + " " + c.value
- end
- def canonical
- a.value + " " + c.value
- end
-
- def pos
- {a.interval.begin => ['genus', a.interval.end]}.merge(b.pos).merge({c.interval.begin => ['subspecies', c.interval.end]})
- end
-
- def details
- {:genus => a.value, :subgenus => b.details, :species => c.value}
- end
- end
-
- module SpeciesName8
- def a
- elements[0]
- end
-
- def space_hard
- elements[1]
- end
-
- def b
- elements[2]
- end
- end
-
- module SpeciesName9
- def value
- a.value + " " + b.value
- end
- def canonical
- value
- end
-
- def pos
- {a.interval.begin => ['genus', a.interval.end], b.interval.begin => ['species', b.interval.end]}
- end
-
- def details
- {:genus => a.value, :species => b.value}
- end
- end
-
- def _nt_species_name
- start_index = index
- if node_cache[:species_name].has_key?(index)
- cached = node_cache[:species_name][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- i1, s1 = index, []
- r2 = _nt_hybrid_separator
- s1 << r2
- if r2
- r3 = _nt_space_hard
- s1 << r3
- if r3
- r4 = _nt_cap_latin_word
- s1 << r4
- if r4
- r5 = _nt_space_hard
- s1 << r5
- if r5
- r6 = _nt_latin_word
- s1 << r6
- end
- end
- end
- end
- if s1.last
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- r1.extend(SpeciesName0)
- r1.extend(SpeciesName1)
- else
- self.index = i1
- r1 = nil
- end
- if r1
- r0 = r1
- else
- i7, s7 = index, []
- r8 = _nt_hybrid_separator
- s7 << r8
- if r8
- r9 = _nt_space_hard
- s7 << r9
- if r9
- r10 = _nt_cap_latin_word
- s7 << r10
- end
- end
- if s7.last
- r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
- r7.extend(SpeciesName2)
- r7.extend(SpeciesName3)
- else
- self.index = i7
- r7 = nil
- end
- if r7
- r0 = r7
- else
- i11, s11 = index, []
- r12 = _nt_cap_latin_word
- s11 << r12
- if r12
- r13 = _nt_space_hard
- s11 << r13
- if r13
- r14 = _nt_hybrid_separator
- s11 << r14
- if r14
- r15 = _nt_space_hard
- s11 << r15
- if r15
- r16 = _nt_latin_word
- s11 << r16
- end
- end
- end
- end
- if s11.last
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
- r11.extend(SpeciesName4)
- r11.extend(SpeciesName5)
- else
- self.index = i11
- r11 = nil
- end
- if r11
- r0 = r11
- else
- i17, s17 = index, []
- r18 = _nt_cap_latin_word
- s17 << r18
- if r18
- r19 = _nt_space
- s17 << r19
- if r19
- r20 = _nt_subgenus
- s17 << r20
- if r20
- r21 = _nt_space
- s17 << r21
- if r21
- r22 = _nt_latin_word
- s17 << r22
- end
- end
- end
- end
- if s17.last
- r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
- r17.extend(SpeciesName6)
- r17.extend(SpeciesName7)
- else
- self.index = i17
- r17 = nil
- end
- if r17
- r0 = r17
- else
- i23, s23 = index, []
- r24 = _nt_cap_latin_word
- s23 << r24
- if r24
- r25 = _nt_space_hard
- s23 << r25
- if r25
- r26 = _nt_latin_word
- s23 << r26
- end
- end
- if s23.last
- r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
- r23.extend(SpeciesName8)
- r23.extend(SpeciesName9)
- else
- self.index = i23
- r23 = nil
- end
- if r23
- r0 = r23
- else
- self.index = i0
- r0 = nil
- end
- end
- end
- end
- end
-
- node_cache[:species_name][start_index] = r0
-
- return r0
- end
-
- module Subgenus0
- def space
- elements[1]
- end
-
- def a
- elements[2]
- end
-
- def space
- elements[3]
- end
-
- end
-
- module Subgenus1
- def value
- "(" + a.value + ")"
- end
-
- def canonical
- ''
- end
-
- def pos
- {a.interval.begin => ['subgenus', a.interval.end]}
- end
-
- def details
- a.value
- end
- end
-
- def _nt_subgenus
- start_index = index
- if node_cache[:subgenus].has_key?(index)
- cached = node_cache[:subgenus][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0, s0 = index, []
- if input.index("(", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("(")
- r1 = nil
- end
- s0 << r1
- if r1
- r2 = _nt_space
- s0 << r2
- if r2
- r3 = _nt_cap_latin_word
- s0 << r3
- if r3
- r4 = _nt_space
- s0 << r4
- if r4
- if input.index(")", index) == index
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure(")")
- r5 = nil
- end
- s0 << r5
- end
- end
- end
- end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(Subgenus0)
- r0.extend(Subgenus1)
+ r0.extend(AuthorPrefixWord0)
+ r0.extend(AuthorPrefixWord1)
else
self.index = i0
r0 = nil
end
- node_cache[:subgenus][start_index] = r0
+ node_cache[:author_prefix_word][start_index] = r0
return r0
end
- module TaxonConceptRank0
- def value
- "sec."
- end
- def apply(a)
- " " + value + " " + a.value
- end
- def details(a = nil)
- {:taxon_concept => a.details}
- end
- end
-
- def _nt_taxon_concept_rank
- start_index = index
- if node_cache[:taxon_concept_rank].has_key?(index)
- cached = node_cache[:taxon_concept_rank][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- if input.index("sec.", index) == index
- r0 = instantiate_node(SyntaxNode,input, index...(index + 4))
- r0.extend(TaxonConceptRank0)
- @index += 4
- else
- terminal_parse_failure("sec.")
- r0 = nil
- end
-
- node_cache[:taxon_concept_rank][start_index] = r0
-
- return r0
- end
-
- module GenusRank0
- def value
- text_value.strip
- end
- def apply(a)
- " " + text_value + " " + a.value
- end
- def canonical(a)
- ""
- end
- def details(a = nil)
- {:subgenus => [{:rank => text_value, :value => (a.value rescue nil)}]}
- end
- end
-
- def _nt_genus_rank
- start_index = index
- if node_cache[:genus_rank].has_key?(index)
- cached = node_cache[:genus_rank][index]
- @index = cached.interval.end if cached
- return cached
- end
-
- i0 = index
- if input.index("subsect.", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
- @index += 8
- else
- terminal_parse_failure("subsect.")
- r1 = nil
- end
- if r1
- r0 = r1
- r0.extend(GenusRank0)
- else
- if input.index("subtrib.", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 8))
- @index += 8
- else
- terminal_parse_failure("subtrib.")
- r2 = nil
- end
- if r2
- r0 = r2
- r0.extend(GenusRank0)
- else
- if input.index("subgen.", index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
- @index += 7
- else
- terminal_parse_failure("subgen.")
- r3 = nil
- end
- if r3
- r0 = r3
- r0.extend(GenusRank0)
- else
- if input.index("trib.", index) == index
- r4 = instantiate_node(SyntaxNode,input, index...(index + 5))
- @index += 5
- else
- terminal_parse_failure("trib.")
- r4 = nil
- end
- if r4
- r0 = r4
- r0.extend(GenusRank0)
- else
- self.index = i0
- r0 = nil
- end
- end
- end
- end
-
- node_cache[:genus_rank][start_index] = r0
-
- return r0
- end
-
module CapLatinWord0
def a
elements[0]
end
@@ -4403,22 +3986,10 @@
module CapLatinWord1
def value
(a.value rescue a.text_value) + b.value
end
-
- def canonical
- value
- end
-
- def pos
- {a.interval.begin => ['uninomial', a.interval.end]}
- end
-
- def details
- {:uninomial => value}
- end
end
module CapLatinWord2
def a
elements[0]
@@ -4431,40 +4002,16 @@
module CapLatinWord3
def value
(a.value rescue a.text_value) + b.value
end
-
- def canonical
- value
- end
-
- def pos
- {a.interval.begin => ['uninomial',b.interval.end]}
- end
-
- def details
- {:uninomial => value}
- end
end
module CapLatinWord4
def value
text_value
end
-
- def canonical
- value
- end
-
- def pos
- {interval.begin => ['uninomial', interval.end]}
- end
-
- def details
- {:uninomial => value}
- end
end
def _nt_cap_latin_word
start_index = index
if node_cache[:cap_latin_word].has_key?(index)
@@ -4797,10 +4344,295 @@
node_cache[:cap_latin_word][start_index] = r0
return r0
end
+ module SpeciesWordHybrid0
+ def a
+ elements[0]
+ end
+
+ def space
+ elements[1]
+ end
+
+ def b
+ elements[2]
+ end
+ end
+
+ module SpeciesWordHybrid1
+ def value
+ a.value + " " + b.value
+ end
+
+ def canonical
+ b.value
+ end
+
+ def pos
+ {b.interval.begin => ['species', b.interval.end]}
+ end
+
+ def details
+ {:species => {:epitheton => b.value, :namedHybrid => true}}
+ end
+ end
+
+ module SpeciesWordHybrid2
+ def a
+ elements[0]
+ end
+
+ def space
+ elements[1]
+ end
+
+ def b
+ elements[2]
+ end
+ end
+
+ module SpeciesWordHybrid3
+ def value
+ "× " + b.value
+ end
+
+ def canonical
+ b.value
+ end
+
+ def pos
+ {b.interval.begin => ['species', b.interval.end]}
+ end
+
+ def details
+ {:species => {:epitheton => b.value, :namedHybrid => true}}
+ end
+ end
+
+ module SpeciesWordHybrid4
+ def a
+ elements[0]
+ end
+
+ def space_hard
+ elements[1]
+ end
+
+ def b
+ elements[2]
+ end
+ end
+
+ module SpeciesWordHybrid5
+ def value
+ "× " + b.value
+ end
+
+ def canonical
+ b.value
+ end
+
+ def pos
+ {b.interval.begin => ['species', b.interval.end]}
+ end
+
+ def details
+ {:species => {:epitheton => b.value, :namedHybrid => true}}
+ end
+ end
+
+ def _nt_species_word_hybrid
+ start_index = index
+ if node_cache[:species_word_hybrid].has_key?(index)
+ cached = node_cache[:species_word_hybrid][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ r2 = _nt_multiplication_sign
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ r4 = _nt_species_word
+ s1 << r4
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(SpeciesWordHybrid0)
+ r1.extend(SpeciesWordHybrid1)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ i5, s5 = index, []
+ if input.index("X", index) == index
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("X")
+ r6 = nil
+ end
+ s5 << r6
+ if r6
+ r7 = _nt_space
+ s5 << r7
+ if r7
+ r8 = _nt_species_word
+ s5 << r8
+ end
+ end
+ if s5.last
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
+ r5.extend(SpeciesWordHybrid2)
+ r5.extend(SpeciesWordHybrid3)
+ else
+ self.index = i5
+ r5 = nil
+ end
+ if r5
+ r0 = r5
+ else
+ i9, s9 = index, []
+ if input.index("x", index) == index
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("x")
+ r10 = nil
+ end
+ s9 << r10
+ if r10
+ r11 = _nt_space_hard
+ s9 << r11
+ if r11
+ r12 = _nt_species_word
+ s9 << r12
+ end
+ end
+ if s9.last
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
+ r9.extend(SpeciesWordHybrid4)
+ r9.extend(SpeciesWordHybrid5)
+ else
+ self.index = i9
+ r9 = nil
+ end
+ if r9
+ r0 = r9
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+ end
+
+ node_cache[:species_word_hybrid][start_index] = r0
+
+ return r0
+ end
+
+ module SpeciesWord0
+ def a
+ elements[0]
+ end
+
+ def b
+ elements[2]
+ end
+ end
+
+ module SpeciesWord1
+ def value
+ a.text_value + "-" + b.value
+ end
+ end
+
+ def _nt_species_word
+ start_index = index
+ if node_cache[:species_word].has_key?(index)
+ cached = node_cache[:species_word][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ i0 = index
+ i1, s1 = index, []
+ s2, i2 = [], index
+ loop do
+ if input.index(Regexp.new('[0-9]'), index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r3 = nil
+ end
+ if r3
+ s2 << r3
+ else
+ break
+ end
+ end
+ if s2.empty?
+ self.index = i2
+ r2 = nil
+ else
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
+ end
+ s1 << r2
+ if r2
+ if input.index("-", index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("-")
+ r5 = nil
+ end
+ if r5
+ r4 = r5
+ else
+ r4 = instantiate_node(SyntaxNode,input, index...index)
+ end
+ s1 << r4
+ if r4
+ r6 = _nt_latin_word
+ s1 << r6
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(SpeciesWord0)
+ r1.extend(SpeciesWord1)
+ else
+ self.index = i1
+ r1 = nil
+ end
+ if r1
+ r0 = r1
+ else
+ r7 = _nt_latin_word
+ if r7
+ r0 = r7
+ else
+ self.index = i0
+ r0 = nil
+ end
+ end
+
+ node_cache[:species_word][start_index] = r0
+
+ return r0
+ end
+
module LatinWord0
def a
elements[0]
end
@@ -4811,13 +4643,10 @@
module LatinWord1
def value
a.text_value + b.value
end
- def details
- {}
- end
end
module LatinWord2
def a
elements[0]
@@ -4830,13 +4659,10 @@
module LatinWord3
def value
a.value + b.value
end
- def details
- {}
- end
end
def _nt_latin_word
start_index = index
if node_cache[:latin_word].has_key?(index)
@@ -4909,13 +4735,10 @@
module FullNameLetters1
def value
a.value + b.value
end
- def details
- {}
- end
end
module FullNameLetters2
def a
elements[0]
@@ -4932,13 +4755,10 @@
module FullNameLetters3
def value
a.value + b.value + c.value
end
- def details
- {}
- end
end
def _nt_full_name_letters
start_index = index
if node_cache[:full_name_letters].has_key?(index)
@@ -5005,13 +4825,10 @@
module ValidNameLetters0
def value
text_value
end
- def details
- {}
- end
end
def _nt_valid_name_letters
start_index = index
if node_cache[:valid_name_letters].has_key?(index)
@@ -5047,17 +4864,17 @@
return r0
end
module CapDigraph0
def value
- 'Ae'
+ 'Ae'
end
end
module CapDigraph1
def value
- 'Oe'
+ 'Oe'
end
end
def _nt_cap_digraph
start_index = index
@@ -5100,17 +4917,17 @@
return r0
end
module Digraph0
def value
- 'ae'
+ 'ae'
end
end
module Digraph1
def value
- 'oe'
+ 'oe'
end
end
def _nt_digraph
start_index = index
@@ -5151,83 +4968,43 @@
node_cache[:digraph][start_index] = r0
return r0
end
- module HybridSeparator0
- def value
- "x"
+ module Year0
+ def b
+ elements[0]
end
- def details
- {}
+
+ def space
+ elements[1]
end
- end
- def _nt_hybrid_separator
- start_index = index
- if node_cache[:hybrid_separator].has_key?(index)
- cached = node_cache[:hybrid_separator][index]
- @index = cached.interval.end if cached
- return cached
+ def a
+ elements[2]
end
- i0 = index
- if input.index("x", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("x")
- r1 = nil
+ def space
+ elements[3]
end
- if r1
- r0 = r1
- r0.extend(HybridSeparator0)
- else
- if input.index("X", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("X")
- r2 = nil
- end
- if r2
- r0 = r2
- r0.extend(HybridSeparator0)
- else
- if input.index("×", index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- terminal_parse_failure("×")
- r3 = nil
- end
- if r3
- r0 = r3
- r0.extend(HybridSeparator0)
- else
- self.index = i0
- r0 = nil
- end
- end
- end
- node_cache[:hybrid_separator][start_index] = r0
-
- return r0
+ def c
+ elements[4]
+ end
end
- module Year0
+ module Year1
def value
- text_value.strip
+ a.value
end
def pos
- {interval.begin => ['year', interval.end]}
+ a.pos
end
def details
- {:year => value}
+ a.details
end
end
def _nt_year
start_index = index
@@ -5236,221 +5013,348 @@
@index = cached.interval.end if cached
return cached
end
i0 = index
- r1 = _nt_year_with_character
+ i1, s1 = index, []
+ r2 = _nt_left_paren
+ s1 << r2
+ if r2
+ r3 = _nt_space
+ s1 << r3
+ if r3
+ i4 = index
+ r5 = _nt_year_number_with_character
+ if r5
+ r4 = r5
+ else
+ r6 = _nt_year_number
+ if r6
+ r4 = r6
+ else
+ self.index = i4
+ r4 = nil
+ end
+ end
+ s1 << r4
+ if r4
+ r7 = _nt_space
+ s1 << r7
+ if r7
+ r8 = _nt_right_paren
+ s1 << r8
+ end
+ end
+ end
+ end
+ if s1.last
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
+ r1.extend(Year0)
+ r1.extend(Year1)
+ else
+ self.index = i1
+ r1 = nil
+ end
if r1
r0 = r1
else
- s2, i2 = [], index
- loop do
- if input.index(Regexp.new('[0-9\\?]'), index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
+ r9 = _nt_year_number_with_character
+ if r9
+ r0 = r9
+ else
+ r10 = _nt_year_number
+ if r10
+ r0 = r10
else
- r3 = nil
+ self.index = i0
+ r0 = nil
end
- if r3
- s2 << r3
- else
- break
- end
end
- if s2.empty?
- self.index = i2
- r2 = nil
- else
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
- r2.extend(Year0)
- end
- if r2
- r0 = r2
- else
- self.index = i0
- r0 = nil
- end
end
node_cache[:year][start_index] = r0
return r0
end
- module YearWithCharacter0
+ module YearNumberWithCharacter0
def a
elements[0]
end
end
- module YearWithCharacter1
+ module YearNumberWithCharacter1
def value
a.text_value
end
-
+
def pos
{interval.begin => ['year', interval.end]}
end
-
+
def details
{:year => value}
end
end
- def _nt_year_with_character
+ def _nt_year_number_with_character
start_index = index
- if node_cache[:year_with_character].has_key?(index)
- cached = node_cache[:year_with_character][index]
+ if node_cache[:year_number_with_character].has_key?(index)
+ cached = node_cache[:year_number_with_character][index]
@index = cached.interval.end if cached
return cached
end
i0, s0 = index, []
- s1, i1 = [], index
- loop do
- if input.index(Regexp.new('[0-9\\?]'), index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
- @index += 1
- else
- r2 = nil
- end
- if r2
- s1 << r2
- else
- break
- end
- end
- if s1.empty?
- self.index = i1
- r1 = nil
- else
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
- end
+ r1 = _nt_year_number
s0 << r1
if r1
if input.index(Regexp.new('[a-zA-Z]'), index) == index
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
- r3 = nil
+ r2 = nil
end
- s0 << r3
+ s0 << r2
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(YearWithCharacter0)
- r0.extend(YearWithCharacter1)
+ r0.extend(YearNumberWithCharacter0)
+ r0.extend(YearNumberWithCharacter1)
else
self.index = i0
r0 = nil
end
- node_cache[:year_with_character][start_index] = r0
+ node_cache[:year_number_with_character][start_index] = r0
return r0
end
- module LeftBracket0
+ module YearNumber0
+ end
+
+ module YearNumber1
def value
- "("
+ text_value
end
+
+ def pos
+ {interval.begin => ['year', interval.end]}
+ end
+
+ def details
+ {:year => value}
+ end
end
- def _nt_left_bracket
+ def _nt_year_number
start_index = index
- if node_cache[:left_bracket].has_key?(index)
- cached = node_cache[:left_bracket][index]
+ if node_cache[:year_number].has_key?(index)
+ cached = node_cache[:year_number][index]
@index = cached.interval.end if cached
return cached
end
- i0 = index
- if input.index("( (", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
+ i0, s0 = index, []
+ if input.index(Regexp.new('[12]'), index) == index
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure("( (")
r1 = nil
end
+ s0 << r1
if r1
- r0 = r1
- else
- if input.index("(", index) == index
+ if input.index(Regexp.new('[7890]'), index) == index
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
- r2.extend(LeftBracket0)
@index += 1
else
- terminal_parse_failure("(")
r2 = nil
end
+ s0 << r2
if r2
- r0 = r2
- else
- self.index = i0
- r0 = nil
+ if input.index(Regexp.new('[0-9]'), index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r3 = nil
+ end
+ s0 << r3
+ if r3
+ if input.index(Regexp.new('[0-9]'), index) == index
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r5 = nil
+ end
+ if r5
+ r4 = r5
+ else
+ r4 = instantiate_node(SyntaxNode,input, index...index)
+ end
+ s0 << r4
+ if r4
+ if input.index(Regexp.new('[\\?]'), index) == index
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ r7 = nil
+ end
+ if r7
+ r6 = r7
+ else
+ r6 = instantiate_node(SyntaxNode,input, index...index)
+ end
+ s0 << r6
+ end
+ end
end
end
+ if s0.last
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
+ r0.extend(YearNumber0)
+ r0.extend(YearNumber1)
+ else
+ self.index = i0
+ r0 = nil
+ end
- node_cache[:left_bracket][start_index] = r0
+ node_cache[:year_number][start_index] = r0
return r0
end
- module RightBracket0
+ def _nt_left_paren
+ start_index = index
+ if node_cache[:left_paren].has_key?(index)
+ cached = node_cache[:left_paren][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ if input.index("(", index) == index
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure("(")
+ r0 = nil
+ end
+
+ node_cache[:left_paren][start_index] = r0
+
+ return r0
+ end
+
+ def _nt_right_paren
+ start_index = index
+ if node_cache[:right_paren].has_key?(index)
+ cached = node_cache[:right_paren][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ if input.index(")", index) == index
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure(")")
+ r0 = nil
+ end
+
+ node_cache[:right_paren][start_index] = r0
+
+ return r0
+ end
+
+ module HybridCharacter0
def value
- ")"
+ "×"
end
end
- def _nt_right_bracket
+ def _nt_hybrid_character
start_index = index
- if node_cache[:right_bracket].has_key?(index)
- cached = node_cache[:right_bracket][index]
+ if node_cache[:hybrid_character].has_key?(index)
+ cached = node_cache[:hybrid_character][index]
@index = cached.interval.end if cached
return cached
end
i0 = index
- if input.index(") )", index) == index
- r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
- @index += 3
+ i1 = index
+ if input.index("x", index) == index
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
else
- terminal_parse_failure(") )")
- r1 = nil
+ terminal_parse_failure("x")
+ r2 = nil
end
- if r1
- r0 = r1
+ if r2
+ r1 = r2
+ r1.extend(HybridCharacter0)
else
- if input.index(")", index) == index
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
- r2.extend(RightBracket0)
+ if input.index("X", index) == index
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
- terminal_parse_failure(")")
- r2 = nil
+ terminal_parse_failure("X")
+ r3 = nil
end
- if r2
- r0 = r2
+ if r3
+ r1 = r3
+ r1.extend(HybridCharacter0)
else
+ self.index = i1
+ r1 = nil
+ end
+ end
+ if r1
+ r0 = r1
+ else
+ r4 = _nt_multiplication_sign
+ if r4
+ r0 = r4
+ else
self.index = i0
r0 = nil
end
end
- node_cache[:right_bracket][start_index] = r0
+ node_cache[:hybrid_character][start_index] = r0
return r0
end
- module Space0
- def details
- {
- }
+ module MultiplicationSign0
+ def value
+ text_value
end
end
+ def _nt_multiplication_sign
+ start_index = index
+ if node_cache[:multiplication_sign].has_key?(index)
+ cached = node_cache[:multiplication_sign][index]
+ @index = cached.interval.end if cached
+ return cached
+ end
+
+ if input.index("×", index) == index
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ r0.extend(MultiplicationSign0)
+ @index += 1
+ else
+ terminal_parse_failure("×")
+ r0 = nil
+ end
+
+ node_cache[:multiplication_sign][start_index] = r0
+
+ return r0
+ end
+
def _nt_space
start_index = index
if node_cache[:space].has_key?(index)
cached = node_cache[:space][index]
@index = cached.interval.end if cached
@@ -5470,23 +5374,16 @@
else
break
end
end
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(Space0)
node_cache[:space][start_index] = r0
return r0
end
- module SpaceHard0
- def details
- {}
- end
- end
-
def _nt_space_hard
start_index = index
if node_cache[:space_hard].has_key?(index)
cached = node_cache[:space_hard][index]
@index = cached.interval.end if cached
@@ -5510,11 +5407,10 @@
if s0.empty?
self.index = i0
r0 = nil
else
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
- r0.extend(SpaceHard0)
end
node_cache[:space_hard][start_index] = r0
return r0
@@ -5523,6 +5419,5 @@
end
class ScientificNameCleanParser < Treetop::Runtime::CompiledParser
include ScientificNameClean
end
-