biodiversity19 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ee9ae85998aad360ba6663668f6e5722f77d5b3
4
- data.tar.gz: 631b77691d8c0698fc12a6da7bb8343367b5a5e7
3
+ metadata.gz: 0b586fe85179143bb76a5f17a438b1cb923a64c7
4
+ data.tar.gz: 426bd56ad8a97c031d75fa15be9df924aa9e9cfb
5
5
  SHA512:
6
- metadata.gz: ff5d7fadc03d7abd36b45893043aa94dd90644940f474510b24be262314fc6873a95a68b93651a13f9170816c1c45b4be7ca9274ea6f1e84deb837fca8dab764
7
- data.tar.gz: f979c87d6e6f684356dfe5a6876f3c33f521779704cef58845f0c985c2827f3e1e0631731908ae7d25d4bd97f726142088940d9871de412beec42ab746cea873
6
+ metadata.gz: f41b775a4bb37c29899e04f403bd9c247c74b2aeb86ce9bd7d5223f492838d93585d46ec010cd0fd79fa9466c16d7c487bc2b6f91b71d088ddde61ba7ceb509e
7
+ data.tar.gz: d015a96a3e23dad7a130f87540da9d60fa7620e1bdda03cfe7563c55aa8605bac88a6f7415b594c8c9c315f8d0aa1c860957886eba3a767e4a11e9b1fc687a7c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p353
1
+ 2.1.1
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  rvm:
2
- - 1.9.3-p448
2
+ - 1.9.3-p484
3
3
  - 2.0.0-p353
4
4
  branches:
5
5
  only:
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 3.1.5 -- updated depenencies
2
+
1
3
  3.1.4 -- added files generated by tt to repository
2
4
 
3
5
  3.1.3 -- removed dependency on jeweler
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2008-2013 Marine Biological Laboratory
3
+ Copyright (c) 2008-2014 Marine Biological Laboratory
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -186,7 +186,7 @@ Copyright
186
186
 
187
187
  Authors: [Dmitry Mozzherin][10],
188
188
 
189
- Copyright (c) 2008-2013 Marine Biological Laboratory. See LICENSE for
189
+ Copyright (c) 2008-2012 Marine Biological Laboratory. See LICENSE for
190
190
  further details.
191
191
 
192
192
  [1]: https://badge.fury.io/rb/biodiversity.png
data/biodiversity.gemspec CHANGED
@@ -16,13 +16,14 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = ['nnparse', 'parserver']
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.add_runtime_dependency 'treetop', '~> 1.4'
20
- gem.add_runtime_dependency 'parallel', '~> 0.7'
19
+ gem.add_runtime_dependency 'treetop', '~> 1.5'
20
+ gem.add_runtime_dependency 'parallel', '~> 1.2'
21
21
  gem.add_runtime_dependency 'unicode_utils', '~> 1.4'
22
22
 
23
- gem.add_development_dependency 'bundler', '~> 1.3'
24
- gem.add_development_dependency 'rake', '~> 10.1'
25
- gem.add_development_dependency 'rspec', '~> 2.14'
23
+ gem.add_development_dependency 'bundler', '~> 1.6'
24
+ gem.add_development_dependency 'rake', '~> 10.3'
25
+ gem.add_development_dependency 'rspec', '~> 3.0'
26
+ gem.add_development_dependency 'webmock', '~> 1.13'
26
27
  gem.add_development_dependency 'rr', '~> 1.1'
27
28
  gem.add_development_dependency 'debugger', '~> 1.6'
28
29
  end
@@ -44,7 +44,7 @@ module ScientificNameCanonical
44
44
  if node_cache[:root].has_key?(index)
45
45
  cached = node_cache[:root][index]
46
46
  if cached
47
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
47
+ node_cache[:root][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
48
48
  @index = cached.interval.end
49
49
  end
50
50
  return cached
@@ -54,11 +54,13 @@ module ScientificNameCanonical
54
54
  r1 = _nt_multinomial_with_garbage
55
55
  r1.extend(Root0)
56
56
  if r1
57
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
57
58
  r0 = r1
58
59
  else
59
60
  r2 = _nt_uninomial_with_garbage
60
61
  r2.extend(Root1)
61
62
  if r2
63
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
62
64
  r0 = r2
63
65
  else
64
66
  @index = i0
@@ -192,7 +194,7 @@ module ScientificNameCanonical
192
194
  if node_cache[:multinomial_with_garbage].has_key?(index)
193
195
  cached = node_cache[:multinomial_with_garbage][index]
194
196
  if cached
195
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
197
+ node_cache[:multinomial_with_garbage][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
196
198
  @index = cached.interval.end
197
199
  end
198
200
  return cached
@@ -231,6 +233,7 @@ module ScientificNameCanonical
231
233
  r1 = nil
232
234
  end
233
235
  if r1
236
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
234
237
  r0 = r1
235
238
  else
236
239
  i8, s8 = index, []
@@ -257,6 +260,7 @@ module ScientificNameCanonical
257
260
  r8 = nil
258
261
  end
259
262
  if r8
263
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
260
264
  r0 = r8
261
265
  else
262
266
  i13, s13 = index, []
@@ -283,6 +287,7 @@ module ScientificNameCanonical
283
287
  r13 = nil
284
288
  end
285
289
  if r13
290
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
286
291
  r0 = r13
287
292
  else
288
293
  @index = i0
@@ -329,7 +334,7 @@ module ScientificNameCanonical
329
334
  if node_cache[:uninomial_with_garbage].has_key?(index)
330
335
  cached = node_cache[:uninomial_with_garbage][index]
331
336
  if cached
332
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
337
+ node_cache[:uninomial_with_garbage][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
333
338
  @index = cached.interval.end
334
339
  end
335
340
  return cached
@@ -386,7 +391,7 @@ module ScientificNameCanonical
386
391
  if node_cache[:garbage].has_key?(index)
387
392
  cached = node_cache[:garbage][index]
388
393
  if cached
389
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
394
+ node_cache[:garbage][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
390
395
  @index = cached.interval.end
391
396
  end
392
397
  return cached
@@ -397,9 +402,9 @@ module ScientificNameCanonical
397
402
  r2 = _nt_space
398
403
  s1 << r2
399
404
  if r2
400
- if has_terminal?("$$g@rbg3$$", false, index)
401
- r3 = instantiate_node(SyntaxNode,input, index...(index + 10))
402
- @index += 10
405
+ if (match_len = has_terminal?("$$g@rbg3$$", false, index))
406
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
407
+ @index += match_len
403
408
  else
404
409
  terminal_parse_failure("$$g@rbg3$$")
405
410
  r3 = nil
@@ -414,16 +419,18 @@ module ScientificNameCanonical
414
419
  r1 = nil
415
420
  end
416
421
  if r1
422
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
417
423
  r0 = r1
418
424
  else
419
425
  i4, s4 = index, []
420
426
  r5 = _nt_space
421
427
  s4 << r5
422
428
  if r5
423
- if has_terminal?('\G["\',.]', true, index)
429
+ if has_terminal?(@regexps[gr = '\A["\',.]'] ||= Regexp.new(gr), :regexp, index)
424
430
  r6 = true
425
431
  @index += 1
426
432
  else
433
+ terminal_parse_failure('["\',.]')
427
434
  r6 = nil
428
435
  end
429
436
  s4 << r6
@@ -433,10 +440,11 @@ module ScientificNameCanonical
433
440
  if r7
434
441
  s8, i8 = [], index
435
442
  loop do
436
- if has_terminal?('\G[^щ]', true, index)
443
+ if has_terminal?(@regexps[gr = '\A[^щ]'] ||= Regexp.new(gr), :regexp, index)
437
444
  r9 = true
438
445
  @index += 1
439
446
  else
447
+ terminal_parse_failure('[^щ]')
440
448
  r9 = nil
441
449
  end
442
450
  if r9
@@ -458,6 +466,7 @@ module ScientificNameCanonical
458
466
  r4 = nil
459
467
  end
460
468
  if r4
469
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
461
470
  r0 = r4
462
471
  else
463
472
  i10, s10 = index, []
@@ -466,10 +475,11 @@ module ScientificNameCanonical
466
475
  if r11
467
476
  s12, i12 = [], index
468
477
  loop do
469
- if has_terminal?('\G[^ш]', true, index)
478
+ if has_terminal?(@regexps[gr = '\A[^ш]'] ||= Regexp.new(gr), :regexp, index)
470
479
  r13 = true
471
480
  @index += 1
472
481
  else
482
+ terminal_parse_failure('[^ш]')
473
483
  r13 = nil
474
484
  end
475
485
  if r13
@@ -494,6 +504,7 @@ module ScientificNameCanonical
494
504
  r10 = nil
495
505
  end
496
506
  if r10
507
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
497
508
  r0 = r10
498
509
  else
499
510
  @index = i0
@@ -56,7 +56,7 @@ module ScientificNameClean
56
56
  if node_cache[:root].has_key?(index)
57
57
  cached = node_cache[:root][index]
58
58
  if cached
59
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
59
+ node_cache[:root][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
60
60
  @index = cached.interval.end
61
61
  end
62
62
  return cached
@@ -180,7 +180,7 @@ module ScientificNameClean
180
180
  if node_cache[:scientific_name_5].has_key?(index)
181
181
  cached = node_cache[:scientific_name_5][index]
182
182
  if cached
183
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
183
+ node_cache[:scientific_name_5][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
184
184
  @index = cached.interval.end
185
185
  end
186
186
  return cached
@@ -215,6 +215,7 @@ module ScientificNameClean
215
215
  r1 = nil
216
216
  end
217
217
  if r1
218
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
218
219
  r0 = r1
219
220
  else
220
221
  i7, s7 = index, []
@@ -245,10 +246,12 @@ module ScientificNameClean
245
246
  r7 = nil
246
247
  end
247
248
  if r7
249
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
248
250
  r0 = r7
249
251
  else
250
252
  r13 = _nt_scientific_name_4
251
253
  if r13
254
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
252
255
  r0 = r13
253
256
  else
254
257
  @index = i0
@@ -352,7 +355,7 @@ module ScientificNameClean
352
355
  if node_cache[:scientific_name_4].has_key?(index)
353
356
  cached = node_cache[:scientific_name_4][index]
354
357
  if cached
355
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
358
+ node_cache[:scientific_name_4][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
356
359
  @index = cached.interval.end
357
360
  end
358
361
  return cached
@@ -387,6 +390,7 @@ module ScientificNameClean
387
390
  r1 = nil
388
391
  end
389
392
  if r1
393
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
390
394
  r0 = r1
391
395
  else
392
396
  i7, s7 = index, []
@@ -402,10 +406,11 @@ module ScientificNameClean
402
406
  r11 = _nt_space
403
407
  s7 << r11
404
408
  if r11
405
- if has_terminal?('\G[\\?]', true, index)
409
+ if has_terminal?(@regexps[gr = '\A[\\?]'] ||= Regexp.new(gr), :regexp, index)
406
410
  r13 = true
407
411
  @index += 1
408
412
  else
413
+ terminal_parse_failure('[\\?]')
409
414
  r13 = nil
410
415
  end
411
416
  if r13
@@ -427,10 +432,12 @@ module ScientificNameClean
427
432
  r7 = nil
428
433
  end
429
434
  if r7
435
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
430
436
  r0 = r7
431
437
  else
432
438
  r14 = _nt_scientific_name_3
433
439
  if r14
440
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
434
441
  r0 = r14
435
442
  else
436
443
  @index = i0
@@ -485,7 +492,7 @@ module ScientificNameClean
485
492
  if node_cache[:scientific_name_3].has_key?(index)
486
493
  cached = node_cache[:scientific_name_3][index]
487
494
  if cached
488
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
495
+ node_cache[:scientific_name_3][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
489
496
  @index = cached.interval.end
490
497
  end
491
498
  return cached
@@ -512,10 +519,12 @@ module ScientificNameClean
512
519
  r1 = nil
513
520
  end
514
521
  if r1
522
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
515
523
  r0 = r1
516
524
  else
517
525
  r5 = _nt_scientific_name_2
518
526
  if r5
527
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
519
528
  r0 = r5
520
529
  else
521
530
  @index = i0
@@ -569,7 +578,7 @@ module ScientificNameClean
569
578
  if node_cache[:scientific_name_2].has_key?(index)
570
579
  cached = node_cache[:scientific_name_2][index]
571
580
  if cached
572
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
581
+ node_cache[:scientific_name_2][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
573
582
  @index = cached.interval.end
574
583
  end
575
584
  return cached
@@ -596,10 +605,12 @@ module ScientificNameClean
596
605
  r1 = nil
597
606
  end
598
607
  if r1
608
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
599
609
  r0 = r1
600
610
  else
601
611
  r5 = _nt_scientific_name_1
602
612
  if r5
613
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
603
614
  r0 = r5
604
615
  else
605
616
  @index = i0
@@ -617,7 +628,7 @@ module ScientificNameClean
617
628
  if node_cache[:scientific_name_1].has_key?(index)
618
629
  cached = node_cache[:scientific_name_1][index]
619
630
  if cached
620
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
631
+ node_cache[:scientific_name_1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
621
632
  @index = cached.interval.end
622
633
  end
623
634
  return cached
@@ -626,14 +637,17 @@ module ScientificNameClean
626
637
  i0 = index
627
638
  r1 = _nt_multiuninomial_name
628
639
  if r1
640
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
629
641
  r0 = r1
630
642
  else
631
643
  r2 = _nt_multinomial_name
632
644
  if r2
645
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
633
646
  r0 = r2
634
647
  else
635
648
  r3 = _nt_uninomial_name
636
649
  if r3
650
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
637
651
  r0 = r3
638
652
  else
639
653
  @index = i0
@@ -675,7 +689,7 @@ module ScientificNameClean
675
689
  if node_cache[:status_part].has_key?(index)
676
690
  cached = node_cache[:status_part][index]
677
691
  if cached
678
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
692
+ node_cache[:status_part][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
679
693
  @index = cached.interval.end
680
694
  end
681
695
  return cached
@@ -702,10 +716,12 @@ module ScientificNameClean
702
716
  r1 = nil
703
717
  end
704
718
  if r1
719
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
705
720
  r0 = r1
706
721
  else
707
722
  r5 = _nt_status_word
708
723
  if r5
724
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
709
725
  r0 = r5
710
726
  else
711
727
  @index = i0
@@ -739,7 +755,7 @@ module ScientificNameClean
739
755
  if node_cache[:status_word].has_key?(index)
740
756
  cached = node_cache[:status_word][index]
741
757
  if cached
742
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
758
+ node_cache[:status_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
743
759
  @index = cached.interval.end
744
760
  end
745
761
  return cached
@@ -749,10 +765,11 @@ module ScientificNameClean
749
765
  r1 = _nt_latin_word
750
766
  s0 << r1
751
767
  if r1
752
- if has_terminal?('\G[\\.]', true, index)
768
+ if has_terminal?(@regexps[gr = '\A[\\.]'] ||= Regexp.new(gr), :regexp, index)
753
769
  r2 = true
754
770
  @index += 1
755
771
  else
772
+ terminal_parse_failure('[\\.]')
756
773
  r2 = nil
757
774
  end
758
775
  s0 << r2
@@ -805,7 +822,7 @@ module ScientificNameClean
805
822
  if node_cache[:unparsed].has_key?(index)
806
823
  cached = node_cache[:unparsed][index]
807
824
  if cached
808
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
825
+ node_cache[:unparsed][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
809
826
  @index = cached.interval.end
810
827
  end
811
828
  return cached
@@ -815,7 +832,7 @@ module ScientificNameClean
815
832
  s1, i1 = [], index
816
833
  loop do
817
834
  if index < input_length
818
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
835
+ r2 = true
819
836
  @index += 1
820
837
  else
821
838
  terminal_parse_failure("any character")
@@ -1209,7 +1226,7 @@ module ScientificNameClean
1209
1226
  if node_cache[:multinomial_name].has_key?(index)
1210
1227
  cached = node_cache[:multinomial_name][index]
1211
1228
  if cached
1212
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1229
+ node_cache[:multinomial_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1213
1230
  @index = cached.interval.end
1214
1231
  end
1215
1232
  return cached
@@ -1265,6 +1282,7 @@ module ScientificNameClean
1265
1282
  r1 = nil
1266
1283
  end
1267
1284
  if r1
1285
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1268
1286
  r0 = r1
1269
1287
  else
1270
1288
  i12, s12 = index, []
@@ -1324,6 +1342,7 @@ module ScientificNameClean
1324
1342
  r12 = nil
1325
1343
  end
1326
1344
  if r12
1345
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
1327
1346
  r0 = r12
1328
1347
  else
1329
1348
  i25, s25 = index, []
@@ -1367,6 +1386,7 @@ module ScientificNameClean
1367
1386
  r25 = nil
1368
1387
  end
1369
1388
  if r25
1389
+ r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
1370
1390
  r0 = r25
1371
1391
  else
1372
1392
  i34, s34 = index, []
@@ -1410,6 +1430,7 @@ module ScientificNameClean
1410
1430
  r34 = nil
1411
1431
  end
1412
1432
  if r34
1433
+ r34 = SyntaxNode.new(input, (index-1)...index) if r34 == true
1413
1434
  r0 = r34
1414
1435
  else
1415
1436
  i43, s43 = index, []
@@ -1445,6 +1466,7 @@ module ScientificNameClean
1445
1466
  r43 = nil
1446
1467
  end
1447
1468
  if r43
1469
+ r43 = SyntaxNode.new(input, (index-1)...index) if r43 == true
1448
1470
  r0 = r43
1449
1471
  else
1450
1472
  i50, s50 = index, []
@@ -1475,6 +1497,7 @@ module ScientificNameClean
1475
1497
  r50 = nil
1476
1498
  end
1477
1499
  if r50
1500
+ r50 = SyntaxNode.new(input, (index-1)...index) if r50 == true
1478
1501
  r0 = r50
1479
1502
  else
1480
1503
  @index = i0
@@ -1541,7 +1564,7 @@ module ScientificNameClean
1541
1564
  if node_cache[:multiuninomial_name].has_key?(index)
1542
1565
  cached = node_cache[:multiuninomial_name][index]
1543
1566
  if cached
1544
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1567
+ node_cache[:multiuninomial_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1545
1568
  @index = cached.interval.end
1546
1569
  end
1547
1570
  return cached
@@ -1629,7 +1652,7 @@ module ScientificNameClean
1629
1652
  if node_cache[:infraspecies_mult].has_key?(index)
1630
1653
  cached = node_cache[:infraspecies_mult][index]
1631
1654
  if cached
1632
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1655
+ node_cache[:infraspecies_mult][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1633
1656
  @index = cached.interval.end
1634
1657
  end
1635
1658
  return cached
@@ -1656,11 +1679,13 @@ module ScientificNameClean
1656
1679
  r1 = nil
1657
1680
  end
1658
1681
  if r1
1682
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1659
1683
  r0 = r1
1660
1684
  else
1661
1685
  r5 = _nt_infraspecies
1662
1686
  r5.extend(InfraspeciesMult2)
1663
1687
  if r5
1688
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1664
1689
  r0 = r5
1665
1690
  else
1666
1691
  @index = i0
@@ -1710,7 +1735,7 @@ module ScientificNameClean
1710
1735
  if node_cache[:infraspecies].has_key?(index)
1711
1736
  cached = node_cache[:infraspecies][index]
1712
1737
  if cached
1713
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1738
+ node_cache[:infraspecies][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1714
1739
  @index = cached.interval.end
1715
1740
  end
1716
1741
  return cached
@@ -1737,10 +1762,12 @@ module ScientificNameClean
1737
1762
  r1 = nil
1738
1763
  end
1739
1764
  if r1
1765
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1740
1766
  r0 = r1
1741
1767
  else
1742
1768
  r5 = _nt_infraspecies_string
1743
1769
  if r5
1770
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1744
1771
  r0 = r5
1745
1772
  else
1746
1773
  @index = i0
@@ -1853,7 +1880,7 @@ module ScientificNameClean
1853
1880
  if node_cache[:infraspecies_string].has_key?(index)
1854
1881
  cached = node_cache[:infraspecies_string][index]
1855
1882
  if cached
1856
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1883
+ node_cache[:infraspecies_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1857
1884
  @index = cached.interval.end
1858
1885
  end
1859
1886
  return cached
@@ -1880,6 +1907,7 @@ module ScientificNameClean
1880
1907
  r1 = nil
1881
1908
  end
1882
1909
  if r1
1910
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1883
1911
  r0 = r1
1884
1912
  else
1885
1913
  i5, s5 = index, []
@@ -1893,10 +1921,11 @@ module ScientificNameClean
1893
1921
  s5 << r8
1894
1922
  if r8
1895
1923
  i9 = index
1896
- if has_terminal?('\G[\\.]', true, index)
1924
+ if has_terminal?(@regexps[gr = '\A[\\.]'] ||= Regexp.new(gr), :regexp, index)
1897
1925
  r10 = true
1898
1926
  @index += 1
1899
1927
  else
1928
+ terminal_parse_failure('[\\.]')
1900
1929
  r10 = nil
1901
1930
  end
1902
1931
  if r10
@@ -1918,6 +1947,7 @@ module ScientificNameClean
1918
1947
  r5 = nil
1919
1948
  end
1920
1949
  if r5
1950
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
1921
1951
  r0 = r5
1922
1952
  else
1923
1953
  i11, s11 = index, []
@@ -1925,10 +1955,11 @@ module ScientificNameClean
1925
1955
  s11 << r12
1926
1956
  if r12
1927
1957
  i13 = index
1928
- if has_terminal?('\G[\\.]', true, index)
1958
+ if has_terminal?(@regexps[gr = '\A[\\.]'] ||= Regexp.new(gr), :regexp, index)
1929
1959
  r14 = true
1930
1960
  @index += 1
1931
1961
  else
1962
+ terminal_parse_failure('[\\.]')
1932
1963
  r14 = nil
1933
1964
  end
1934
1965
  if r14
@@ -1948,6 +1979,7 @@ module ScientificNameClean
1948
1979
  r11 = nil
1949
1980
  end
1950
1981
  if r11
1982
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
1951
1983
  r0 = r11
1952
1984
  else
1953
1985
  @index = i0
@@ -1978,32 +2010,34 @@ module ScientificNameClean
1978
2010
  if node_cache[:taxon_concept_rank].has_key?(index)
1979
2011
  cached = node_cache[:taxon_concept_rank][index]
1980
2012
  if cached
1981
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2013
+ node_cache[:taxon_concept_rank][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1982
2014
  @index = cached.interval.end
1983
2015
  end
1984
2016
  return cached
1985
2017
  end
1986
2018
 
1987
2019
  i0 = index
1988
- if has_terminal?("sec.", false, index)
1989
- r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
1990
- @index += 4
2020
+ if (match_len = has_terminal?("sec.", false, index))
2021
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2022
+ @index += match_len
1991
2023
  else
1992
2024
  terminal_parse_failure("sec.")
1993
2025
  r1 = nil
1994
2026
  end
1995
2027
  if r1
2028
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1996
2029
  r0 = r1
1997
2030
  r0.extend(TaxonConceptRank0)
1998
2031
  else
1999
- if has_terminal?("sensu.", false, index)
2000
- r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
2001
- @index += 6
2032
+ if (match_len = has_terminal?("sensu.", false, index))
2033
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2034
+ @index += match_len
2002
2035
  else
2003
2036
  terminal_parse_failure("sensu.")
2004
2037
  r2 = nil
2005
2038
  end
2006
2039
  if r2
2040
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2007
2041
  r0 = r2
2008
2042
  r0.extend(TaxonConceptRank0)
2009
2043
  else
@@ -2045,527 +2079,574 @@ module ScientificNameClean
2045
2079
  if node_cache[:rank].has_key?(index)
2046
2080
  cached = node_cache[:rank][index]
2047
2081
  if cached
2048
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2082
+ node_cache[:rank][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2049
2083
  @index = cached.interval.end
2050
2084
  end
2051
2085
  return cached
2052
2086
  end
2053
2087
 
2054
2088
  i0 = index
2055
- if has_terminal?("morph.", false, index)
2056
- r1 = instantiate_node(SyntaxNode,input, index...(index + 6))
2057
- @index += 6
2089
+ if (match_len = has_terminal?("morph.", false, index))
2090
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2091
+ @index += match_len
2058
2092
  else
2059
2093
  terminal_parse_failure("morph.")
2060
2094
  r1 = nil
2061
2095
  end
2062
2096
  if r1
2097
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2063
2098
  r0 = r1
2064
2099
  r0.extend(Rank0)
2065
2100
  else
2066
- if has_terminal?("f.sp.", false, index)
2067
- r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
2068
- @index += 5
2101
+ if (match_len = has_terminal?("f.sp.", false, index))
2102
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2103
+ @index += match_len
2069
2104
  else
2070
2105
  terminal_parse_failure("f.sp.")
2071
2106
  r2 = nil
2072
2107
  end
2073
2108
  if r2
2109
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2074
2110
  r0 = r2
2075
2111
  r0.extend(Rank0)
2076
2112
  else
2077
- if has_terminal?("B ", false, index)
2078
- r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
2079
- @index += 2
2113
+ if (match_len = has_terminal?("B ", false, index))
2114
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2115
+ @index += match_len
2080
2116
  else
2081
2117
  terminal_parse_failure("B ")
2082
2118
  r3 = nil
2083
2119
  end
2084
2120
  if r3
2121
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2085
2122
  r0 = r3
2086
2123
  r0.extend(Rank0)
2087
2124
  else
2088
- if has_terminal?("ssp.", false, index)
2089
- r4 = instantiate_node(SyntaxNode,input, index...(index + 4))
2090
- @index += 4
2125
+ if (match_len = has_terminal?("ssp.", false, index))
2126
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2127
+ @index += match_len
2091
2128
  else
2092
2129
  terminal_parse_failure("ssp.")
2093
2130
  r4 = nil
2094
2131
  end
2095
2132
  if r4
2133
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
2096
2134
  r0 = r4
2097
2135
  r0.extend(Rank0)
2098
2136
  else
2099
- if has_terminal?("ssp ", false, index)
2100
- r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
2101
- @index += 4
2137
+ if (match_len = has_terminal?("ssp ", false, index))
2138
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2139
+ @index += match_len
2102
2140
  else
2103
2141
  terminal_parse_failure("ssp ")
2104
2142
  r5 = nil
2105
2143
  end
2106
2144
  if r5
2145
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
2107
2146
  r0 = r5
2108
2147
  r0.extend(Rank0)
2109
2148
  else
2110
- if has_terminal?("mut.", false, index)
2111
- r6 = instantiate_node(SyntaxNode,input, index...(index + 4))
2112
- @index += 4
2149
+ if (match_len = has_terminal?("mut.", false, index))
2150
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2151
+ @index += match_len
2113
2152
  else
2114
2153
  terminal_parse_failure("mut.")
2115
2154
  r6 = nil
2116
2155
  end
2117
2156
  if r6
2157
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
2118
2158
  r0 = r6
2119
2159
  r0.extend(Rank0)
2120
2160
  else
2121
- if has_terminal?("nat ", false, index)
2122
- r7 = instantiate_node(SyntaxNode,input, index...(index + 4))
2123
- @index += 4
2161
+ if (match_len = has_terminal?("nat ", false, index))
2162
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2163
+ @index += match_len
2124
2164
  else
2125
2165
  terminal_parse_failure("nat ")
2126
2166
  r7 = nil
2127
2167
  end
2128
2168
  if r7
2169
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
2129
2170
  r0 = r7
2130
2171
  r0.extend(Rank0)
2131
2172
  else
2132
- if has_terminal?("nothosubsp.", false, index)
2133
- r8 = instantiate_node(SyntaxNode,input, index...(index + 11))
2134
- @index += 11
2173
+ if (match_len = has_terminal?("nothosubsp.", false, index))
2174
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2175
+ @index += match_len
2135
2176
  else
2136
2177
  terminal_parse_failure("nothosubsp.")
2137
2178
  r8 = nil
2138
2179
  end
2139
2180
  if r8
2181
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
2140
2182
  r0 = r8
2141
2183
  r0.extend(Rank0)
2142
2184
  else
2143
- if has_terminal?("convar.", false, index)
2144
- r9 = instantiate_node(SyntaxNode,input, index...(index + 7))
2145
- @index += 7
2185
+ if (match_len = has_terminal?("convar.", false, index))
2186
+ r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2187
+ @index += match_len
2146
2188
  else
2147
2189
  terminal_parse_failure("convar.")
2148
2190
  r9 = nil
2149
2191
  end
2150
2192
  if r9
2193
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
2151
2194
  r0 = r9
2152
2195
  r0.extend(Rank0)
2153
2196
  else
2154
- if has_terminal?("pseudovar.", false, index)
2155
- r10 = instantiate_node(SyntaxNode,input, index...(index + 10))
2156
- @index += 10
2197
+ if (match_len = has_terminal?("pseudovar.", false, index))
2198
+ r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2199
+ @index += match_len
2157
2200
  else
2158
2201
  terminal_parse_failure("pseudovar.")
2159
2202
  r10 = nil
2160
2203
  end
2161
2204
  if r10
2205
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
2162
2206
  r0 = r10
2163
2207
  r0.extend(Rank0)
2164
2208
  else
2165
- if has_terminal?("sect.", false, index)
2166
- r11 = instantiate_node(SyntaxNode,input, index...(index + 5))
2167
- @index += 5
2209
+ if (match_len = has_terminal?("sect.", false, index))
2210
+ r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2211
+ @index += match_len
2168
2212
  else
2169
2213
  terminal_parse_failure("sect.")
2170
2214
  r11 = nil
2171
2215
  end
2172
2216
  if r11
2217
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
2173
2218
  r0 = r11
2174
2219
  r0.extend(Rank0)
2175
2220
  else
2176
- if has_terminal?("ser.", false, index)
2177
- r12 = instantiate_node(SyntaxNode,input, index...(index + 4))
2178
- @index += 4
2221
+ if (match_len = has_terminal?("ser.", false, index))
2222
+ r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2223
+ @index += match_len
2179
2224
  else
2180
2225
  terminal_parse_failure("ser.")
2181
2226
  r12 = nil
2182
2227
  end
2183
2228
  if r12
2229
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
2184
2230
  r0 = r12
2185
2231
  r0.extend(Rank0)
2186
2232
  else
2187
- if has_terminal?("var.", false, index)
2188
- r13 = instantiate_node(SyntaxNode,input, index...(index + 4))
2189
- @index += 4
2233
+ if (match_len = has_terminal?("var.", false, index))
2234
+ r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2235
+ @index += match_len
2190
2236
  else
2191
2237
  terminal_parse_failure("var.")
2192
2238
  r13 = nil
2193
2239
  end
2194
2240
  if r13
2241
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
2195
2242
  r0 = r13
2196
2243
  r0.extend(Rank0)
2197
2244
  else
2198
- if has_terminal?("subvar.", false, index)
2199
- r14 = instantiate_node(SyntaxNode,input, index...(index + 7))
2200
- @index += 7
2245
+ if (match_len = has_terminal?("subvar.", false, index))
2246
+ r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2247
+ @index += match_len
2201
2248
  else
2202
2249
  terminal_parse_failure("subvar.")
2203
2250
  r14 = nil
2204
2251
  end
2205
2252
  if r14
2253
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
2206
2254
  r0 = r14
2207
2255
  r0.extend(Rank0)
2208
2256
  else
2209
- if has_terminal?("[var.]", false, index)
2210
- r15 = instantiate_node(SyntaxNode,input, index...(index + 6))
2211
- @index += 6
2257
+ if (match_len = has_terminal?("[var.]", false, index))
2258
+ r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2259
+ @index += match_len
2212
2260
  else
2213
2261
  terminal_parse_failure("[var.]")
2214
2262
  r15 = nil
2215
2263
  end
2216
2264
  if r15
2265
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
2217
2266
  r0 = r15
2218
2267
  r0.extend(Rank0)
2219
2268
  else
2220
- if has_terminal?("var ", false, index)
2221
- r16 = instantiate_node(SyntaxNode,input, index...(index + 4))
2222
- @index += 4
2269
+ if (match_len = has_terminal?("var ", false, index))
2270
+ r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2271
+ @index += match_len
2223
2272
  else
2224
2273
  terminal_parse_failure("var ")
2225
2274
  r16 = nil
2226
2275
  end
2227
2276
  if r16
2277
+ r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
2228
2278
  r0 = r16
2229
2279
  r0.extend(Rank0)
2230
2280
  else
2231
- if has_terminal?("subsp.", false, index)
2232
- r17 = instantiate_node(SyntaxNode,input, index...(index + 6))
2233
- @index += 6
2281
+ if (match_len = has_terminal?("subsp.", false, index))
2282
+ r17 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2283
+ @index += match_len
2234
2284
  else
2235
2285
  terminal_parse_failure("subsp.")
2236
2286
  r17 = nil
2237
2287
  end
2238
2288
  if r17
2289
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
2239
2290
  r0 = r17
2240
2291
  r0.extend(Rank0)
2241
2292
  else
2242
- if has_terminal?("subsp ", false, index)
2243
- r18 = instantiate_node(SyntaxNode,input, index...(index + 6))
2244
- @index += 6
2293
+ if (match_len = has_terminal?("subsp ", false, index))
2294
+ r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2295
+ @index += match_len
2245
2296
  else
2246
2297
  terminal_parse_failure("subsp ")
2247
2298
  r18 = nil
2248
2299
  end
2249
2300
  if r18
2301
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
2250
2302
  r0 = r18
2251
2303
  r0.extend(Rank0)
2252
2304
  else
2253
- if has_terminal?("subf.", false, index)
2254
- r19 = instantiate_node(SyntaxNode,input, index...(index + 5))
2255
- @index += 5
2305
+ if (match_len = has_terminal?("subf.", false, index))
2306
+ r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2307
+ @index += match_len
2256
2308
  else
2257
2309
  terminal_parse_failure("subf.")
2258
2310
  r19 = nil
2259
2311
  end
2260
2312
  if r19
2313
+ r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
2261
2314
  r0 = r19
2262
2315
  r0.extend(Rank0)
2263
2316
  else
2264
- if has_terminal?("race ", false, index)
2265
- r20 = instantiate_node(SyntaxNode,input, index...(index + 5))
2266
- @index += 5
2317
+ if (match_len = has_terminal?("race ", false, index))
2318
+ r20 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2319
+ @index += match_len
2267
2320
  else
2268
2321
  terminal_parse_failure("race ")
2269
2322
  r20 = nil
2270
2323
  end
2271
2324
  if r20
2325
+ r20 = SyntaxNode.new(input, (index-1)...index) if r20 == true
2272
2326
  r0 = r20
2273
2327
  r0.extend(Rank0)
2274
2328
  else
2275
- if has_terminal?("forma ", false, index)
2276
- r21 = instantiate_node(SyntaxNode,input, index...(index + 6))
2277
- @index += 6
2329
+ if (match_len = has_terminal?("forma ", false, index))
2330
+ r21 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2331
+ @index += match_len
2278
2332
  else
2279
2333
  terminal_parse_failure("forma ")
2280
2334
  r21 = nil
2281
2335
  end
2282
2336
  if r21
2337
+ r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
2283
2338
  r0 = r21
2284
2339
  r0.extend(Rank0)
2285
2340
  else
2286
- if has_terminal?("fma.", false, index)
2287
- r22 = instantiate_node(SyntaxNode,input, index...(index + 4))
2288
- @index += 4
2341
+ if (match_len = has_terminal?("fma.", false, index))
2342
+ r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2343
+ @index += match_len
2289
2344
  else
2290
2345
  terminal_parse_failure("fma.")
2291
2346
  r22 = nil
2292
2347
  end
2293
2348
  if r22
2349
+ r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
2294
2350
  r0 = r22
2295
2351
  r0.extend(Rank0)
2296
2352
  else
2297
- if has_terminal?("fma ", false, index)
2298
- r23 = instantiate_node(SyntaxNode,input, index...(index + 4))
2299
- @index += 4
2353
+ if (match_len = has_terminal?("fma ", false, index))
2354
+ r23 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2355
+ @index += match_len
2300
2356
  else
2301
2357
  terminal_parse_failure("fma ")
2302
2358
  r23 = nil
2303
2359
  end
2304
2360
  if r23
2361
+ r23 = SyntaxNode.new(input, (index-1)...index) if r23 == true
2305
2362
  r0 = r23
2306
2363
  r0.extend(Rank0)
2307
2364
  else
2308
- if has_terminal?("form.", false, index)
2309
- r24 = instantiate_node(SyntaxNode,input, index...(index + 5))
2310
- @index += 5
2365
+ if (match_len = has_terminal?("form.", false, index))
2366
+ r24 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2367
+ @index += match_len
2311
2368
  else
2312
2369
  terminal_parse_failure("form.")
2313
2370
  r24 = nil
2314
2371
  end
2315
2372
  if r24
2373
+ r24 = SyntaxNode.new(input, (index-1)...index) if r24 == true
2316
2374
  r0 = r24
2317
2375
  r0.extend(Rank0)
2318
2376
  else
2319
- if has_terminal?("form ", false, index)
2320
- r25 = instantiate_node(SyntaxNode,input, index...(index + 5))
2321
- @index += 5
2377
+ if (match_len = has_terminal?("form ", false, index))
2378
+ r25 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2379
+ @index += match_len
2322
2380
  else
2323
2381
  terminal_parse_failure("form ")
2324
2382
  r25 = nil
2325
2383
  end
2326
2384
  if r25
2385
+ r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
2327
2386
  r0 = r25
2328
2387
  r0.extend(Rank0)
2329
2388
  else
2330
- if has_terminal?("fo.", false, index)
2331
- r26 = instantiate_node(SyntaxNode,input, index...(index + 3))
2332
- @index += 3
2389
+ if (match_len = has_terminal?("fo.", false, index))
2390
+ r26 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2391
+ @index += match_len
2333
2392
  else
2334
2393
  terminal_parse_failure("fo.")
2335
2394
  r26 = nil
2336
2395
  end
2337
2396
  if r26
2397
+ r26 = SyntaxNode.new(input, (index-1)...index) if r26 == true
2338
2398
  r0 = r26
2339
2399
  r0.extend(Rank0)
2340
2400
  else
2341
- if has_terminal?("fo ", false, index)
2342
- r27 = instantiate_node(SyntaxNode,input, index...(index + 3))
2343
- @index += 3
2401
+ if (match_len = has_terminal?("fo ", false, index))
2402
+ r27 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2403
+ @index += match_len
2344
2404
  else
2345
2405
  terminal_parse_failure("fo ")
2346
2406
  r27 = nil
2347
2407
  end
2348
2408
  if r27
2409
+ r27 = SyntaxNode.new(input, (index-1)...index) if r27 == true
2349
2410
  r0 = r27
2350
2411
  r0.extend(Rank0)
2351
2412
  else
2352
- if has_terminal?("f.", false, index)
2353
- r28 = instantiate_node(SyntaxNode,input, index...(index + 2))
2354
- @index += 2
2413
+ if (match_len = has_terminal?("f.", false, index))
2414
+ r28 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2415
+ @index += match_len
2355
2416
  else
2356
2417
  terminal_parse_failure("f.")
2357
2418
  r28 = nil
2358
2419
  end
2359
2420
  if r28
2421
+ r28 = SyntaxNode.new(input, (index-1)...index) if r28 == true
2360
2422
  r0 = r28
2361
2423
  r0.extend(Rank0)
2362
2424
  else
2363
- if has_terminal?("α", false, index)
2364
- r29 = instantiate_node(SyntaxNode,input, index...(index + 1))
2365
- @index += 1
2425
+ if (match_len = has_terminal?("α", false, index))
2426
+ r29 = true
2427
+ @index += match_len
2366
2428
  else
2367
2429
  terminal_parse_failure("α")
2368
2430
  r29 = nil
2369
2431
  end
2370
2432
  if r29
2433
+ r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
2371
2434
  r0 = r29
2372
2435
  r0.extend(Rank0)
2373
2436
  else
2374
- if has_terminal?("ββ", false, index)
2375
- r30 = instantiate_node(SyntaxNode,input, index...(index + 2))
2376
- @index += 2
2437
+ if (match_len = has_terminal?("ββ", false, index))
2438
+ r30 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2439
+ @index += match_len
2377
2440
  else
2378
2441
  terminal_parse_failure("ββ")
2379
2442
  r30 = nil
2380
2443
  end
2381
2444
  if r30
2445
+ r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
2382
2446
  r0 = r30
2383
2447
  r0.extend(Rank0)
2384
2448
  else
2385
- if has_terminal?("β", false, index)
2386
- r31 = instantiate_node(SyntaxNode,input, index...(index + 1))
2387
- @index += 1
2449
+ if (match_len = has_terminal?("β", false, index))
2450
+ r31 = true
2451
+ @index += match_len
2388
2452
  else
2389
2453
  terminal_parse_failure("β")
2390
2454
  r31 = nil
2391
2455
  end
2392
2456
  if r31
2457
+ r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
2393
2458
  r0 = r31
2394
2459
  r0.extend(Rank0)
2395
2460
  else
2396
- if has_terminal?("γ", false, index)
2397
- r32 = instantiate_node(SyntaxNode,input, index...(index + 1))
2398
- @index += 1
2461
+ if (match_len = has_terminal?("γ", false, index))
2462
+ r32 = true
2463
+ @index += match_len
2399
2464
  else
2400
2465
  terminal_parse_failure("γ")
2401
2466
  r32 = nil
2402
2467
  end
2403
2468
  if r32
2469
+ r32 = SyntaxNode.new(input, (index-1)...index) if r32 == true
2404
2470
  r0 = r32
2405
2471
  r0.extend(Rank0)
2406
2472
  else
2407
- if has_terminal?("δ", false, index)
2408
- r33 = instantiate_node(SyntaxNode,input, index...(index + 1))
2409
- @index += 1
2473
+ if (match_len = has_terminal?("δ", false, index))
2474
+ r33 = true
2475
+ @index += match_len
2410
2476
  else
2411
2477
  terminal_parse_failure("δ")
2412
2478
  r33 = nil
2413
2479
  end
2414
2480
  if r33
2481
+ r33 = SyntaxNode.new(input, (index-1)...index) if r33 == true
2415
2482
  r0 = r33
2416
2483
  r0.extend(Rank0)
2417
2484
  else
2418
- if has_terminal?("ε", false, index)
2419
- r34 = instantiate_node(SyntaxNode,input, index...(index + 1))
2420
- @index += 1
2485
+ if (match_len = has_terminal?("ε", false, index))
2486
+ r34 = true
2487
+ @index += match_len
2421
2488
  else
2422
2489
  terminal_parse_failure("ε")
2423
2490
  r34 = nil
2424
2491
  end
2425
2492
  if r34
2493
+ r34 = SyntaxNode.new(input, (index-1)...index) if r34 == true
2426
2494
  r0 = r34
2427
2495
  r0.extend(Rank0)
2428
2496
  else
2429
- if has_terminal?("φ", false, index)
2430
- r35 = instantiate_node(SyntaxNode,input, index...(index + 1))
2431
- @index += 1
2497
+ if (match_len = has_terminal?("φ", false, index))
2498
+ r35 = true
2499
+ @index += match_len
2432
2500
  else
2433
2501
  terminal_parse_failure("φ")
2434
2502
  r35 = nil
2435
2503
  end
2436
2504
  if r35
2505
+ r35 = SyntaxNode.new(input, (index-1)...index) if r35 == true
2437
2506
  r0 = r35
2438
2507
  r0.extend(Rank0)
2439
2508
  else
2440
- if has_terminal?("θ", false, index)
2441
- r36 = instantiate_node(SyntaxNode,input, index...(index + 1))
2442
- @index += 1
2509
+ if (match_len = has_terminal?("θ", false, index))
2510
+ r36 = true
2511
+ @index += match_len
2443
2512
  else
2444
2513
  terminal_parse_failure("θ")
2445
2514
  r36 = nil
2446
2515
  end
2447
2516
  if r36
2517
+ r36 = SyntaxNode.new(input, (index-1)...index) if r36 == true
2448
2518
  r0 = r36
2449
2519
  r0.extend(Rank0)
2450
2520
  else
2451
- if has_terminal?("μ", false, index)
2452
- r37 = instantiate_node(SyntaxNode,input, index...(index + 1))
2453
- @index += 1
2521
+ if (match_len = has_terminal?("μ", false, index))
2522
+ r37 = true
2523
+ @index += match_len
2454
2524
  else
2455
2525
  terminal_parse_failure("μ")
2456
2526
  r37 = nil
2457
2527
  end
2458
2528
  if r37
2529
+ r37 = SyntaxNode.new(input, (index-1)...index) if r37 == true
2459
2530
  r0 = r37
2460
2531
  r0.extend(Rank0)
2461
2532
  else
2462
- if has_terminal?("a.", false, index)
2463
- r38 = instantiate_node(SyntaxNode,input, index...(index + 2))
2464
- @index += 2
2533
+ if (match_len = has_terminal?("a.", false, index))
2534
+ r38 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2535
+ @index += match_len
2465
2536
  else
2466
2537
  terminal_parse_failure("a.")
2467
2538
  r38 = nil
2468
2539
  end
2469
2540
  if r38
2541
+ r38 = SyntaxNode.new(input, (index-1)...index) if r38 == true
2470
2542
  r0 = r38
2471
2543
  r0.extend(Rank0)
2472
2544
  else
2473
- if has_terminal?("b.", false, index)
2474
- r39 = instantiate_node(SyntaxNode,input, index...(index + 2))
2475
- @index += 2
2545
+ if (match_len = has_terminal?("b.", false, index))
2546
+ r39 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2547
+ @index += match_len
2476
2548
  else
2477
2549
  terminal_parse_failure("b.")
2478
2550
  r39 = nil
2479
2551
  end
2480
2552
  if r39
2553
+ r39 = SyntaxNode.new(input, (index-1)...index) if r39 == true
2481
2554
  r0 = r39
2482
2555
  r0.extend(Rank0)
2483
2556
  else
2484
- if has_terminal?("c.", false, index)
2485
- r40 = instantiate_node(SyntaxNode,input, index...(index + 2))
2486
- @index += 2
2557
+ if (match_len = has_terminal?("c.", false, index))
2558
+ r40 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2559
+ @index += match_len
2487
2560
  else
2488
2561
  terminal_parse_failure("c.")
2489
2562
  r40 = nil
2490
2563
  end
2491
2564
  if r40
2565
+ r40 = SyntaxNode.new(input, (index-1)...index) if r40 == true
2492
2566
  r0 = r40
2493
2567
  r0.extend(Rank0)
2494
2568
  else
2495
- if has_terminal?("d.", false, index)
2496
- r41 = instantiate_node(SyntaxNode,input, index...(index + 2))
2497
- @index += 2
2569
+ if (match_len = has_terminal?("d.", false, index))
2570
+ r41 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2571
+ @index += match_len
2498
2572
  else
2499
2573
  terminal_parse_failure("d.")
2500
2574
  r41 = nil
2501
2575
  end
2502
2576
  if r41
2577
+ r41 = SyntaxNode.new(input, (index-1)...index) if r41 == true
2503
2578
  r0 = r41
2504
2579
  r0.extend(Rank0)
2505
2580
  else
2506
- if has_terminal?("e.", false, index)
2507
- r42 = instantiate_node(SyntaxNode,input, index...(index + 2))
2508
- @index += 2
2581
+ if (match_len = has_terminal?("e.", false, index))
2582
+ r42 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2583
+ @index += match_len
2509
2584
  else
2510
2585
  terminal_parse_failure("e.")
2511
2586
  r42 = nil
2512
2587
  end
2513
2588
  if r42
2589
+ r42 = SyntaxNode.new(input, (index-1)...index) if r42 == true
2514
2590
  r0 = r42
2515
2591
  r0.extend(Rank0)
2516
2592
  else
2517
- if has_terminal?("g.", false, index)
2518
- r43 = instantiate_node(SyntaxNode,input, index...(index + 2))
2519
- @index += 2
2593
+ if (match_len = has_terminal?("g.", false, index))
2594
+ r43 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2595
+ @index += match_len
2520
2596
  else
2521
2597
  terminal_parse_failure("g.")
2522
2598
  r43 = nil
2523
2599
  end
2524
2600
  if r43
2601
+ r43 = SyntaxNode.new(input, (index-1)...index) if r43 == true
2525
2602
  r0 = r43
2526
2603
  r0.extend(Rank0)
2527
2604
  else
2528
- if has_terminal?("k.", false, index)
2529
- r44 = instantiate_node(SyntaxNode,input, index...(index + 2))
2530
- @index += 2
2605
+ if (match_len = has_terminal?("k.", false, index))
2606
+ r44 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2607
+ @index += match_len
2531
2608
  else
2532
2609
  terminal_parse_failure("k.")
2533
2610
  r44 = nil
2534
2611
  end
2535
2612
  if r44
2613
+ r44 = SyntaxNode.new(input, (index-1)...index) if r44 == true
2536
2614
  r0 = r44
2537
2615
  r0.extend(Rank0)
2538
2616
  else
2539
- if has_terminal?("****", false, index)
2540
- r45 = instantiate_node(SyntaxNode,input, index...(index + 4))
2541
- @index += 4
2617
+ if (match_len = has_terminal?("****", false, index))
2618
+ r45 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2619
+ @index += match_len
2542
2620
  else
2543
2621
  terminal_parse_failure("****")
2544
2622
  r45 = nil
2545
2623
  end
2546
2624
  if r45
2625
+ r45 = SyntaxNode.new(input, (index-1)...index) if r45 == true
2547
2626
  r0 = r45
2548
2627
  r0.extend(Rank0)
2549
2628
  else
2550
- if has_terminal?("**", false, index)
2551
- r46 = instantiate_node(SyntaxNode,input, index...(index + 2))
2552
- @index += 2
2629
+ if (match_len = has_terminal?("**", false, index))
2630
+ r46 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2631
+ @index += match_len
2553
2632
  else
2554
2633
  terminal_parse_failure("**")
2555
2634
  r46 = nil
2556
2635
  end
2557
2636
  if r46
2637
+ r46 = SyntaxNode.new(input, (index-1)...index) if r46 == true
2558
2638
  r0 = r46
2559
2639
  r0.extend(Rank0)
2560
2640
  else
2561
- if has_terminal?("*", false, index)
2562
- r47 = instantiate_node(SyntaxNode,input, index...(index + 1))
2563
- @index += 1
2641
+ if (match_len = has_terminal?("*", false, index))
2642
+ r47 = true
2643
+ @index += match_len
2564
2644
  else
2565
2645
  terminal_parse_failure("*")
2566
2646
  r47 = nil
2567
2647
  end
2568
2648
  if r47
2649
+ r47 = SyntaxNode.new(input, (index-1)...index) if r47 == true
2569
2650
  r0 = r47
2570
2651
  r0.extend(Rank0)
2571
2652
  else
@@ -2643,208 +2724,226 @@ module ScientificNameClean
2643
2724
  if node_cache[:rank_uninomial].has_key?(index)
2644
2725
  cached = node_cache[:rank_uninomial][index]
2645
2726
  if cached
2646
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2727
+ node_cache[:rank_uninomial][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2647
2728
  @index = cached.interval.end
2648
2729
  end
2649
2730
  return cached
2650
2731
  end
2651
2732
 
2652
2733
  i0 = index
2653
- if has_terminal?("sect.", false, index)
2654
- r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
2655
- @index += 5
2734
+ if (match_len = has_terminal?("sect.", false, index))
2735
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2736
+ @index += match_len
2656
2737
  else
2657
2738
  terminal_parse_failure("sect.")
2658
2739
  r1 = nil
2659
2740
  end
2660
2741
  if r1
2742
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2661
2743
  r0 = r1
2662
2744
  r0.extend(RankUninomial0)
2663
2745
  else
2664
- if has_terminal?("sect ", false, index)
2665
- r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
2666
- @index += 5
2746
+ if (match_len = has_terminal?("sect ", false, index))
2747
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2748
+ @index += match_len
2667
2749
  else
2668
2750
  terminal_parse_failure("sect ")
2669
2751
  r2 = nil
2670
2752
  end
2671
2753
  if r2
2754
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2672
2755
  r0 = r2
2673
2756
  r0.extend(RankUninomial0)
2674
2757
  else
2675
- if has_terminal?("subsect.", false, index)
2676
- r3 = instantiate_node(SyntaxNode,input, index...(index + 8))
2677
- @index += 8
2758
+ if (match_len = has_terminal?("subsect.", false, index))
2759
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2760
+ @index += match_len
2678
2761
  else
2679
2762
  terminal_parse_failure("subsect.")
2680
2763
  r3 = nil
2681
2764
  end
2682
2765
  if r3
2766
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2683
2767
  r0 = r3
2684
2768
  r0.extend(RankUninomial0)
2685
2769
  else
2686
- if has_terminal?("subsect ", false, index)
2687
- r4 = instantiate_node(SyntaxNode,input, index...(index + 8))
2688
- @index += 8
2770
+ if (match_len = has_terminal?("subsect ", false, index))
2771
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2772
+ @index += match_len
2689
2773
  else
2690
2774
  terminal_parse_failure("subsect ")
2691
2775
  r4 = nil
2692
2776
  end
2693
2777
  if r4
2778
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
2694
2779
  r0 = r4
2695
2780
  r0.extend(RankUninomial0)
2696
2781
  else
2697
- if has_terminal?("trib.", false, index)
2698
- r5 = instantiate_node(SyntaxNode,input, index...(index + 5))
2699
- @index += 5
2782
+ if (match_len = has_terminal?("trib.", false, index))
2783
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2784
+ @index += match_len
2700
2785
  else
2701
2786
  terminal_parse_failure("trib.")
2702
2787
  r5 = nil
2703
2788
  end
2704
2789
  if r5
2790
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
2705
2791
  r0 = r5
2706
2792
  r0.extend(RankUninomial0)
2707
2793
  else
2708
- if has_terminal?("trib ", false, index)
2709
- r6 = instantiate_node(SyntaxNode,input, index...(index + 5))
2710
- @index += 5
2794
+ if (match_len = has_terminal?("trib ", false, index))
2795
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2796
+ @index += match_len
2711
2797
  else
2712
2798
  terminal_parse_failure("trib ")
2713
2799
  r6 = nil
2714
2800
  end
2715
2801
  if r6
2802
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
2716
2803
  r0 = r6
2717
2804
  r0.extend(RankUninomial0)
2718
2805
  else
2719
- if has_terminal?("subtrib.", false, index)
2720
- r7 = instantiate_node(SyntaxNode,input, index...(index + 8))
2721
- @index += 8
2806
+ if (match_len = has_terminal?("subtrib.", false, index))
2807
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2808
+ @index += match_len
2722
2809
  else
2723
2810
  terminal_parse_failure("subtrib.")
2724
2811
  r7 = nil
2725
2812
  end
2726
2813
  if r7
2814
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
2727
2815
  r0 = r7
2728
2816
  r0.extend(RankUninomial0)
2729
2817
  else
2730
- if has_terminal?("subtrib ", false, index)
2731
- r8 = instantiate_node(SyntaxNode,input, index...(index + 8))
2732
- @index += 8
2818
+ if (match_len = has_terminal?("subtrib ", false, index))
2819
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2820
+ @index += match_len
2733
2821
  else
2734
2822
  terminal_parse_failure("subtrib ")
2735
2823
  r8 = nil
2736
2824
  end
2737
2825
  if r8
2826
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
2738
2827
  r0 = r8
2739
2828
  r0.extend(RankUninomial0)
2740
2829
  else
2741
- if has_terminal?("ser.", false, index)
2742
- r9 = instantiate_node(SyntaxNode,input, index...(index + 4))
2743
- @index += 4
2830
+ if (match_len = has_terminal?("ser.", false, index))
2831
+ r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2832
+ @index += match_len
2744
2833
  else
2745
2834
  terminal_parse_failure("ser.")
2746
2835
  r9 = nil
2747
2836
  end
2748
2837
  if r9
2838
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
2749
2839
  r0 = r9
2750
2840
  r0.extend(RankUninomial0)
2751
2841
  else
2752
- if has_terminal?("ser ", false, index)
2753
- r10 = instantiate_node(SyntaxNode,input, index...(index + 4))
2754
- @index += 4
2842
+ if (match_len = has_terminal?("ser ", false, index))
2843
+ r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2844
+ @index += match_len
2755
2845
  else
2756
2846
  terminal_parse_failure("ser ")
2757
2847
  r10 = nil
2758
2848
  end
2759
2849
  if r10
2850
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
2760
2851
  r0 = r10
2761
2852
  r0.extend(RankUninomial0)
2762
2853
  else
2763
- if has_terminal?("subgen.", false, index)
2764
- r11 = instantiate_node(SyntaxNode,input, index...(index + 7))
2765
- @index += 7
2854
+ if (match_len = has_terminal?("subgen.", false, index))
2855
+ r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2856
+ @index += match_len
2766
2857
  else
2767
2858
  terminal_parse_failure("subgen.")
2768
2859
  r11 = nil
2769
2860
  end
2770
2861
  if r11
2862
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
2771
2863
  r0 = r11
2772
2864
  r0.extend(RankUninomial0)
2773
2865
  else
2774
- if has_terminal?("subgen ", false, index)
2775
- r12 = instantiate_node(SyntaxNode,input, index...(index + 7))
2776
- @index += 7
2866
+ if (match_len = has_terminal?("subgen ", false, index))
2867
+ r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2868
+ @index += match_len
2777
2869
  else
2778
2870
  terminal_parse_failure("subgen ")
2779
2871
  r12 = nil
2780
2872
  end
2781
2873
  if r12
2874
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
2782
2875
  r0 = r12
2783
2876
  r0.extend(RankUninomial0)
2784
2877
  else
2785
- if has_terminal?("fam.", false, index)
2786
- r13 = instantiate_node(SyntaxNode,input, index...(index + 4))
2787
- @index += 4
2878
+ if (match_len = has_terminal?("fam.", false, index))
2879
+ r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2880
+ @index += match_len
2788
2881
  else
2789
2882
  terminal_parse_failure("fam.")
2790
2883
  r13 = nil
2791
2884
  end
2792
2885
  if r13
2886
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
2793
2887
  r0 = r13
2794
2888
  r0.extend(RankUninomial0)
2795
2889
  else
2796
- if has_terminal?("fam ", false, index)
2797
- r14 = instantiate_node(SyntaxNode,input, index...(index + 4))
2798
- @index += 4
2890
+ if (match_len = has_terminal?("fam ", false, index))
2891
+ r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2892
+ @index += match_len
2799
2893
  else
2800
2894
  terminal_parse_failure("fam ")
2801
2895
  r14 = nil
2802
2896
  end
2803
2897
  if r14
2898
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
2804
2899
  r0 = r14
2805
2900
  r0.extend(RankUninomial0)
2806
2901
  else
2807
- if has_terminal?("subfam.", false, index)
2808
- r15 = instantiate_node(SyntaxNode,input, index...(index + 7))
2809
- @index += 7
2902
+ if (match_len = has_terminal?("subfam.", false, index))
2903
+ r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2904
+ @index += match_len
2810
2905
  else
2811
2906
  terminal_parse_failure("subfam.")
2812
2907
  r15 = nil
2813
2908
  end
2814
2909
  if r15
2910
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
2815
2911
  r0 = r15
2816
2912
  r0.extend(RankUninomial0)
2817
2913
  else
2818
- if has_terminal?("subfam ", false, index)
2819
- r16 = instantiate_node(SyntaxNode,input, index...(index + 7))
2820
- @index += 7
2914
+ if (match_len = has_terminal?("subfam ", false, index))
2915
+ r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2916
+ @index += match_len
2821
2917
  else
2822
2918
  terminal_parse_failure("subfam ")
2823
2919
  r16 = nil
2824
2920
  end
2825
2921
  if r16
2922
+ r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
2826
2923
  r0 = r16
2827
2924
  r0.extend(RankUninomial0)
2828
2925
  else
2829
- if has_terminal?("supertrib.", false, index)
2830
- r17 = instantiate_node(SyntaxNode,input, index...(index + 10))
2831
- @index += 10
2926
+ if (match_len = has_terminal?("supertrib.", false, index))
2927
+ r17 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2928
+ @index += match_len
2832
2929
  else
2833
2930
  terminal_parse_failure("supertrib.")
2834
2931
  r17 = nil
2835
2932
  end
2836
2933
  if r17
2934
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
2837
2935
  r0 = r17
2838
2936
  r0.extend(RankUninomial0)
2839
2937
  else
2840
- if has_terminal?("supertrib ", false, index)
2841
- r18 = instantiate_node(SyntaxNode,input, index...(index + 10))
2842
- @index += 10
2938
+ if (match_len = has_terminal?("supertrib ", false, index))
2939
+ r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2940
+ @index += match_len
2843
2941
  else
2844
2942
  terminal_parse_failure("supertrib ")
2845
2943
  r18 = nil
2846
2944
  end
2847
2945
  if r18
2946
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
2848
2947
  r0 = r18
2849
2948
  r0.extend(RankUninomial0)
2850
2949
  else
@@ -2915,7 +3014,7 @@ module ScientificNameClean
2915
3014
  if node_cache[:species].has_key?(index)
2916
3015
  cached = node_cache[:species][index]
2917
3016
  if cached
2918
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3017
+ node_cache[:species][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2919
3018
  @index = cached.interval.end
2920
3019
  end
2921
3020
  return cached
@@ -2942,10 +3041,12 @@ module ScientificNameClean
2942
3041
  r1 = nil
2943
3042
  end
2944
3043
  if r1
3044
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2945
3045
  r0 = r1
2946
3046
  else
2947
3047
  r5 = _nt_species_string
2948
3048
  if r5
3049
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
2949
3050
  r0 = r5
2950
3051
  else
2951
3052
  @index = i0
@@ -2981,7 +3082,7 @@ module ScientificNameClean
2981
3082
  if node_cache[:species_string].has_key?(index)
2982
3083
  cached = node_cache[:species_string][index]
2983
3084
  if cached
2984
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3085
+ node_cache[:species_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2985
3086
  @index = cached.interval.end
2986
3087
  end
2987
3088
  return cached
@@ -2991,10 +3092,12 @@ module ScientificNameClean
2991
3092
  r1 = _nt_species_word
2992
3093
  r1.extend(SpeciesString0)
2993
3094
  if r1
3095
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2994
3096
  r0 = r1
2995
3097
  else
2996
3098
  r2 = _nt_species_word_hybrid
2997
3099
  if r2
3100
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2998
3101
  r0 = r2
2999
3102
  else
3000
3103
  @index = i0
@@ -3052,7 +3155,7 @@ module ScientificNameClean
3052
3155
  if node_cache[:infragenus].has_key?(index)
3053
3156
  cached = node_cache[:infragenus][index]
3054
3157
  if cached
3055
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3158
+ node_cache[:infragenus][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3056
3159
  @index = cached.interval.end
3057
3160
  end
3058
3161
  return cached
@@ -3068,10 +3171,12 @@ module ScientificNameClean
3068
3171
  i3 = index
3069
3172
  r4 = _nt_cap_latin_word
3070
3173
  if r4
3174
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3071
3175
  r3 = r4
3072
3176
  else
3073
3177
  r5 = _nt_capped_dotted_char
3074
3178
  if r5
3179
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3075
3180
  r3 = r5
3076
3181
  else
3077
3182
  @index = i3
@@ -3151,7 +3256,7 @@ module ScientificNameClean
3151
3256
  if node_cache[:genus].has_key?(index)
3152
3257
  cached = node_cache[:genus][index]
3153
3258
  if cached
3154
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3259
+ node_cache[:genus][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3155
3260
  @index = cached.interval.end
3156
3261
  end
3157
3262
  return cached
@@ -3161,10 +3266,12 @@ module ScientificNameClean
3161
3266
  i1 = index
3162
3267
  r2 = _nt_abbreviated_genus
3163
3268
  if r2
3269
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3164
3270
  r1 = r2
3165
3271
  else
3166
3272
  r3 = _nt_uninomial_string
3167
3273
  if r3
3274
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3168
3275
  r1 = r3
3169
3276
  else
3170
3277
  @index = i1
@@ -3247,25 +3354,27 @@ module ScientificNameClean
3247
3354
  if node_cache[:abbreviated_genus].has_key?(index)
3248
3355
  cached = node_cache[:abbreviated_genus][index]
3249
3356
  if cached
3250
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3357
+ node_cache[:abbreviated_genus][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3251
3358
  @index = cached.interval.end
3252
3359
  end
3253
3360
  return cached
3254
3361
  end
3255
3362
 
3256
3363
  i0, s0 = index, []
3257
- if has_terminal?('\G[A-Z]', true, index)
3364
+ if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
3258
3365
  r1 = true
3259
3366
  @index += 1
3260
3367
  else
3368
+ terminal_parse_failure('[A-Z]')
3261
3369
  r1 = nil
3262
3370
  end
3263
3371
  s0 << r1
3264
3372
  if r1
3265
- if has_terminal?('\G[a-z]', true, index)
3373
+ if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
3266
3374
  r3 = true
3267
3375
  @index += 1
3268
3376
  else
3377
+ terminal_parse_failure('[a-z]')
3269
3378
  r3 = nil
3270
3379
  end
3271
3380
  if r3
@@ -3275,10 +3384,11 @@ module ScientificNameClean
3275
3384
  end
3276
3385
  s0 << r2
3277
3386
  if r2
3278
- if has_terminal?('\G[a-z]', true, index)
3387
+ if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
3279
3388
  r5 = true
3280
3389
  @index += 1
3281
3390
  else
3391
+ terminal_parse_failure('[a-z]')
3282
3392
  r5 = nil
3283
3393
  end
3284
3394
  if r5
@@ -3288,10 +3398,11 @@ module ScientificNameClean
3288
3398
  end
3289
3399
  s0 << r4
3290
3400
  if r4
3291
- if has_terminal?('\G[\\\\.]', true, index)
3401
+ if has_terminal?(@regexps[gr = '\A[\\\\.]'] ||= Regexp.new(gr), :regexp, index)
3292
3402
  r6 = true
3293
3403
  @index += 1
3294
3404
  else
3405
+ terminal_parse_failure('[\\\\.]')
3295
3406
  r6 = nil
3296
3407
  end
3297
3408
  s0 << r6
@@ -3437,7 +3548,7 @@ module ScientificNameClean
3437
3548
  if node_cache[:uninomial_name].has_key?(index)
3438
3549
  cached = node_cache[:uninomial_name][index]
3439
3550
  if cached
3440
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3551
+ node_cache[:uninomial_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3441
3552
  @index = cached.interval.end
3442
3553
  end
3443
3554
  return cached
@@ -3472,6 +3583,7 @@ module ScientificNameClean
3472
3583
  r1 = nil
3473
3584
  end
3474
3585
  if r1
3586
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3475
3587
  r0 = r1
3476
3588
  else
3477
3589
  i7, s7 = index, []
@@ -3494,6 +3606,7 @@ module ScientificNameClean
3494
3606
  r7 = nil
3495
3607
  end
3496
3608
  if r7
3609
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
3497
3610
  r0 = r7
3498
3611
  else
3499
3612
  i11, s11 = index, []
@@ -3516,10 +3629,12 @@ module ScientificNameClean
3516
3629
  r11 = nil
3517
3630
  end
3518
3631
  if r11
3632
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
3519
3633
  r0 = r11
3520
3634
  else
3521
3635
  r15 = _nt_uninomial_string
3522
3636
  if r15
3637
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
3523
3638
  r0 = r15
3524
3639
  else
3525
3640
  @index = i0
@@ -3557,7 +3672,7 @@ module ScientificNameClean
3557
3672
  if node_cache[:uninomial_string].has_key?(index)
3558
3673
  cached = node_cache[:uninomial_string][index]
3559
3674
  if cached
3560
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3675
+ node_cache[:uninomial_string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3561
3676
  @index = cached.interval.end
3562
3677
  end
3563
3678
  return cached
@@ -3566,11 +3681,13 @@ module ScientificNameClean
3566
3681
  i0 = index
3567
3682
  r1 = _nt_cap_latin_word_pair
3568
3683
  if r1
3684
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3569
3685
  r0 = r1
3570
3686
  r0.extend(UninomialString0)
3571
3687
  else
3572
3688
  r2 = _nt_cap_latin_word
3573
3689
  if r2
3690
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3574
3691
  r0 = r2
3575
3692
  r0.extend(UninomialString0)
3576
3693
  else
@@ -3686,7 +3803,7 @@ module ScientificNameClean
3686
3803
  if node_cache[:authorship].has_key?(index)
3687
3804
  cached = node_cache[:authorship][index]
3688
3805
  if cached
3689
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3806
+ node_cache[:authorship][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3690
3807
  @index = cached.interval.end
3691
3808
  end
3692
3809
  return cached
@@ -3703,9 +3820,9 @@ module ScientificNameClean
3703
3820
  r4 = _nt_simple_authorship
3704
3821
  s1 << r4
3705
3822
  if r4
3706
- if has_terminal?(",", false, index)
3707
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
3708
- @index += 1
3823
+ if (match_len = has_terminal?(",", false, index))
3824
+ r6 = true
3825
+ @index += match_len
3709
3826
  else
3710
3827
  terminal_parse_failure(",")
3711
3828
  r6 = nil
@@ -3736,6 +3853,7 @@ module ScientificNameClean
3736
3853
  r1 = nil
3737
3854
  end
3738
3855
  if r1
3856
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3739
3857
  r0 = r1
3740
3858
  else
3741
3859
  i9, s9 = index, []
@@ -3758,19 +3876,21 @@ module ScientificNameClean
3758
3876
  r9 = nil
3759
3877
  end
3760
3878
  if r9
3879
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
3761
3880
  r0 = r9
3762
3881
  else
3763
3882
  r13 = _nt_basionym_authorship_with_parenthesis
3764
3883
  if r13
3884
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
3765
3885
  r0 = r13
3766
3886
  else
3767
3887
  i14, s14 = index, []
3768
3888
  r15 = _nt_simple_authorship
3769
3889
  s14 << r15
3770
3890
  if r15
3771
- if has_terminal?(",", false, index)
3772
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
3773
- @index += 1
3891
+ if (match_len = has_terminal?(",", false, index))
3892
+ r17 = true
3893
+ @index += match_len
3774
3894
  else
3775
3895
  terminal_parse_failure(",")
3776
3896
  r17 = nil
@@ -3799,10 +3919,12 @@ module ScientificNameClean
3799
3919
  r14 = nil
3800
3920
  end
3801
3921
  if r14
3922
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
3802
3923
  r0 = r14
3803
3924
  else
3804
3925
  r20 = _nt_simple_authorship
3805
3926
  if r20
3927
+ r20 = SyntaxNode.new(input, (index-1)...index) if r20 == true
3806
3928
  r0 = r20
3807
3929
  else
3808
3930
  @index = i0
@@ -3994,7 +4116,7 @@ module ScientificNameClean
3994
4116
  if node_cache[:basionym_authorship_with_parenthesis].has_key?(index)
3995
4117
  cached = node_cache[:basionym_authorship_with_parenthesis][index]
3996
4118
  if cached
3997
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4119
+ node_cache[:basionym_authorship_with_parenthesis][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3998
4120
  @index = cached.interval.end
3999
4121
  end
4000
4122
  return cached
@@ -4020,10 +4142,11 @@ module ScientificNameClean
4020
4142
  r7 = _nt_space
4021
4143
  s1 << r7
4022
4144
  if r7
4023
- if has_terminal?('\G[,]', true, index)
4145
+ if has_terminal?(@regexps[gr = '\A[,]'] ||= Regexp.new(gr), :regexp, index)
4024
4146
  r9 = true
4025
4147
  @index += 1
4026
4148
  else
4149
+ terminal_parse_failure('[,]')
4027
4150
  r9 = nil
4028
4151
  end
4029
4152
  if r9
@@ -4055,6 +4178,7 @@ module ScientificNameClean
4055
4178
  r1 = nil
4056
4179
  end
4057
4180
  if r1
4181
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
4058
4182
  r0 = r1
4059
4183
  else
4060
4184
  i12, s12 = index, []
@@ -4067,9 +4191,9 @@ module ScientificNameClean
4067
4191
  r15 = _nt_simple_authorship
4068
4192
  s12 << r15
4069
4193
  if r15
4070
- if has_terminal?(",", false, index)
4071
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
4072
- @index += 1
4194
+ if (match_len = has_terminal?(",", false, index))
4195
+ r17 = true
4196
+ @index += match_len
4073
4197
  else
4074
4198
  terminal_parse_failure(",")
4075
4199
  r17 = nil
@@ -4108,6 +4232,7 @@ module ScientificNameClean
4108
4232
  r12 = nil
4109
4233
  end
4110
4234
  if r12
4235
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
4111
4236
  r0 = r12
4112
4237
  else
4113
4238
  i22, s22 = index, []
@@ -4138,6 +4263,7 @@ module ScientificNameClean
4138
4263
  r22 = nil
4139
4264
  end
4140
4265
  if r22
4266
+ r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
4141
4267
  r0 = r22
4142
4268
  else
4143
4269
  i28, s28 = index, []
@@ -4147,9 +4273,9 @@ module ScientificNameClean
4147
4273
  r30 = _nt_space
4148
4274
  s28 << r30
4149
4275
  if r30
4150
- if has_terminal?("?", false, index)
4151
- r31 = instantiate_node(SyntaxNode,input, index...(index + 1))
4152
- @index += 1
4276
+ if (match_len = has_terminal?("?", false, index))
4277
+ r31 = true
4278
+ @index += match_len
4153
4279
  else
4154
4280
  terminal_parse_failure("?")
4155
4281
  r31 = nil
@@ -4174,6 +4300,7 @@ module ScientificNameClean
4174
4300
  r28 = nil
4175
4301
  end
4176
4302
  if r28
4303
+ r28 = SyntaxNode.new(input, (index-1)...index) if r28 == true
4177
4304
  r0 = r28
4178
4305
  else
4179
4306
  @index = i0
@@ -4222,7 +4349,7 @@ module ScientificNameClean
4222
4349
  if node_cache[:ex_authorship].has_key?(index)
4223
4350
  cached = node_cache[:ex_authorship][index]
4224
4351
  if cached
4225
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4352
+ node_cache[:ex_authorship][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4226
4353
  @index = cached.interval.end
4227
4354
  end
4228
4355
  return cached
@@ -4378,7 +4505,7 @@ module ScientificNameClean
4378
4505
  if node_cache[:simple_authorship].has_key?(index)
4379
4506
  cached = node_cache[:simple_authorship][index]
4380
4507
  if cached
4381
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4508
+ node_cache[:simple_authorship][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4382
4509
  @index = cached.interval.end
4383
4510
  end
4384
4511
  return cached
@@ -4392,10 +4519,11 @@ module ScientificNameClean
4392
4519
  r3 = _nt_space
4393
4520
  s1 << r3
4394
4521
  if r3
4395
- if has_terminal?('\G[,]', true, index)
4522
+ if has_terminal?(@regexps[gr = '\A[,]'] ||= Regexp.new(gr), :regexp, index)
4396
4523
  r5 = true
4397
4524
  @index += 1
4398
4525
  else
4526
+ terminal_parse_failure('[,]')
4399
4527
  r5 = nil
4400
4528
  end
4401
4529
  if r5
@@ -4416,10 +4544,11 @@ module ScientificNameClean
4416
4544
  end
4417
4545
  s1 << r7
4418
4546
  if r7
4419
- if has_terminal?('\G[,]', true, index)
4547
+ if has_terminal?(@regexps[gr = '\A[,]'] ||= Regexp.new(gr), :regexp, index)
4420
4548
  r10 = true
4421
4549
  @index += 1
4422
4550
  else
4551
+ terminal_parse_failure('[,]')
4423
4552
  r10 = nil
4424
4553
  end
4425
4554
  if r10
@@ -4432,9 +4561,9 @@ module ScientificNameClean
4432
4561
  r11 = _nt_space
4433
4562
  s1 << r11
4434
4563
  if r11
4435
- if has_terminal?("non", false, index)
4436
- r12 = instantiate_node(SyntaxNode,input, index...(index + 3))
4437
- @index += 3
4564
+ if (match_len = has_terminal?("non", false, index))
4565
+ r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4566
+ @index += match_len
4438
4567
  else
4439
4568
  terminal_parse_failure("non")
4440
4569
  r12 = nil
@@ -4450,10 +4579,11 @@ module ScientificNameClean
4450
4579
  r15 = _nt_space
4451
4580
  s1 << r15
4452
4581
  if r15
4453
- if has_terminal?('\G[,]', true, index)
4582
+ if has_terminal?(@regexps[gr = '\A[,]'] ||= Regexp.new(gr), :regexp, index)
4454
4583
  r17 = true
4455
4584
  @index += 1
4456
4585
  else
4586
+ terminal_parse_failure('[,]')
4457
4587
  r17 = nil
4458
4588
  end
4459
4589
  if r17
@@ -4490,6 +4620,7 @@ module ScientificNameClean
4490
4620
  r1 = nil
4491
4621
  end
4492
4622
  if r1
4623
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
4493
4624
  r0 = r1
4494
4625
  else
4495
4626
  i20, s20 = index, []
@@ -4499,10 +4630,11 @@ module ScientificNameClean
4499
4630
  r22 = _nt_space
4500
4631
  s20 << r22
4501
4632
  if r22
4502
- if has_terminal?('\G[,]', true, index)
4633
+ if has_terminal?(@regexps[gr = '\A[,]'] ||= Regexp.new(gr), :regexp, index)
4503
4634
  r24 = true
4504
4635
  @index += 1
4505
4636
  else
4637
+ terminal_parse_failure('[,]')
4506
4638
  r24 = nil
4507
4639
  end
4508
4640
  if r24
@@ -4530,11 +4662,13 @@ module ScientificNameClean
4530
4662
  r20 = nil
4531
4663
  end
4532
4664
  if r20
4665
+ r20 = SyntaxNode.new(input, (index-1)...index) if r20 == true
4533
4666
  r0 = r20
4534
4667
  else
4535
4668
  r27 = _nt_authors_names
4536
4669
  r27.extend(SimpleAuthorship4)
4537
4670
  if r27
4671
+ r27 = SyntaxNode.new(input, (index-1)...index) if r27 == true
4538
4672
  r0 = r27
4539
4673
  else
4540
4674
  @index = i0
@@ -4589,7 +4723,7 @@ module ScientificNameClean
4589
4723
  if node_cache[:authors_names].has_key?(index)
4590
4724
  cached = node_cache[:authors_names][index]
4591
4725
  if cached
4592
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4726
+ node_cache[:authors_names][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4593
4727
  @index = cached.interval.end
4594
4728
  end
4595
4729
  return cached
@@ -4624,14 +4758,17 @@ module ScientificNameClean
4624
4758
  r1 = nil
4625
4759
  end
4626
4760
  if r1
4761
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
4627
4762
  r0 = r1
4628
4763
  else
4629
4764
  r7 = _nt_author_name
4630
4765
  if r7
4766
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
4631
4767
  r0 = r7
4632
4768
  else
4633
4769
  r8 = _nt_unknown_auth
4634
4770
  if r8
4771
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
4635
4772
  r0 = r8
4636
4773
  else
4637
4774
  @index = i0
@@ -4667,7 +4804,7 @@ module ScientificNameClean
4667
4804
  if node_cache[:unknown_auth].has_key?(index)
4668
4805
  cached = node_cache[:unknown_auth][index]
4669
4806
  if cached
4670
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4807
+ node_cache[:unknown_auth][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4671
4808
  @index = cached.interval.end
4672
4809
  end
4673
4810
  return cached
@@ -4675,84 +4812,92 @@ module ScientificNameClean
4675
4812
 
4676
4813
  i0, s0 = index, []
4677
4814
  i1 = index
4678
- if has_terminal?("auct.", false, index)
4679
- r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
4680
- @index += 5
4815
+ if (match_len = has_terminal?("auct.", false, index))
4816
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4817
+ @index += match_len
4681
4818
  else
4682
4819
  terminal_parse_failure("auct.")
4683
4820
  r2 = nil
4684
4821
  end
4685
4822
  if r2
4823
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
4686
4824
  r1 = r2
4687
4825
  else
4688
- if has_terminal?("auct", false, index)
4689
- r3 = instantiate_node(SyntaxNode,input, index...(index + 4))
4690
- @index += 4
4826
+ if (match_len = has_terminal?("auct", false, index))
4827
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4828
+ @index += match_len
4691
4829
  else
4692
4830
  terminal_parse_failure("auct")
4693
4831
  r3 = nil
4694
4832
  end
4695
4833
  if r3
4834
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
4696
4835
  r1 = r3
4697
4836
  else
4698
- if has_terminal?("hort.", false, index)
4699
- r4 = instantiate_node(SyntaxNode,input, index...(index + 5))
4700
- @index += 5
4837
+ if (match_len = has_terminal?("hort.", false, index))
4838
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4839
+ @index += match_len
4701
4840
  else
4702
4841
  terminal_parse_failure("hort.")
4703
4842
  r4 = nil
4704
4843
  end
4705
4844
  if r4
4845
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
4706
4846
  r1 = r4
4707
4847
  else
4708
- if has_terminal?("hort", false, index)
4709
- r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
4710
- @index += 4
4848
+ if (match_len = has_terminal?("hort", false, index))
4849
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4850
+ @index += match_len
4711
4851
  else
4712
4852
  terminal_parse_failure("hort")
4713
4853
  r5 = nil
4714
4854
  end
4715
4855
  if r5
4856
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
4716
4857
  r1 = r5
4717
4858
  else
4718
- if has_terminal?("anon.", false, index)
4719
- r6 = instantiate_node(SyntaxNode,input, index...(index + 5))
4720
- @index += 5
4859
+ if (match_len = has_terminal?("anon.", false, index))
4860
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4861
+ @index += match_len
4721
4862
  else
4722
4863
  terminal_parse_failure("anon.")
4723
4864
  r6 = nil
4724
4865
  end
4725
4866
  if r6
4867
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
4726
4868
  r1 = r6
4727
4869
  else
4728
- if has_terminal?("anon", false, index)
4729
- r7 = instantiate_node(SyntaxNode,input, index...(index + 4))
4730
- @index += 4
4870
+ if (match_len = has_terminal?("anon", false, index))
4871
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4872
+ @index += match_len
4731
4873
  else
4732
4874
  terminal_parse_failure("anon")
4733
4875
  r7 = nil
4734
4876
  end
4735
4877
  if r7
4878
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
4736
4879
  r1 = r7
4737
4880
  else
4738
- if has_terminal?("ht.", false, index)
4739
- r8 = instantiate_node(SyntaxNode,input, index...(index + 3))
4740
- @index += 3
4881
+ if (match_len = has_terminal?("ht.", false, index))
4882
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4883
+ @index += match_len
4741
4884
  else
4742
4885
  terminal_parse_failure("ht.")
4743
4886
  r8 = nil
4744
4887
  end
4745
4888
  if r8
4889
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
4746
4890
  r1 = r8
4747
4891
  else
4748
- if has_terminal?("ht", false, index)
4749
- r9 = instantiate_node(SyntaxNode,input, index...(index + 2))
4750
- @index += 2
4892
+ if (match_len = has_terminal?("ht", false, index))
4893
+ r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4894
+ @index += match_len
4751
4895
  else
4752
4896
  terminal_parse_failure("ht")
4753
4897
  r9 = nil
4754
4898
  end
4755
4899
  if r9
4900
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
4756
4901
  r1 = r9
4757
4902
  else
4758
4903
  @index = i1
@@ -4799,7 +4944,7 @@ module ScientificNameClean
4799
4944
  if node_cache[:ex_sep].has_key?(index)
4800
4945
  cached = node_cache[:ex_sep][index]
4801
4946
  if cached
4802
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4947
+ node_cache[:ex_sep][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4803
4948
  @index = cached.interval.end
4804
4949
  end
4805
4950
  return cached
@@ -4807,24 +4952,26 @@ module ScientificNameClean
4807
4952
 
4808
4953
  i0, s0 = index, []
4809
4954
  i1 = index
4810
- if has_terminal?("ex", false, index)
4811
- r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
4812
- @index += 2
4955
+ if (match_len = has_terminal?("ex", false, index))
4956
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4957
+ @index += match_len
4813
4958
  else
4814
4959
  terminal_parse_failure("ex")
4815
4960
  r2 = nil
4816
4961
  end
4817
4962
  if r2
4963
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
4818
4964
  r1 = r2
4819
4965
  else
4820
- if has_terminal?("in", false, index)
4821
- r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
4822
- @index += 2
4966
+ if (match_len = has_terminal?("in", false, index))
4967
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
4968
+ @index += match_len
4823
4969
  else
4824
4970
  terminal_parse_failure("in")
4825
4971
  r3 = nil
4826
4972
  end
4827
4973
  if r3
4974
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
4828
4975
  r1 = r3
4829
4976
  else
4830
4977
  @index = i1
@@ -4834,10 +4981,11 @@ module ScientificNameClean
4834
4981
  s0 << r1
4835
4982
  if r1
4836
4983
  i4 = index
4837
- if has_terminal?('\G[\\s]', true, index)
4984
+ if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
4838
4985
  r5 = true
4839
4986
  @index += 1
4840
4987
  else
4988
+ terminal_parse_failure('[\\s]')
4841
4989
  r5 = nil
4842
4990
  end
4843
4991
  if r5
@@ -4882,65 +5030,70 @@ module ScientificNameClean
4882
5030
  if node_cache[:author_separator].has_key?(index)
4883
5031
  cached = node_cache[:author_separator][index]
4884
5032
  if cached
4885
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5033
+ node_cache[:author_separator][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
4886
5034
  @index = cached.interval.end
4887
5035
  end
4888
5036
  return cached
4889
5037
  end
4890
5038
 
4891
5039
  i0 = index
4892
- if has_terminal?("&amp;", false, index)
4893
- r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
4894
- @index += 5
5040
+ if (match_len = has_terminal?("&amp;", false, index))
5041
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5042
+ @index += match_len
4895
5043
  else
4896
5044
  terminal_parse_failure("&amp;")
4897
5045
  r1 = nil
4898
5046
  end
4899
5047
  if r1
5048
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
4900
5049
  r0 = r1
4901
5050
  r0.extend(AuthorSeparator0)
4902
5051
  else
4903
- if has_terminal?("&", false, index)
4904
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
4905
- @index += 1
5052
+ if (match_len = has_terminal?("&", false, index))
5053
+ r2 = true
5054
+ @index += match_len
4906
5055
  else
4907
5056
  terminal_parse_failure("&")
4908
5057
  r2 = nil
4909
5058
  end
4910
5059
  if r2
5060
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
4911
5061
  r0 = r2
4912
5062
  r0.extend(AuthorSeparator0)
4913
5063
  else
4914
- if has_terminal?(",", false, index)
4915
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
4916
- @index += 1
5064
+ if (match_len = has_terminal?(",", false, index))
5065
+ r3 = true
5066
+ @index += match_len
4917
5067
  else
4918
5068
  terminal_parse_failure(",")
4919
5069
  r3 = nil
4920
5070
  end
4921
5071
  if r3
5072
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
4922
5073
  r0 = r3
4923
5074
  r0.extend(AuthorSeparator0)
4924
5075
  else
4925
- if has_terminal?("and", false, index)
4926
- r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
4927
- @index += 3
5076
+ if (match_len = has_terminal?("and", false, index))
5077
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5078
+ @index += match_len
4928
5079
  else
4929
5080
  terminal_parse_failure("and")
4930
5081
  r4 = nil
4931
5082
  end
4932
5083
  if r4
5084
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
4933
5085
  r0 = r4
4934
5086
  r0.extend(AuthorSeparator0)
4935
5087
  else
4936
- if has_terminal?("et", false, index)
4937
- r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
4938
- @index += 2
5088
+ if (match_len = has_terminal?("et", false, index))
5089
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5090
+ @index += match_len
4939
5091
  else
4940
5092
  terminal_parse_failure("et")
4941
5093
  r5 = nil
4942
5094
  end
4943
5095
  if r5
5096
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
4944
5097
  r0 = r5
4945
5098
  r0.extend(AuthorSeparator0)
4946
5099
  else
@@ -4999,7 +5152,7 @@ module ScientificNameClean
4999
5152
  if node_cache[:author_name].has_key?(index)
5000
5153
  cached = node_cache[:author_name][index]
5001
5154
  if cached
5002
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5155
+ node_cache[:author_name][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5003
5156
  @index = cached.interval.end
5004
5157
  end
5005
5158
  return cached
@@ -5045,10 +5198,12 @@ module ScientificNameClean
5045
5198
  r1 = nil
5046
5199
  end
5047
5200
  if r1
5201
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
5048
5202
  r0 = r1
5049
5203
  else
5050
5204
  r9 = _nt_author_name_without_postfix
5051
5205
  if r9
5206
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
5052
5207
  r0 = r9
5053
5208
  else
5054
5209
  @index = i0
@@ -5126,7 +5281,7 @@ module ScientificNameClean
5126
5281
  if node_cache[:author_name_without_postfix].has_key?(index)
5127
5282
  cached = node_cache[:author_name_without_postfix][index]
5128
5283
  if cached
5129
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5284
+ node_cache[:author_name_without_postfix][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5130
5285
  @index = cached.interval.end
5131
5286
  end
5132
5287
  return cached
@@ -5157,6 +5312,7 @@ module ScientificNameClean
5157
5312
  r1 = nil
5158
5313
  end
5159
5314
  if r1
5315
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
5160
5316
  r0 = r1
5161
5317
  else
5162
5318
  i6, s6 = index, []
@@ -5179,10 +5335,12 @@ module ScientificNameClean
5179
5335
  r6 = nil
5180
5336
  end
5181
5337
  if r6
5338
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
5182
5339
  r0 = r6
5183
5340
  else
5184
5341
  r10 = _nt_author_word
5185
5342
  if r10
5343
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
5186
5344
  r0 = r10
5187
5345
  else
5188
5346
  @index = i0
@@ -5266,66 +5424,71 @@ module ScientificNameClean
5266
5424
  if node_cache[:author_word].has_key?(index)
5267
5425
  cached = node_cache[:author_word][index]
5268
5426
  if cached
5269
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5427
+ node_cache[:author_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5270
5428
  @index = cached.interval.end
5271
5429
  end
5272
5430
  return cached
5273
5431
  end
5274
5432
 
5275
5433
  i0 = index
5276
- if has_terminal?("A S. Xu", false, index)
5277
- r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
5434
+ if (match_len = has_terminal?("A S. Xu", false, index))
5435
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5278
5436
  r1.extend(AuthorWord0)
5279
- @index += 7
5437
+ @index += match_len
5280
5438
  else
5281
5439
  terminal_parse_failure("A S. Xu")
5282
5440
  r1 = nil
5283
5441
  end
5284
5442
  if r1
5443
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
5285
5444
  r0 = r1
5286
5445
  else
5287
5446
  i2 = index
5288
- if has_terminal?("arg.", false, index)
5289
- r3 = instantiate_node(SyntaxNode,input, index...(index + 4))
5290
- @index += 4
5447
+ if (match_len = has_terminal?("arg.", false, index))
5448
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5449
+ @index += match_len
5291
5450
  else
5292
5451
  terminal_parse_failure("arg.")
5293
5452
  r3 = nil
5294
5453
  end
5295
5454
  if r3
5455
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
5296
5456
  r2 = r3
5297
5457
  r2.extend(AuthorWord1)
5298
5458
  else
5299
- if has_terminal?("et al.\{\?\}", false, index)
5300
- r4 = instantiate_node(SyntaxNode,input, index...(index + 9))
5301
- @index += 9
5459
+ if (match_len = has_terminal?("et al.\{\?\}", false, index))
5460
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5461
+ @index += match_len
5302
5462
  else
5303
5463
  terminal_parse_failure("et al.\{\?\}")
5304
5464
  r4 = nil
5305
5465
  end
5306
5466
  if r4
5467
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
5307
5468
  r2 = r4
5308
5469
  r2.extend(AuthorWord1)
5309
5470
  else
5310
- if has_terminal?("et al.", false, index)
5311
- r5 = instantiate_node(SyntaxNode,input, index...(index + 6))
5312
- @index += 6
5471
+ if (match_len = has_terminal?("et al.", false, index))
5472
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5473
+ @index += match_len
5313
5474
  else
5314
5475
  terminal_parse_failure("et al.")
5315
5476
  r5 = nil
5316
5477
  end
5317
5478
  if r5
5479
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
5318
5480
  r2 = r5
5319
5481
  r2.extend(AuthorWord1)
5320
5482
  else
5321
- if has_terminal?("et al", false, index)
5322
- r6 = instantiate_node(SyntaxNode,input, index...(index + 5))
5323
- @index += 5
5483
+ if (match_len = has_terminal?("et al", false, index))
5484
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5485
+ @index += match_len
5324
5486
  else
5325
5487
  terminal_parse_failure("et al")
5326
5488
  r6 = nil
5327
5489
  end
5328
5490
  if r6
5491
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
5329
5492
  r2 = r6
5330
5493
  r2.extend(AuthorWord1)
5331
5494
  else
@@ -5336,146 +5499,163 @@ module ScientificNameClean
5336
5499
  end
5337
5500
  end
5338
5501
  if r2
5502
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
5339
5503
  r0 = r2
5340
5504
  else
5341
5505
  i7, s7 = index, []
5342
5506
  i8 = index
5343
- if has_terminal?("Å", false, index)
5344
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
5345
- @index += 1
5507
+ if (match_len = has_terminal?("Å", false, index))
5508
+ r9 = true
5509
+ @index += match_len
5346
5510
  else
5347
5511
  terminal_parse_failure("Å")
5348
5512
  r9 = nil
5349
5513
  end
5350
5514
  if r9
5515
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
5351
5516
  r8 = r9
5352
5517
  else
5353
- if has_terminal?("Ö", false, index)
5354
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
5355
- @index += 1
5518
+ if (match_len = has_terminal?("Ö", false, index))
5519
+ r10 = true
5520
+ @index += match_len
5356
5521
  else
5357
5522
  terminal_parse_failure("Ö")
5358
5523
  r10 = nil
5359
5524
  end
5360
5525
  if r10
5526
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
5361
5527
  r8 = r10
5362
5528
  else
5363
- if has_terminal?("Á", false, index)
5364
- r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
5365
- @index += 1
5529
+ if (match_len = has_terminal?("Á", false, index))
5530
+ r11 = true
5531
+ @index += match_len
5366
5532
  else
5367
5533
  terminal_parse_failure("Á")
5368
5534
  r11 = nil
5369
5535
  end
5370
5536
  if r11
5537
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
5371
5538
  r8 = r11
5372
5539
  else
5373
- if has_terminal?("Ø", false, index)
5374
- r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
5375
- @index += 1
5540
+ if (match_len = has_terminal?("Ø", false, index))
5541
+ r12 = true
5542
+ @index += match_len
5376
5543
  else
5377
5544
  terminal_parse_failure("Ø")
5378
5545
  r12 = nil
5379
5546
  end
5380
5547
  if r12
5548
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
5381
5549
  r8 = r12
5382
5550
  else
5383
- if has_terminal?("Ô", false, index)
5384
- r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
5385
- @index += 1
5551
+ if (match_len = has_terminal?("Ô", false, index))
5552
+ r13 = true
5553
+ @index += match_len
5386
5554
  else
5387
5555
  terminal_parse_failure("Ô")
5388
5556
  r13 = nil
5389
5557
  end
5390
5558
  if r13
5559
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
5391
5560
  r8 = r13
5392
5561
  else
5393
- if has_terminal?("Š", false, index)
5394
- r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
5395
- @index += 1
5562
+ if (match_len = has_terminal?("Š", false, index))
5563
+ r14 = true
5564
+ @index += match_len
5396
5565
  else
5397
5566
  terminal_parse_failure("Š")
5398
5567
  r14 = nil
5399
5568
  end
5400
5569
  if r14
5570
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
5401
5571
  r8 = r14
5402
5572
  else
5403
- if has_terminal?("Ś", false, index)
5404
- r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
5405
- @index += 1
5573
+ if (match_len = has_terminal?("Ś", false, index))
5574
+ r15 = true
5575
+ @index += match_len
5406
5576
  else
5407
5577
  terminal_parse_failure("Ś")
5408
5578
  r15 = nil
5409
5579
  end
5410
5580
  if r15
5581
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
5411
5582
  r8 = r15
5412
5583
  else
5413
- if has_terminal?("Č", false, index)
5414
- r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
5415
- @index += 1
5584
+ if (match_len = has_terminal?("Č", false, index))
5585
+ r16 = true
5586
+ @index += match_len
5416
5587
  else
5417
5588
  terminal_parse_failure("Č")
5418
5589
  r16 = nil
5419
5590
  end
5420
5591
  if r16
5592
+ r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
5421
5593
  r8 = r16
5422
5594
  else
5423
- if has_terminal?("Ķ", false, index)
5424
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
5425
- @index += 1
5595
+ if (match_len = has_terminal?("Ķ", false, index))
5596
+ r17 = true
5597
+ @index += match_len
5426
5598
  else
5427
5599
  terminal_parse_failure("Ķ")
5428
5600
  r17 = nil
5429
5601
  end
5430
5602
  if r17
5603
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
5431
5604
  r8 = r17
5432
5605
  else
5433
- if has_terminal?("Ł", false, index)
5434
- r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
5435
- @index += 1
5606
+ if (match_len = has_terminal?("Ł", false, index))
5607
+ r18 = true
5608
+ @index += match_len
5436
5609
  else
5437
5610
  terminal_parse_failure("Ł")
5438
5611
  r18 = nil
5439
5612
  end
5440
5613
  if r18
5614
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
5441
5615
  r8 = r18
5442
5616
  else
5443
- if has_terminal?("É", false, index)
5444
- r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
5445
- @index += 1
5617
+ if (match_len = has_terminal?("É", false, index))
5618
+ r19 = true
5619
+ @index += match_len
5446
5620
  else
5447
5621
  terminal_parse_failure("É")
5448
5622
  r19 = nil
5449
5623
  end
5450
5624
  if r19
5625
+ r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
5451
5626
  r8 = r19
5452
5627
  else
5453
- if has_terminal?("Ž", false, index)
5454
- r20 = instantiate_node(SyntaxNode,input, index...(index + 1))
5455
- @index += 1
5628
+ if (match_len = has_terminal?("Ž", false, index))
5629
+ r20 = true
5630
+ @index += match_len
5456
5631
  else
5457
5632
  terminal_parse_failure("Ž")
5458
5633
  r20 = nil
5459
5634
  end
5460
5635
  if r20
5636
+ r20 = SyntaxNode.new(input, (index-1)...index) if r20 == true
5461
5637
  r8 = r20
5462
5638
  else
5463
- if has_terminal?('\G[A-W]', true, index)
5639
+ if has_terminal?(@regexps[gr = '\A[A-W]'] ||= Regexp.new(gr), :regexp, index)
5464
5640
  r21 = true
5465
5641
  @index += 1
5466
5642
  else
5643
+ terminal_parse_failure('[A-W]')
5467
5644
  r21 = nil
5468
5645
  end
5469
5646
  if r21
5647
+ r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
5470
5648
  r8 = r21
5471
5649
  else
5472
- if has_terminal?('\G[Y-Z]', true, index)
5650
+ if has_terminal?(@regexps[gr = '\A[Y-Z]'] ||= Regexp.new(gr), :regexp, index)
5473
5651
  r22 = true
5474
5652
  @index += 1
5475
5653
  else
5654
+ terminal_parse_failure('[Y-Z]')
5476
5655
  r22 = nil
5477
5656
  end
5478
5657
  if r22
5658
+ r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
5479
5659
  r8 = r22
5480
5660
  else
5481
5661
  @index = i8
@@ -5498,10 +5678,11 @@ module ScientificNameClean
5498
5678
  if r8
5499
5679
  s23, i23 = [], index
5500
5680
  loop do
5501
- if has_terminal?('\G[^0-9\\[\\]\\(\\)\\s&,]', true, index)
5681
+ if has_terminal?(@regexps[gr = '\A[^0-9\\[\\]\\(\\)\\s&,]'] ||= Regexp.new(gr), :regexp, index)
5502
5682
  r24 = true
5503
5683
  @index += 1
5504
5684
  else
5685
+ terminal_parse_failure('[^0-9\\[\\]\\(\\)\\s&,]')
5505
5686
  r24 = nil
5506
5687
  end
5507
5688
  if r24
@@ -5522,12 +5703,13 @@ module ScientificNameClean
5522
5703
  r7 = nil
5523
5704
  end
5524
5705
  if r7
5706
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
5525
5707
  r0 = r7
5526
5708
  else
5527
5709
  i25, s25 = index, []
5528
- if has_terminal?("X", false, index)
5529
- r26 = instantiate_node(SyntaxNode,input, index...(index + 1))
5530
- @index += 1
5710
+ if (match_len = has_terminal?("X", false, index))
5711
+ r26 = true
5712
+ @index += match_len
5531
5713
  else
5532
5714
  terminal_parse_failure("X")
5533
5715
  r26 = nil
@@ -5536,10 +5718,11 @@ module ScientificNameClean
5536
5718
  if r26
5537
5719
  s27, i27 = [], index
5538
5720
  loop do
5539
- if has_terminal?('\G[^0-9\\[\\]\\(\\)\\s&,]', true, index)
5721
+ if has_terminal?(@regexps[gr = '\A[^0-9\\[\\]\\(\\)\\s&,]'] ||= Regexp.new(gr), :regexp, index)
5540
5722
  r28 = true
5541
5723
  @index += 1
5542
5724
  else
5725
+ terminal_parse_failure('[^0-9\\[\\]\\(\\)\\s&,]')
5543
5726
  r28 = nil
5544
5727
  end
5545
5728
  if r28
@@ -5565,10 +5748,12 @@ module ScientificNameClean
5565
5748
  r25 = nil
5566
5749
  end
5567
5750
  if r25
5751
+ r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
5568
5752
  r0 = r25
5569
5753
  else
5570
5754
  r29 = _nt_author_prefix_word
5571
5755
  if r29
5756
+ r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
5572
5757
  r0 = r29
5573
5758
  else
5574
5759
  @index = i0
@@ -5607,7 +5792,7 @@ module ScientificNameClean
5607
5792
  if node_cache[:author_prefix_word].has_key?(index)
5608
5793
  cached = node_cache[:author_prefix_word][index]
5609
5794
  if cached
5610
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5795
+ node_cache[:author_prefix_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5611
5796
  @index = cached.interval.end
5612
5797
  end
5613
5798
  return cached
@@ -5618,164 +5803,180 @@ module ScientificNameClean
5618
5803
  s0 << r1
5619
5804
  if r1
5620
5805
  i2 = index
5621
- if has_terminal?("ab", false, index)
5622
- r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
5623
- @index += 2
5806
+ if (match_len = has_terminal?("ab", false, index))
5807
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5808
+ @index += match_len
5624
5809
  else
5625
5810
  terminal_parse_failure("ab")
5626
5811
  r3 = nil
5627
5812
  end
5628
5813
  if r3
5814
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
5629
5815
  r2 = r3
5630
5816
  else
5631
- if has_terminal?("af", false, index)
5632
- r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
5633
- @index += 2
5817
+ if (match_len = has_terminal?("af", false, index))
5818
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5819
+ @index += match_len
5634
5820
  else
5635
5821
  terminal_parse_failure("af")
5636
5822
  r4 = nil
5637
5823
  end
5638
5824
  if r4
5825
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
5639
5826
  r2 = r4
5640
5827
  else
5641
- if has_terminal?("bis", false, index)
5642
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
5643
- @index += 3
5828
+ if (match_len = has_terminal?("bis", false, index))
5829
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5830
+ @index += match_len
5644
5831
  else
5645
5832
  terminal_parse_failure("bis")
5646
5833
  r5 = nil
5647
5834
  end
5648
5835
  if r5
5836
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
5649
5837
  r2 = r5
5650
5838
  else
5651
- if has_terminal?("da", false, index)
5652
- r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
5653
- @index += 2
5839
+ if (match_len = has_terminal?("da", false, index))
5840
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5841
+ @index += match_len
5654
5842
  else
5655
5843
  terminal_parse_failure("da")
5656
5844
  r6 = nil
5657
5845
  end
5658
5846
  if r6
5847
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
5659
5848
  r2 = r6
5660
5849
  else
5661
- if has_terminal?("der", false, index)
5662
- r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
5663
- @index += 3
5850
+ if (match_len = has_terminal?("der", false, index))
5851
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5852
+ @index += match_len
5664
5853
  else
5665
5854
  terminal_parse_failure("der")
5666
5855
  r7 = nil
5667
5856
  end
5668
5857
  if r7
5858
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
5669
5859
  r2 = r7
5670
5860
  else
5671
- if has_terminal?("des", false, index)
5672
- r8 = instantiate_node(SyntaxNode,input, index...(index + 3))
5673
- @index += 3
5861
+ if (match_len = has_terminal?("des", false, index))
5862
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5863
+ @index += match_len
5674
5864
  else
5675
5865
  terminal_parse_failure("des")
5676
5866
  r8 = nil
5677
5867
  end
5678
5868
  if r8
5869
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
5679
5870
  r2 = r8
5680
5871
  else
5681
- if has_terminal?("den", false, index)
5682
- r9 = instantiate_node(SyntaxNode,input, index...(index + 3))
5683
- @index += 3
5872
+ if (match_len = has_terminal?("den", false, index))
5873
+ r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5874
+ @index += match_len
5684
5875
  else
5685
5876
  terminal_parse_failure("den")
5686
5877
  r9 = nil
5687
5878
  end
5688
5879
  if r9
5880
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
5689
5881
  r2 = r9
5690
5882
  else
5691
- if has_terminal?("della", false, index)
5692
- r10 = instantiate_node(SyntaxNode,input, index...(index + 5))
5693
- @index += 5
5883
+ if (match_len = has_terminal?("della", false, index))
5884
+ r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5885
+ @index += match_len
5694
5886
  else
5695
5887
  terminal_parse_failure("della")
5696
5888
  r10 = nil
5697
5889
  end
5698
5890
  if r10
5891
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
5699
5892
  r2 = r10
5700
5893
  else
5701
- if has_terminal?("dela", false, index)
5702
- r11 = instantiate_node(SyntaxNode,input, index...(index + 4))
5703
- @index += 4
5894
+ if (match_len = has_terminal?("dela", false, index))
5895
+ r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5896
+ @index += match_len
5704
5897
  else
5705
5898
  terminal_parse_failure("dela")
5706
5899
  r11 = nil
5707
5900
  end
5708
5901
  if r11
5902
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
5709
5903
  r2 = r11
5710
5904
  else
5711
- if has_terminal?("de", false, index)
5712
- r12 = instantiate_node(SyntaxNode,input, index...(index + 2))
5713
- @index += 2
5905
+ if (match_len = has_terminal?("de", false, index))
5906
+ r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5907
+ @index += match_len
5714
5908
  else
5715
5909
  terminal_parse_failure("de")
5716
5910
  r12 = nil
5717
5911
  end
5718
5912
  if r12
5913
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
5719
5914
  r2 = r12
5720
5915
  else
5721
- if has_terminal?("di", false, index)
5722
- r13 = instantiate_node(SyntaxNode,input, index...(index + 2))
5723
- @index += 2
5916
+ if (match_len = has_terminal?("di", false, index))
5917
+ r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5918
+ @index += match_len
5724
5919
  else
5725
5920
  terminal_parse_failure("di")
5726
5921
  r13 = nil
5727
5922
  end
5728
5923
  if r13
5924
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
5729
5925
  r2 = r13
5730
5926
  else
5731
- if has_terminal?("du", false, index)
5732
- r14 = instantiate_node(SyntaxNode,input, index...(index + 2))
5733
- @index += 2
5927
+ if (match_len = has_terminal?("du", false, index))
5928
+ r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5929
+ @index += match_len
5734
5930
  else
5735
5931
  terminal_parse_failure("du")
5736
5932
  r14 = nil
5737
5933
  end
5738
5934
  if r14
5935
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
5739
5936
  r2 = r14
5740
5937
  else
5741
- if has_terminal?("la", false, index)
5742
- r15 = instantiate_node(SyntaxNode,input, index...(index + 2))
5743
- @index += 2
5938
+ if (match_len = has_terminal?("la", false, index))
5939
+ r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5940
+ @index += match_len
5744
5941
  else
5745
5942
  terminal_parse_failure("la")
5746
5943
  r15 = nil
5747
5944
  end
5748
5945
  if r15
5946
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
5749
5947
  r2 = r15
5750
5948
  else
5751
- if has_terminal?("ter", false, index)
5752
- r16 = instantiate_node(SyntaxNode,input, index...(index + 3))
5753
- @index += 3
5949
+ if (match_len = has_terminal?("ter", false, index))
5950
+ r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5951
+ @index += match_len
5754
5952
  else
5755
5953
  terminal_parse_failure("ter")
5756
5954
  r16 = nil
5757
5955
  end
5758
5956
  if r16
5957
+ r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
5759
5958
  r2 = r16
5760
5959
  else
5761
- if has_terminal?("van", false, index)
5762
- r17 = instantiate_node(SyntaxNode,input, index...(index + 3))
5763
- @index += 3
5960
+ if (match_len = has_terminal?("van", false, index))
5961
+ r17 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5962
+ @index += match_len
5764
5963
  else
5765
5964
  terminal_parse_failure("van")
5766
5965
  r17 = nil
5767
5966
  end
5768
5967
  if r17
5968
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
5769
5969
  r2 = r17
5770
5970
  else
5771
- if has_terminal?("von", false, index)
5772
- r18 = instantiate_node(SyntaxNode,input, index...(index + 3))
5773
- @index += 3
5971
+ if (match_len = has_terminal?("von", false, index))
5972
+ r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
5973
+ @index += match_len
5774
5974
  else
5775
5975
  terminal_parse_failure("von")
5776
5976
  r18 = nil
5777
5977
  end
5778
5978
  if r18
5979
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
5779
5980
  r2 = r18
5780
5981
  else
5781
5982
  @index = i2
@@ -5838,32 +6039,34 @@ module ScientificNameClean
5838
6039
  if node_cache[:author_postfix_word].has_key?(index)
5839
6040
  cached = node_cache[:author_postfix_word][index]
5840
6041
  if cached
5841
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6042
+ node_cache[:author_postfix_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5842
6043
  @index = cached.interval.end
5843
6044
  end
5844
6045
  return cached
5845
6046
  end
5846
6047
 
5847
6048
  i0 = index
5848
- if has_terminal?("f.", false, index)
5849
- r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
5850
- @index += 2
6049
+ if (match_len = has_terminal?("f.", false, index))
6050
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6051
+ @index += match_len
5851
6052
  else
5852
6053
  terminal_parse_failure("f.")
5853
6054
  r1 = nil
5854
6055
  end
5855
6056
  if r1
6057
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
5856
6058
  r0 = r1
5857
6059
  r0.extend(AuthorPostfixWord0)
5858
6060
  else
5859
- if has_terminal?("filius", false, index)
5860
- r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
5861
- @index += 6
6061
+ if (match_len = has_terminal?("filius", false, index))
6062
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6063
+ @index += match_len
5862
6064
  else
5863
6065
  terminal_parse_failure("filius")
5864
6066
  r2 = nil
5865
6067
  end
5866
6068
  if r2
6069
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
5867
6070
  r0 = r2
5868
6071
  r0.extend(AuthorPostfixWord0)
5869
6072
  else
@@ -5898,7 +6101,7 @@ module ScientificNameClean
5898
6101
  if node_cache[:cap_latin_word_pair].has_key?(index)
5899
6102
  cached = node_cache[:cap_latin_word_pair][index]
5900
6103
  if cached
5901
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6104
+ node_cache[:cap_latin_word_pair][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5902
6105
  @index = cached.interval.end
5903
6106
  end
5904
6107
  return cached
@@ -5908,9 +6111,9 @@ module ScientificNameClean
5908
6111
  r1 = _nt_cap_latin_word
5909
6112
  s0 << r1
5910
6113
  if r1
5911
- if has_terminal?("-", false, index)
5912
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
5913
- @index += 1
6114
+ if (match_len = has_terminal?("-", false, index))
6115
+ r2 = true
6116
+ @index += match_len
5914
6117
  else
5915
6118
  terminal_parse_failure("-")
5916
6119
  r2 = nil
@@ -5995,7 +6198,7 @@ module ScientificNameClean
5995
6198
  if node_cache[:cap_latin_word].has_key?(index)
5996
6199
  cached = node_cache[:cap_latin_word][index]
5997
6200
  if cached
5998
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6201
+ node_cache[:cap_latin_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
5999
6202
  @index = cached.interval.end
6000
6203
  end
6001
6204
  return cached
@@ -6004,17 +6207,20 @@ module ScientificNameClean
6004
6207
  i0 = index
6005
6208
  i1, s1 = index, []
6006
6209
  i2 = index
6007
- if has_terminal?('\G[A-Z]', true, index)
6210
+ if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
6008
6211
  r3 = true
6009
6212
  @index += 1
6010
6213
  else
6214
+ terminal_parse_failure('[A-Z]')
6011
6215
  r3 = nil
6012
6216
  end
6013
6217
  if r3
6218
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
6014
6219
  r2 = r3
6015
6220
  else
6016
6221
  r4 = _nt_cap_digraph
6017
6222
  if r4
6223
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
6018
6224
  r2 = r4
6019
6225
  else
6020
6226
  @index = i2
@@ -6026,9 +6232,9 @@ module ScientificNameClean
6026
6232
  r5 = _nt_latin_word
6027
6233
  s1 << r5
6028
6234
  if r5
6029
- if has_terminal?("?", false, index)
6030
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
6031
- @index += 1
6235
+ if (match_len = has_terminal?("?", false, index))
6236
+ r6 = true
6237
+ @index += match_len
6032
6238
  else
6033
6239
  terminal_parse_failure("?")
6034
6240
  r6 = nil
@@ -6045,21 +6251,25 @@ module ScientificNameClean
6045
6251
  r1 = nil
6046
6252
  end
6047
6253
  if r1
6254
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
6048
6255
  r0 = r1
6049
6256
  else
6050
6257
  i7, s7 = index, []
6051
6258
  i8 = index
6052
- if has_terminal?('\G[A-Z]', true, index)
6259
+ if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
6053
6260
  r9 = true
6054
6261
  @index += 1
6055
6262
  else
6263
+ terminal_parse_failure('[A-Z]')
6056
6264
  r9 = nil
6057
6265
  end
6058
6266
  if r9
6267
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
6059
6268
  r8 = r9
6060
6269
  else
6061
6270
  r10 = _nt_cap_digraph
6062
6271
  if r10
6272
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
6063
6273
  r8 = r10
6064
6274
  else
6065
6275
  @index = i8
@@ -6080,28 +6290,31 @@ module ScientificNameClean
6080
6290
  r7 = nil
6081
6291
  end
6082
6292
  if r7
6293
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
6083
6294
  r0 = r7
6084
6295
  else
6085
6296
  i12, s12 = index, []
6086
6297
  i13 = index
6087
- if has_terminal?("AE", false, index)
6088
- r14 = instantiate_node(SyntaxNode,input, index...(index + 2))
6089
- @index += 2
6298
+ if (match_len = has_terminal?("AE", false, index))
6299
+ r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6300
+ @index += match_len
6090
6301
  else
6091
6302
  terminal_parse_failure("AE")
6092
6303
  r14 = nil
6093
6304
  end
6094
6305
  if r14
6306
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
6095
6307
  r13 = r14
6096
6308
  else
6097
- if has_terminal?("OE", false, index)
6098
- r15 = instantiate_node(SyntaxNode,input, index...(index + 2))
6099
- @index += 2
6309
+ if (match_len = has_terminal?("OE", false, index))
6310
+ r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6311
+ @index += match_len
6100
6312
  else
6101
6313
  terminal_parse_failure("OE")
6102
6314
  r15 = nil
6103
6315
  end
6104
6316
  if r15
6317
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
6105
6318
  r13 = r15
6106
6319
  else
6107
6320
  @index = i13
@@ -6122,215 +6335,235 @@ module ScientificNameClean
6122
6335
  r12 = nil
6123
6336
  end
6124
6337
  if r12
6338
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
6125
6339
  r0 = r12
6126
6340
  else
6127
6341
  i17 = index
6128
- if has_terminal?("Ca", false, index)
6129
- r18 = instantiate_node(SyntaxNode,input, index...(index + 2))
6130
- @index += 2
6342
+ if (match_len = has_terminal?("Ca", false, index))
6343
+ r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6344
+ @index += match_len
6131
6345
  else
6132
6346
  terminal_parse_failure("Ca")
6133
6347
  r18 = nil
6134
6348
  end
6135
6349
  if r18
6350
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
6136
6351
  r17 = r18
6137
6352
  r17.extend(CapLatinWord6)
6138
6353
  else
6139
- if has_terminal?("Ea", false, index)
6140
- r19 = instantiate_node(SyntaxNode,input, index...(index + 2))
6141
- @index += 2
6354
+ if (match_len = has_terminal?("Ea", false, index))
6355
+ r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6356
+ @index += match_len
6142
6357
  else
6143
6358
  terminal_parse_failure("Ea")
6144
6359
  r19 = nil
6145
6360
  end
6146
6361
  if r19
6362
+ r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
6147
6363
  r17 = r19
6148
6364
  r17.extend(CapLatinWord6)
6149
6365
  else
6150
- if has_terminal?("Ge", false, index)
6151
- r20 = instantiate_node(SyntaxNode,input, index...(index + 2))
6152
- @index += 2
6366
+ if (match_len = has_terminal?("Ge", false, index))
6367
+ r20 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6368
+ @index += match_len
6153
6369
  else
6154
6370
  terminal_parse_failure("Ge")
6155
6371
  r20 = nil
6156
6372
  end
6157
6373
  if r20
6374
+ r20 = SyntaxNode.new(input, (index-1)...index) if r20 == true
6158
6375
  r17 = r20
6159
6376
  r17.extend(CapLatinWord6)
6160
6377
  else
6161
- if has_terminal?("Ia", false, index)
6162
- r21 = instantiate_node(SyntaxNode,input, index...(index + 2))
6163
- @index += 2
6378
+ if (match_len = has_terminal?("Ia", false, index))
6379
+ r21 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6380
+ @index += match_len
6164
6381
  else
6165
6382
  terminal_parse_failure("Ia")
6166
6383
  r21 = nil
6167
6384
  end
6168
6385
  if r21
6386
+ r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
6169
6387
  r17 = r21
6170
6388
  r17.extend(CapLatinWord6)
6171
6389
  else
6172
- if has_terminal?("Io", false, index)
6173
- r22 = instantiate_node(SyntaxNode,input, index...(index + 2))
6174
- @index += 2
6390
+ if (match_len = has_terminal?("Io", false, index))
6391
+ r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6392
+ @index += match_len
6175
6393
  else
6176
6394
  terminal_parse_failure("Io")
6177
6395
  r22 = nil
6178
6396
  end
6179
6397
  if r22
6398
+ r22 = SyntaxNode.new(input, (index-1)...index) if r22 == true
6180
6399
  r17 = r22
6181
6400
  r17.extend(CapLatinWord6)
6182
6401
  else
6183
- if has_terminal?("Io", false, index)
6184
- r23 = instantiate_node(SyntaxNode,input, index...(index + 2))
6185
- @index += 2
6402
+ if (match_len = has_terminal?("Io", false, index))
6403
+ r23 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6404
+ @index += match_len
6186
6405
  else
6187
6406
  terminal_parse_failure("Io")
6188
6407
  r23 = nil
6189
6408
  end
6190
6409
  if r23
6410
+ r23 = SyntaxNode.new(input, (index-1)...index) if r23 == true
6191
6411
  r17 = r23
6192
6412
  r17.extend(CapLatinWord6)
6193
6413
  else
6194
- if has_terminal?("Ix", false, index)
6195
- r24 = instantiate_node(SyntaxNode,input, index...(index + 2))
6196
- @index += 2
6414
+ if (match_len = has_terminal?("Ix", false, index))
6415
+ r24 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6416
+ @index += match_len
6197
6417
  else
6198
6418
  terminal_parse_failure("Ix")
6199
6419
  r24 = nil
6200
6420
  end
6201
6421
  if r24
6422
+ r24 = SyntaxNode.new(input, (index-1)...index) if r24 == true
6202
6423
  r17 = r24
6203
6424
  r17.extend(CapLatinWord6)
6204
6425
  else
6205
- if has_terminal?("Lo", false, index)
6206
- r25 = instantiate_node(SyntaxNode,input, index...(index + 2))
6207
- @index += 2
6426
+ if (match_len = has_terminal?("Lo", false, index))
6427
+ r25 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6428
+ @index += match_len
6208
6429
  else
6209
6430
  terminal_parse_failure("Lo")
6210
6431
  r25 = nil
6211
6432
  end
6212
6433
  if r25
6434
+ r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
6213
6435
  r17 = r25
6214
6436
  r17.extend(CapLatinWord6)
6215
6437
  else
6216
- if has_terminal?("Oa", false, index)
6217
- r26 = instantiate_node(SyntaxNode,input, index...(index + 2))
6218
- @index += 2
6438
+ if (match_len = has_terminal?("Oa", false, index))
6439
+ r26 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6440
+ @index += match_len
6219
6441
  else
6220
6442
  terminal_parse_failure("Oa")
6221
6443
  r26 = nil
6222
6444
  end
6223
6445
  if r26
6446
+ r26 = SyntaxNode.new(input, (index-1)...index) if r26 == true
6224
6447
  r17 = r26
6225
6448
  r17.extend(CapLatinWord6)
6226
6449
  else
6227
- if has_terminal?("Ra", false, index)
6228
- r27 = instantiate_node(SyntaxNode,input, index...(index + 2))
6229
- @index += 2
6450
+ if (match_len = has_terminal?("Ra", false, index))
6451
+ r27 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6452
+ @index += match_len
6230
6453
  else
6231
6454
  terminal_parse_failure("Ra")
6232
6455
  r27 = nil
6233
6456
  end
6234
6457
  if r27
6458
+ r27 = SyntaxNode.new(input, (index-1)...index) if r27 == true
6235
6459
  r17 = r27
6236
6460
  r17.extend(CapLatinWord6)
6237
6461
  else
6238
- if has_terminal?("Ty", false, index)
6239
- r28 = instantiate_node(SyntaxNode,input, index...(index + 2))
6240
- @index += 2
6462
+ if (match_len = has_terminal?("Ty", false, index))
6463
+ r28 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6464
+ @index += match_len
6241
6465
  else
6242
6466
  terminal_parse_failure("Ty")
6243
6467
  r28 = nil
6244
6468
  end
6245
6469
  if r28
6470
+ r28 = SyntaxNode.new(input, (index-1)...index) if r28 == true
6246
6471
  r17 = r28
6247
6472
  r17.extend(CapLatinWord6)
6248
6473
  else
6249
- if has_terminal?("Ua", false, index)
6250
- r29 = instantiate_node(SyntaxNode,input, index...(index + 2))
6251
- @index += 2
6474
+ if (match_len = has_terminal?("Ua", false, index))
6475
+ r29 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6476
+ @index += match_len
6252
6477
  else
6253
6478
  terminal_parse_failure("Ua")
6254
6479
  r29 = nil
6255
6480
  end
6256
6481
  if r29
6482
+ r29 = SyntaxNode.new(input, (index-1)...index) if r29 == true
6257
6483
  r17 = r29
6258
6484
  r17.extend(CapLatinWord6)
6259
6485
  else
6260
- if has_terminal?("Aa", false, index)
6261
- r30 = instantiate_node(SyntaxNode,input, index...(index + 2))
6262
- @index += 2
6486
+ if (match_len = has_terminal?("Aa", false, index))
6487
+ r30 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6488
+ @index += match_len
6263
6489
  else
6264
6490
  terminal_parse_failure("Aa")
6265
6491
  r30 = nil
6266
6492
  end
6267
6493
  if r30
6494
+ r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
6268
6495
  r17 = r30
6269
6496
  r17.extend(CapLatinWord6)
6270
6497
  else
6271
- if has_terminal?("Ja", false, index)
6272
- r31 = instantiate_node(SyntaxNode,input, index...(index + 2))
6273
- @index += 2
6498
+ if (match_len = has_terminal?("Ja", false, index))
6499
+ r31 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6500
+ @index += match_len
6274
6501
  else
6275
6502
  terminal_parse_failure("Ja")
6276
6503
  r31 = nil
6277
6504
  end
6278
6505
  if r31
6506
+ r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
6279
6507
  r17 = r31
6280
6508
  r17.extend(CapLatinWord6)
6281
6509
  else
6282
- if has_terminal?("Zu", false, index)
6283
- r32 = instantiate_node(SyntaxNode,input, index...(index + 2))
6284
- @index += 2
6510
+ if (match_len = has_terminal?("Zu", false, index))
6511
+ r32 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6512
+ @index += match_len
6285
6513
  else
6286
6514
  terminal_parse_failure("Zu")
6287
6515
  r32 = nil
6288
6516
  end
6289
6517
  if r32
6518
+ r32 = SyntaxNode.new(input, (index-1)...index) if r32 == true
6290
6519
  r17 = r32
6291
6520
  r17.extend(CapLatinWord6)
6292
6521
  else
6293
- if has_terminal?("La", false, index)
6294
- r33 = instantiate_node(SyntaxNode,input, index...(index + 2))
6295
- @index += 2
6522
+ if (match_len = has_terminal?("La", false, index))
6523
+ r33 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6524
+ @index += match_len
6296
6525
  else
6297
6526
  terminal_parse_failure("La")
6298
6527
  r33 = nil
6299
6528
  end
6300
6529
  if r33
6530
+ r33 = SyntaxNode.new(input, (index-1)...index) if r33 == true
6301
6531
  r17 = r33
6302
6532
  r17.extend(CapLatinWord6)
6303
6533
  else
6304
- if has_terminal?("Qu", false, index)
6305
- r34 = instantiate_node(SyntaxNode,input, index...(index + 2))
6306
- @index += 2
6534
+ if (match_len = has_terminal?("Qu", false, index))
6535
+ r34 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6536
+ @index += match_len
6307
6537
  else
6308
6538
  terminal_parse_failure("Qu")
6309
6539
  r34 = nil
6310
6540
  end
6311
6541
  if r34
6542
+ r34 = SyntaxNode.new(input, (index-1)...index) if r34 == true
6312
6543
  r17 = r34
6313
6544
  r17.extend(CapLatinWord6)
6314
6545
  else
6315
- if has_terminal?("As", false, index)
6316
- r35 = instantiate_node(SyntaxNode,input, index...(index + 2))
6317
- @index += 2
6546
+ if (match_len = has_terminal?("As", false, index))
6547
+ r35 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6548
+ @index += match_len
6318
6549
  else
6319
6550
  terminal_parse_failure("As")
6320
6551
  r35 = nil
6321
6552
  end
6322
6553
  if r35
6554
+ r35 = SyntaxNode.new(input, (index-1)...index) if r35 == true
6323
6555
  r17 = r35
6324
6556
  r17.extend(CapLatinWord6)
6325
6557
  else
6326
- if has_terminal?("Ba", false, index)
6327
- r36 = instantiate_node(SyntaxNode,input, index...(index + 2))
6328
- @index += 2
6558
+ if (match_len = has_terminal?("Ba", false, index))
6559
+ r36 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6560
+ @index += match_len
6329
6561
  else
6330
6562
  terminal_parse_failure("Ba")
6331
6563
  r36 = nil
6332
6564
  end
6333
6565
  if r36
6566
+ r36 = SyntaxNode.new(input, (index-1)...index) if r36 == true
6334
6567
  r17 = r36
6335
6568
  r17.extend(CapLatinWord6)
6336
6569
  else
@@ -6356,6 +6589,7 @@ module ScientificNameClean
6356
6589
  end
6357
6590
  end
6358
6591
  if r17
6592
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
6359
6593
  r0 = r17
6360
6594
  else
6361
6595
  @index = i0
@@ -6384,24 +6618,25 @@ module ScientificNameClean
6384
6618
  if node_cache[:capped_dotted_char].has_key?(index)
6385
6619
  cached = node_cache[:capped_dotted_char][index]
6386
6620
  if cached
6387
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6621
+ node_cache[:capped_dotted_char][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6388
6622
  @index = cached.interval.end
6389
6623
  end
6390
6624
  return cached
6391
6625
  end
6392
6626
 
6393
6627
  i0, s0 = index, []
6394
- if has_terminal?('\G[A-Z]', true, index)
6628
+ if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
6395
6629
  r1 = true
6396
6630
  @index += 1
6397
6631
  else
6632
+ terminal_parse_failure('[A-Z]')
6398
6633
  r1 = nil
6399
6634
  end
6400
6635
  s0 << r1
6401
6636
  if r1
6402
- if has_terminal?(".", false, index)
6403
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
6404
- @index += 1
6637
+ if (match_len = has_terminal?(".", false, index))
6638
+ r2 = true
6639
+ @index += match_len
6405
6640
  else
6406
6641
  terminal_parse_failure(".")
6407
6642
  r2 = nil
@@ -6535,7 +6770,7 @@ module ScientificNameClean
6535
6770
  if node_cache[:species_word_hybrid].has_key?(index)
6536
6771
  cached = node_cache[:species_word_hybrid][index]
6537
6772
  if cached
6538
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6773
+ node_cache[:species_word_hybrid][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6539
6774
  @index = cached.interval.end
6540
6775
  end
6541
6776
  return cached
@@ -6562,12 +6797,13 @@ module ScientificNameClean
6562
6797
  r1 = nil
6563
6798
  end
6564
6799
  if r1
6800
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
6565
6801
  r0 = r1
6566
6802
  else
6567
6803
  i5, s5 = index, []
6568
- if has_terminal?("X", false, index)
6569
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
6570
- @index += 1
6804
+ if (match_len = has_terminal?("X", false, index))
6805
+ r6 = true
6806
+ @index += match_len
6571
6807
  else
6572
6808
  terminal_parse_failure("X")
6573
6809
  r6 = nil
@@ -6590,12 +6826,13 @@ module ScientificNameClean
6590
6826
  r5 = nil
6591
6827
  end
6592
6828
  if r5
6829
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
6593
6830
  r0 = r5
6594
6831
  else
6595
6832
  i9, s9 = index, []
6596
- if has_terminal?("x", false, index)
6597
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
6598
- @index += 1
6833
+ if (match_len = has_terminal?("x", false, index))
6834
+ r10 = true
6835
+ @index += match_len
6599
6836
  else
6600
6837
  terminal_parse_failure("x")
6601
6838
  r10 = nil
@@ -6618,6 +6855,7 @@ module ScientificNameClean
6618
6855
  r9 = nil
6619
6856
  end
6620
6857
  if r9
6858
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
6621
6859
  r0 = r9
6622
6860
  else
6623
6861
  @index = i0
@@ -6683,7 +6921,7 @@ module ScientificNameClean
6683
6921
  if node_cache[:annotation_identification].has_key?(index)
6684
6922
  cached = node_cache[:annotation_identification][index]
6685
6923
  if cached
6686
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6924
+ node_cache[:annotation_identification][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6687
6925
  @index = cached.interval.end
6688
6926
  end
6689
6927
  return cached
@@ -6691,168 +6929,183 @@ module ScientificNameClean
6691
6929
 
6692
6930
  i0 = index
6693
6931
  i1 = index
6694
- if has_terminal?("sp.nr.", false, index)
6695
- r2 = instantiate_node(SyntaxNode,input, index...(index + 6))
6696
- @index += 6
6932
+ if (match_len = has_terminal?("sp.nr.", false, index))
6933
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6934
+ @index += match_len
6697
6935
  else
6698
6936
  terminal_parse_failure("sp.nr.")
6699
6937
  r2 = nil
6700
6938
  end
6701
6939
  if r2
6940
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
6702
6941
  r1 = r2
6703
6942
  r1.extend(AnnotationIdentification0)
6704
6943
  else
6705
- if has_terminal?("sp. nr.", false, index)
6706
- r3 = instantiate_node(SyntaxNode,input, index...(index + 7))
6707
- @index += 7
6944
+ if (match_len = has_terminal?("sp. nr.", false, index))
6945
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6946
+ @index += match_len
6708
6947
  else
6709
6948
  terminal_parse_failure("sp. nr.")
6710
6949
  r3 = nil
6711
6950
  end
6712
6951
  if r3
6952
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
6713
6953
  r1 = r3
6714
6954
  r1.extend(AnnotationIdentification0)
6715
6955
  else
6716
- if has_terminal?("nr.", false, index)
6717
- r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
6718
- @index += 3
6956
+ if (match_len = has_terminal?("nr.", false, index))
6957
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6958
+ @index += match_len
6719
6959
  else
6720
6960
  terminal_parse_failure("nr.")
6721
6961
  r4 = nil
6722
6962
  end
6723
6963
  if r4
6964
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
6724
6965
  r1 = r4
6725
6966
  r1.extend(AnnotationIdentification0)
6726
6967
  else
6727
- if has_terminal?("nr ", false, index)
6728
- r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
6729
- @index += 3
6968
+ if (match_len = has_terminal?("nr ", false, index))
6969
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6970
+ @index += match_len
6730
6971
  else
6731
6972
  terminal_parse_failure("nr ")
6732
6973
  r5 = nil
6733
6974
  end
6734
6975
  if r5
6976
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
6735
6977
  r1 = r5
6736
6978
  r1.extend(AnnotationIdentification0)
6737
6979
  else
6738
- if has_terminal?("sp.aff.", false, index)
6739
- r6 = instantiate_node(SyntaxNode,input, index...(index + 7))
6740
- @index += 7
6980
+ if (match_len = has_terminal?("sp.aff.", false, index))
6981
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6982
+ @index += match_len
6741
6983
  else
6742
6984
  terminal_parse_failure("sp.aff.")
6743
6985
  r6 = nil
6744
6986
  end
6745
6987
  if r6
6988
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
6746
6989
  r1 = r6
6747
6990
  r1.extend(AnnotationIdentification0)
6748
6991
  else
6749
- if has_terminal?("sp. aff.", false, index)
6750
- r7 = instantiate_node(SyntaxNode,input, index...(index + 8))
6751
- @index += 8
6992
+ if (match_len = has_terminal?("sp. aff.", false, index))
6993
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
6994
+ @index += match_len
6752
6995
  else
6753
6996
  terminal_parse_failure("sp. aff.")
6754
6997
  r7 = nil
6755
6998
  end
6756
6999
  if r7
7000
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
6757
7001
  r1 = r7
6758
7002
  r1.extend(AnnotationIdentification0)
6759
7003
  else
6760
- if has_terminal?("sp.", false, index)
6761
- r8 = instantiate_node(SyntaxNode,input, index...(index + 3))
6762
- @index += 3
7004
+ if (match_len = has_terminal?("sp.", false, index))
7005
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7006
+ @index += match_len
6763
7007
  else
6764
7008
  terminal_parse_failure("sp.")
6765
7009
  r8 = nil
6766
7010
  end
6767
7011
  if r8
7012
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
6768
7013
  r1 = r8
6769
7014
  r1.extend(AnnotationIdentification0)
6770
7015
  else
6771
- if has_terminal?("sp ", false, index)
6772
- r9 = instantiate_node(SyntaxNode,input, index...(index + 3))
6773
- @index += 3
7016
+ if (match_len = has_terminal?("sp ", false, index))
7017
+ r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7018
+ @index += match_len
6774
7019
  else
6775
7020
  terminal_parse_failure("sp ")
6776
7021
  r9 = nil
6777
7022
  end
6778
7023
  if r9
7024
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
6779
7025
  r1 = r9
6780
7026
  r1.extend(AnnotationIdentification0)
6781
7027
  else
6782
- if has_terminal?("species", false, index)
6783
- r10 = instantiate_node(SyntaxNode,input, index...(index + 7))
6784
- @index += 7
7028
+ if (match_len = has_terminal?("species", false, index))
7029
+ r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7030
+ @index += match_len
6785
7031
  else
6786
7032
  terminal_parse_failure("species")
6787
7033
  r10 = nil
6788
7034
  end
6789
7035
  if r10
7036
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
6790
7037
  r1 = r10
6791
7038
  r1.extend(AnnotationIdentification0)
6792
7039
  else
6793
- if has_terminal?("spp.", false, index)
6794
- r11 = instantiate_node(SyntaxNode,input, index...(index + 4))
6795
- @index += 4
7040
+ if (match_len = has_terminal?("spp.", false, index))
7041
+ r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7042
+ @index += match_len
6796
7043
  else
6797
7044
  terminal_parse_failure("spp.")
6798
7045
  r11 = nil
6799
7046
  end
6800
7047
  if r11
7048
+ r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
6801
7049
  r1 = r11
6802
7050
  r1.extend(AnnotationIdentification0)
6803
7051
  else
6804
- if has_terminal?("spp ", false, index)
6805
- r12 = instantiate_node(SyntaxNode,input, index...(index + 4))
6806
- @index += 4
7052
+ if (match_len = has_terminal?("spp ", false, index))
7053
+ r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7054
+ @index += match_len
6807
7055
  else
6808
7056
  terminal_parse_failure("spp ")
6809
7057
  r12 = nil
6810
7058
  end
6811
7059
  if r12
7060
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
6812
7061
  r1 = r12
6813
7062
  r1.extend(AnnotationIdentification0)
6814
7063
  else
6815
- if has_terminal?("aff.", false, index)
6816
- r13 = instantiate_node(SyntaxNode,input, index...(index + 4))
6817
- @index += 4
7064
+ if (match_len = has_terminal?("aff.", false, index))
7065
+ r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7066
+ @index += match_len
6818
7067
  else
6819
7068
  terminal_parse_failure("aff.")
6820
7069
  r13 = nil
6821
7070
  end
6822
7071
  if r13
7072
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
6823
7073
  r1 = r13
6824
7074
  r1.extend(AnnotationIdentification0)
6825
7075
  else
6826
- if has_terminal?("aff ", false, index)
6827
- r14 = instantiate_node(SyntaxNode,input, index...(index + 4))
6828
- @index += 4
7076
+ if (match_len = has_terminal?("aff ", false, index))
7077
+ r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7078
+ @index += match_len
6829
7079
  else
6830
7080
  terminal_parse_failure("aff ")
6831
7081
  r14 = nil
6832
7082
  end
6833
7083
  if r14
7084
+ r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
6834
7085
  r1 = r14
6835
7086
  r1.extend(AnnotationIdentification0)
6836
7087
  else
6837
- if has_terminal?("monst.", false, index)
6838
- r15 = instantiate_node(SyntaxNode,input, index...(index + 6))
6839
- @index += 6
7088
+ if (match_len = has_terminal?("monst.", false, index))
7089
+ r15 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7090
+ @index += match_len
6840
7091
  else
6841
7092
  terminal_parse_failure("monst.")
6842
7093
  r15 = nil
6843
7094
  end
6844
7095
  if r15
7096
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
6845
7097
  r1 = r15
6846
7098
  r1.extend(AnnotationIdentification0)
6847
7099
  else
6848
- if has_terminal?("? ", false, index)
6849
- r16 = instantiate_node(SyntaxNode,input, index...(index + 2))
6850
- @index += 2
7100
+ if (match_len = has_terminal?("? ", false, index))
7101
+ r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7102
+ @index += match_len
6851
7103
  else
6852
7104
  terminal_parse_failure("? ")
6853
7105
  r16 = nil
6854
7106
  end
6855
7107
  if r16
7108
+ r16 = SyntaxNode.new(input, (index-1)...index) if r16 == true
6856
7109
  r1 = r16
6857
7110
  r1.extend(AnnotationIdentification0)
6858
7111
  else
@@ -6874,28 +7127,31 @@ module ScientificNameClean
6874
7127
  end
6875
7128
  end
6876
7129
  if r1
7130
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
6877
7131
  r0 = r1
6878
7132
  else
6879
7133
  i17 = index
6880
- if has_terminal?("cf.", false, index)
6881
- r18 = instantiate_node(SyntaxNode,input, index...(index + 3))
6882
- @index += 3
7134
+ if (match_len = has_terminal?("cf.", false, index))
7135
+ r18 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7136
+ @index += match_len
6883
7137
  else
6884
7138
  terminal_parse_failure("cf.")
6885
7139
  r18 = nil
6886
7140
  end
6887
7141
  if r18
7142
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
6888
7143
  r17 = r18
6889
7144
  r17.extend(AnnotationIdentification1)
6890
7145
  else
6891
- if has_terminal?("cf ", false, index)
6892
- r19 = instantiate_node(SyntaxNode,input, index...(index + 3))
6893
- @index += 3
7146
+ if (match_len = has_terminal?("cf ", false, index))
7147
+ r19 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7148
+ @index += match_len
6894
7149
  else
6895
7150
  terminal_parse_failure("cf ")
6896
7151
  r19 = nil
6897
7152
  end
6898
7153
  if r19
7154
+ r19 = SyntaxNode.new(input, (index-1)...index) if r19 == true
6899
7155
  r17 = r19
6900
7156
  r17.extend(AnnotationIdentification1)
6901
7157
  else
@@ -6904,6 +7160,7 @@ module ScientificNameClean
6904
7160
  end
6905
7161
  end
6906
7162
  if r17
7163
+ r17 = SyntaxNode.new(input, (index-1)...index) if r17 == true
6907
7164
  r0 = r17
6908
7165
  else
6909
7166
  @index = i0
@@ -6939,7 +7196,7 @@ module ScientificNameClean
6939
7196
  if node_cache[:species_word].has_key?(index)
6940
7197
  cached = node_cache[:species_word][index]
6941
7198
  if cached
6942
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7199
+ node_cache[:species_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
6943
7200
  @index = cached.interval.end
6944
7201
  end
6945
7202
  return cached
@@ -6949,10 +7206,11 @@ module ScientificNameClean
6949
7206
  i1, s1 = index, []
6950
7207
  s2, i2 = [], index
6951
7208
  loop do
6952
- if has_terminal?('\G[0-9]', true, index)
7209
+ if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
6953
7210
  r3 = true
6954
7211
  @index += 1
6955
7212
  else
7213
+ terminal_parse_failure('[0-9]')
6956
7214
  r3 = nil
6957
7215
  end
6958
7216
  if r3
@@ -6969,9 +7227,9 @@ module ScientificNameClean
6969
7227
  end
6970
7228
  s1 << r2
6971
7229
  if r2
6972
- if has_terminal?("-", false, index)
6973
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
6974
- @index += 1
7230
+ if (match_len = has_terminal?("-", false, index))
7231
+ r5 = true
7232
+ @index += match_len
6975
7233
  else
6976
7234
  terminal_parse_failure("-")
6977
7235
  r5 = nil
@@ -6996,10 +7254,12 @@ module ScientificNameClean
6996
7254
  r1 = nil
6997
7255
  end
6998
7256
  if r1
7257
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
6999
7258
  r0 = r1
7000
7259
  else
7001
7260
  r7 = _nt_latin_word
7002
7261
  if r7
7262
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
7003
7263
  r0 = r7
7004
7264
  else
7005
7265
  @index = i0
@@ -7055,7 +7315,7 @@ module ScientificNameClean
7055
7315
  if node_cache[:latin_word].has_key?(index)
7056
7316
  cached = node_cache[:latin_word][index]
7057
7317
  if cached
7058
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7318
+ node_cache[:latin_word][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7059
7319
  @index = cached.interval.end
7060
7320
  end
7061
7321
  return cached
@@ -7066,9 +7326,9 @@ module ScientificNameClean
7066
7326
  r2 = _nt_valid_name_letters
7067
7327
  s1 << r2
7068
7328
  if r2
7069
- if has_terminal?("-", false, index)
7070
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
7071
- @index += 1
7329
+ if (match_len = has_terminal?("-", false, index))
7330
+ r3 = true
7331
+ @index += match_len
7072
7332
  else
7073
7333
  terminal_parse_failure("-")
7074
7334
  r3 = nil
@@ -7088,17 +7348,19 @@ module ScientificNameClean
7088
7348
  r1 = nil
7089
7349
  end
7090
7350
  if r1
7351
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
7091
7352
  r0 = r1
7092
7353
  else
7093
- if has_terminal?("o\'donelli", false, index)
7094
- r5 = instantiate_node(SyntaxNode,input, index...(index + 9))
7354
+ if (match_len = has_terminal?("o\'donelli", false, index))
7355
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7095
7356
  r5.extend(LatinWord2)
7096
- @index += 9
7357
+ @index += match_len
7097
7358
  else
7098
7359
  terminal_parse_failure("o\'donelli")
7099
7360
  r5 = nil
7100
7361
  end
7101
7362
  if r5
7363
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
7102
7364
  r0 = r5
7103
7365
  else
7104
7366
  i6, s6 = index, []
@@ -7117,6 +7379,7 @@ module ScientificNameClean
7117
7379
  r6 = nil
7118
7380
  end
7119
7381
  if r6
7382
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
7120
7383
  r0 = r6
7121
7384
  else
7122
7385
  @index = i0
@@ -7150,7 +7413,7 @@ module ScientificNameClean
7150
7413
  if node_cache[:valid_name_letters].has_key?(index)
7151
7414
  cached = node_cache[:valid_name_letters][index]
7152
7415
  if cached
7153
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7416
+ node_cache[:valid_name_letters][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7154
7417
  @index = cached.interval.end
7155
7418
  end
7156
7419
  return cached
@@ -7158,10 +7421,11 @@ module ScientificNameClean
7158
7421
 
7159
7422
  s0, i0 = [], index
7160
7423
  loop do
7161
- if has_terminal?('\G[a-zëæœ]', true, index)
7424
+ if has_terminal?(@regexps[gr = '\A[a-zëæœ]'] ||= Regexp.new(gr), :regexp, index)
7162
7425
  r1 = true
7163
7426
  @index += 1
7164
7427
  else
7428
+ terminal_parse_failure('[a-zëæœ]')
7165
7429
  r1 = nil
7166
7430
  end
7167
7431
  if r1
@@ -7198,17 +7462,18 @@ module ScientificNameClean
7198
7462
  if node_cache[:valid_name_letter].has_key?(index)
7199
7463
  cached = node_cache[:valid_name_letter][index]
7200
7464
  if cached
7201
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7465
+ node_cache[:valid_name_letter][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7202
7466
  @index = cached.interval.end
7203
7467
  end
7204
7468
  return cached
7205
7469
  end
7206
7470
 
7207
- if has_terminal?('\G[a-zëæœ]', true, index)
7471
+ if has_terminal?(@regexps[gr = '\A[a-zëæœ]'] ||= Regexp.new(gr), :regexp, index)
7208
7472
  r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
7209
7473
  r0.extend(ValidNameLetter0)
7210
7474
  @index += 1
7211
7475
  else
7476
+ terminal_parse_failure('[a-zëæœ]')
7212
7477
  r0 = nil
7213
7478
  end
7214
7479
 
@@ -7234,33 +7499,35 @@ module ScientificNameClean
7234
7499
  if node_cache[:cap_digraph].has_key?(index)
7235
7500
  cached = node_cache[:cap_digraph][index]
7236
7501
  if cached
7237
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7502
+ node_cache[:cap_digraph][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7238
7503
  @index = cached.interval.end
7239
7504
  end
7240
7505
  return cached
7241
7506
  end
7242
7507
 
7243
7508
  i0 = index
7244
- if has_terminal?("Æ", false, index)
7245
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
7509
+ if (match_len = has_terminal?("Æ", false, index))
7510
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7246
7511
  r1.extend(CapDigraph0)
7247
- @index += 1
7512
+ @index += match_len
7248
7513
  else
7249
7514
  terminal_parse_failure("Æ")
7250
7515
  r1 = nil
7251
7516
  end
7252
7517
  if r1
7518
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
7253
7519
  r0 = r1
7254
7520
  else
7255
- if has_terminal?("Œ", false, index)
7256
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
7521
+ if (match_len = has_terminal?("Œ", false, index))
7522
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7257
7523
  r2.extend(CapDigraph1)
7258
- @index += 1
7524
+ @index += match_len
7259
7525
  else
7260
7526
  terminal_parse_failure("Œ")
7261
7527
  r2 = nil
7262
7528
  end
7263
7529
  if r2
7530
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
7264
7531
  r0 = r2
7265
7532
  else
7266
7533
  @index = i0
@@ -7314,7 +7581,7 @@ module ScientificNameClean
7314
7581
  if node_cache[:year].has_key?(index)
7315
7582
  cached = node_cache[:year][index]
7316
7583
  if cached
7317
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7584
+ node_cache[:year][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7318
7585
  @index = cached.interval.end
7319
7586
  end
7320
7587
  return cached
@@ -7331,10 +7598,12 @@ module ScientificNameClean
7331
7598
  i4 = index
7332
7599
  r5 = _nt_year_number_with_character
7333
7600
  if r5
7601
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
7334
7602
  r4 = r5
7335
7603
  else
7336
7604
  r6 = _nt_year_number
7337
7605
  if r6
7606
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
7338
7607
  r4 = r6
7339
7608
  else
7340
7609
  @index = i4
@@ -7361,14 +7630,17 @@ module ScientificNameClean
7361
7630
  r1 = nil
7362
7631
  end
7363
7632
  if r1
7633
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
7364
7634
  r0 = r1
7365
7635
  else
7366
7636
  r9 = _nt_year_number_with_character
7367
7637
  if r9
7638
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
7368
7639
  r0 = r9
7369
7640
  else
7370
7641
  r10 = _nt_year_number
7371
7642
  if r10
7643
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
7372
7644
  r0 = r10
7373
7645
  else
7374
7646
  @index = i0
@@ -7408,7 +7680,7 @@ module ScientificNameClean
7408
7680
  if node_cache[:year_number_with_character].has_key?(index)
7409
7681
  cached = node_cache[:year_number_with_character][index]
7410
7682
  if cached
7411
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7683
+ node_cache[:year_number_with_character][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7412
7684
  @index = cached.interval.end
7413
7685
  end
7414
7686
  return cached
@@ -7418,10 +7690,11 @@ module ScientificNameClean
7418
7690
  r1 = _nt_year_number
7419
7691
  s0 << r1
7420
7692
  if r1
7421
- if has_terminal?('\G[a-zA-Z]', true, index)
7693
+ if has_terminal?(@regexps[gr = '\A[a-zA-Z]'] ||= Regexp.new(gr), :regexp, index)
7422
7694
  r2 = true
7423
7695
  @index += 1
7424
7696
  else
7697
+ terminal_parse_failure('[a-zA-Z]')
7425
7698
  r2 = nil
7426
7699
  end
7427
7700
  s0 << r2
@@ -7465,51 +7738,56 @@ module ScientificNameClean
7465
7738
  if node_cache[:year_number].has_key?(index)
7466
7739
  cached = node_cache[:year_number][index]
7467
7740
  if cached
7468
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7741
+ node_cache[:year_number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7469
7742
  @index = cached.interval.end
7470
7743
  end
7471
7744
  return cached
7472
7745
  end
7473
7746
 
7474
7747
  i0, s0 = index, []
7475
- if has_terminal?('\G[12]', true, index)
7748
+ if has_terminal?(@regexps[gr = '\A[12]'] ||= Regexp.new(gr), :regexp, index)
7476
7749
  r1 = true
7477
7750
  @index += 1
7478
7751
  else
7752
+ terminal_parse_failure('[12]')
7479
7753
  r1 = nil
7480
7754
  end
7481
7755
  s0 << r1
7482
7756
  if r1
7483
- if has_terminal?('\G[7890]', true, index)
7757
+ if has_terminal?(@regexps[gr = '\A[7890]'] ||= Regexp.new(gr), :regexp, index)
7484
7758
  r2 = true
7485
7759
  @index += 1
7486
7760
  else
7761
+ terminal_parse_failure('[7890]')
7487
7762
  r2 = nil
7488
7763
  end
7489
7764
  s0 << r2
7490
7765
  if r2
7491
- if has_terminal?('\G[0-9]', true, index)
7766
+ if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
7492
7767
  r3 = true
7493
7768
  @index += 1
7494
7769
  else
7770
+ terminal_parse_failure('[0-9]')
7495
7771
  r3 = nil
7496
7772
  end
7497
7773
  s0 << r3
7498
7774
  if r3
7499
7775
  i4 = index
7500
7776
  i5, s5 = index, []
7501
- if has_terminal?('\G[0-9]', true, index)
7777
+ if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
7502
7778
  r6 = true
7503
7779
  @index += 1
7504
7780
  else
7781
+ terminal_parse_failure('[0-9]')
7505
7782
  r6 = nil
7506
7783
  end
7507
7784
  s5 << r6
7508
7785
  if r6
7509
- if has_terminal?('\G[\\?]', true, index)
7786
+ if has_terminal?(@regexps[gr = '\A[\\?]'] ||= Regexp.new(gr), :regexp, index)
7510
7787
  r8 = true
7511
7788
  @index += 1
7512
7789
  else
7790
+ terminal_parse_failure('[\\?]')
7513
7791
  r8 = nil
7514
7792
  end
7515
7793
  if r8
@@ -7527,16 +7805,18 @@ module ScientificNameClean
7527
7805
  r5 = nil
7528
7806
  end
7529
7807
  if r5
7808
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
7530
7809
  r4 = r5
7531
7810
  else
7532
- if has_terminal?("?", false, index)
7533
- r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
7534
- @index += 1
7811
+ if (match_len = has_terminal?("?", false, index))
7812
+ r9 = true
7813
+ @index += match_len
7535
7814
  else
7536
7815
  terminal_parse_failure("?")
7537
7816
  r9 = nil
7538
7817
  end
7539
7818
  if r9
7819
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
7540
7820
  r4 = r9
7541
7821
  else
7542
7822
  @index = i4
@@ -7566,15 +7846,15 @@ module ScientificNameClean
7566
7846
  if node_cache[:left_paren].has_key?(index)
7567
7847
  cached = node_cache[:left_paren][index]
7568
7848
  if cached
7569
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7849
+ node_cache[:left_paren][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7570
7850
  @index = cached.interval.end
7571
7851
  end
7572
7852
  return cached
7573
7853
  end
7574
7854
 
7575
- if has_terminal?("(", false, index)
7576
- r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
7577
- @index += 1
7855
+ if (match_len = has_terminal?("(", false, index))
7856
+ r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7857
+ @index += match_len
7578
7858
  else
7579
7859
  terminal_parse_failure("(")
7580
7860
  r0 = nil
@@ -7590,15 +7870,15 @@ module ScientificNameClean
7590
7870
  if node_cache[:right_paren].has_key?(index)
7591
7871
  cached = node_cache[:right_paren][index]
7592
7872
  if cached
7593
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7873
+ node_cache[:right_paren][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7594
7874
  @index = cached.interval.end
7595
7875
  end
7596
7876
  return cached
7597
7877
  end
7598
7878
 
7599
- if has_terminal?(")", false, index)
7600
- r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
7601
- @index += 1
7879
+ if (match_len = has_terminal?(")", false, index))
7880
+ r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
7881
+ @index += match_len
7602
7882
  else
7603
7883
  terminal_parse_failure(")")
7604
7884
  r0 = nil
@@ -7620,7 +7900,7 @@ module ScientificNameClean
7620
7900
  if node_cache[:hybrid_character].has_key?(index)
7621
7901
  cached = node_cache[:hybrid_character][index]
7622
7902
  if cached
7623
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7903
+ node_cache[:hybrid_character][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7624
7904
  @index = cached.interval.end
7625
7905
  end
7626
7906
  return cached
@@ -7628,25 +7908,27 @@ module ScientificNameClean
7628
7908
 
7629
7909
  i0 = index
7630
7910
  i1 = index
7631
- if has_terminal?("x", false, index)
7632
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
7633
- @index += 1
7911
+ if (match_len = has_terminal?("x", false, index))
7912
+ r2 = true
7913
+ @index += match_len
7634
7914
  else
7635
7915
  terminal_parse_failure("x")
7636
7916
  r2 = nil
7637
7917
  end
7638
7918
  if r2
7919
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
7639
7920
  r1 = r2
7640
7921
  r1.extend(HybridCharacter0)
7641
7922
  else
7642
- if has_terminal?("X", false, index)
7643
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
7644
- @index += 1
7923
+ if (match_len = has_terminal?("X", false, index))
7924
+ r3 = true
7925
+ @index += match_len
7645
7926
  else
7646
7927
  terminal_parse_failure("X")
7647
7928
  r3 = nil
7648
7929
  end
7649
7930
  if r3
7931
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
7650
7932
  r1 = r3
7651
7933
  r1.extend(HybridCharacter0)
7652
7934
  else
@@ -7655,10 +7937,12 @@ module ScientificNameClean
7655
7937
  end
7656
7938
  end
7657
7939
  if r1
7940
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
7658
7941
  r0 = r1
7659
7942
  else
7660
7943
  r4 = _nt_multiplication_sign
7661
7944
  if r4
7945
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
7662
7946
  r0 = r4
7663
7947
  else
7664
7948
  @index = i0
@@ -7682,32 +7966,34 @@ module ScientificNameClean
7682
7966
  if node_cache[:multiplication_sign].has_key?(index)
7683
7967
  cached = node_cache[:multiplication_sign][index]
7684
7968
  if cached
7685
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7969
+ node_cache[:multiplication_sign][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7686
7970
  @index = cached.interval.end
7687
7971
  end
7688
7972
  return cached
7689
7973
  end
7690
7974
 
7691
7975
  i0 = index
7692
- if has_terminal?("×", false, index)
7693
- r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
7694
- @index += 1
7976
+ if (match_len = has_terminal?("×", false, index))
7977
+ r1 = true
7978
+ @index += match_len
7695
7979
  else
7696
7980
  terminal_parse_failure("×")
7697
7981
  r1 = nil
7698
7982
  end
7699
7983
  if r1
7984
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
7700
7985
  r0 = r1
7701
7986
  r0.extend(MultiplicationSign0)
7702
7987
  else
7703
- if has_terminal?("*", false, index)
7704
- r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
7705
- @index += 1
7988
+ if (match_len = has_terminal?("*", false, index))
7989
+ r2 = true
7990
+ @index += match_len
7706
7991
  else
7707
7992
  terminal_parse_failure("*")
7708
7993
  r2 = nil
7709
7994
  end
7710
7995
  if r2
7996
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
7711
7997
  r0 = r2
7712
7998
  r0.extend(MultiplicationSign0)
7713
7999
  else
@@ -7726,7 +8012,7 @@ module ScientificNameClean
7726
8012
  if node_cache[:space].has_key?(index)
7727
8013
  cached = node_cache[:space][index]
7728
8014
  if cached
7729
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
8015
+ node_cache[:space][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7730
8016
  @index = cached.interval.end
7731
8017
  end
7732
8018
  return cached
@@ -7734,10 +8020,11 @@ module ScientificNameClean
7734
8020
 
7735
8021
  s0, i0 = [], index
7736
8022
  loop do
7737
- if has_terminal?('\G[\\s]', true, index)
8023
+ if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
7738
8024
  r1 = true
7739
8025
  @index += 1
7740
8026
  else
8027
+ terminal_parse_failure('[\\s]')
7741
8028
  r1 = nil
7742
8029
  end
7743
8030
  if r1
@@ -7758,7 +8045,7 @@ module ScientificNameClean
7758
8045
  if node_cache[:space_hard].has_key?(index)
7759
8046
  cached = node_cache[:space_hard][index]
7760
8047
  if cached
7761
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
8048
+ node_cache[:space_hard][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
7762
8049
  @index = cached.interval.end
7763
8050
  end
7764
8051
  return cached
@@ -7766,10 +8053,11 @@ module ScientificNameClean
7766
8053
 
7767
8054
  s0, i0 = [], index
7768
8055
  loop do
7769
- if has_terminal?('\G[\\s]', true, index)
8056
+ if has_terminal?(@regexps[gr = '\A[\\s]'] ||= Regexp.new(gr), :regexp, index)
7770
8057
  r1 = true
7771
8058
  @index += 1
7772
8059
  else
8060
+ terminal_parse_failure('[\\s]')
7773
8061
  r1 = nil
7774
8062
  end
7775
8063
  if r1