Skip to content

Commit a2bee07

Browse files
committed
move nomcode to gnlib
1 parent 962c052 commit a2bee07

17 files changed

Lines changed: 59 additions & 155 deletions

File tree

binding/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"unsafe"
1313

1414
"github.com/gnames/gnfmt"
15+
"github.com/gnames/gnlib/ent/nomcode"
1516
"github.com/gnames/gnparser"
16-
"github.com/gnames/gnparser/ent/nomcode"
1717
)
1818

1919
// ParseToString function takes a name-string, desired format, a withDetails

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime"
66

77
"github.com/gnames/gnfmt"
8-
"github.com/gnames/gnparser/ent/nomcode"
8+
"github.com/gnames/gnlib/ent/nomcode"
99
)
1010

1111
// Config keeps settings that might affect how parsing is done,

ent/nomcode/nomcode.go

Lines changed: 0 additions & 59 deletions
This file was deleted.

ent/nomcode/nomcode_test.go

Lines changed: 0 additions & 53 deletions
This file was deleted.

ent/parser/ast.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"strings"
66
"unicode"
77

8+
"github.com/gnames/gnlib/ent/nomcode"
89
"github.com/gnames/gnparser/ent/internal/preprocess"
9-
"github.com/gnames/gnparser/ent/nomcode"
1010

1111
"github.com/gnames/gnparser/ent/parsed"
1212
"github.com/gnames/gnparser/ent/str"
@@ -110,13 +110,13 @@ func (p *Engine) newName(n *node32) nameData {
110110
p.hybrid = &annot
111111
name = p.newNamedSpeciesHybridNode(n)
112112
case ruleGraftChimeraFormula:
113-
if p.code == nomcode.Cultivar {
113+
if p.code == nomcode.Cultivars {
114114
annot = parsed.GraftChimeraFormulaAnnot
115115
p.hybrid = &annot
116116
name = p.newGraftChimeraFormulaNode(n)
117117
}
118118
case ruleNamedGenusGraftChimera:
119-
if p.code == nomcode.Cultivar {
119+
if p.code == nomcode.Cultivars {
120120
annot = parsed.NamedGraftChimeraAnnot
121121
p.hybrid = &annot
122122
name = p.newNamedGenusGraftChimeraNode(n)
@@ -447,7 +447,7 @@ func (p *Engine) botanicalUninomial(n *node32) bool {
447447
return false
448448
}
449449
w := p.newWordNode(n, parsed.AuthorWordType)
450-
if p.code == nomcode.Botanical || p.code == nomcode.Cultivar {
450+
if p.code == nomcode.Botanical || p.code == nomcode.Cultivars {
451451
return true
452452
}
453453

@@ -698,7 +698,7 @@ func (p *Engine) newSpeciesNode(n *node32) *speciesNode {
698698
case ruleSubgenus:
699699
w := p.newWordNode(n.up, parsed.SubgenusType)
700700
switch p.code {
701-
case nomcode.Botanical, nomcode.Cultivar:
701+
case nomcode.Botanical, nomcode.Cultivars:
702702
// Botanical code has author of genus here
703703
case nomcode.Zoological:
704704
sg = w
@@ -717,7 +717,7 @@ func (p *Engine) newSpeciesNode(n *node32) *speciesNode {
717717
infs = p.newInfraspeciesGroup(n)
718718
case ruleCultivar, ruleCultivarRecursive:
719719
switch p.code {
720-
case nomcode.Cultivar:
720+
case nomcode.Cultivars:
721721
cultivar = p.newCultivarEpithetNode(n, parsed.CultivarType)
722722
default:
723723
p.tail = string(p.buffer[n.begin-2 : len(p.buffer)-1])
@@ -726,7 +726,7 @@ func (p *Engine) newSpeciesNode(n *node32) *speciesNode {
726726
n = n.next
727727
}
728728
p.cardinality = 2 + len(infs)
729-
if cultivar != nil && p.code == nomcode.Cultivar {
729+
if cultivar != nil && p.code == nomcode.Cultivars {
730730
p.cultivar = true
731731
p.cardinality += 1
732732
}
@@ -879,7 +879,7 @@ func (p *Engine) newUninomialNode(n *node32) *uninomialNode {
879879
CultivarEpithet: cultivar,
880880
}
881881
p.cardinality = 1
882-
if cultivar != nil && p.code == nomcode.Cultivar {
882+
if cultivar != nil && p.code == nomcode.Cultivars {
883883
p.cultivar = true
884884
p.cardinality += 1
885885
}
@@ -1377,7 +1377,7 @@ func (p *Engine) newCultivarEpithetNode(n *node32, wt parsed.WordType) *cultivar
13771377
Start: int(t.begin),
13781378
End: int(t.end),
13791379
}
1380-
cult := p.code == nomcode.Cultivar
1380+
cult := p.code == nomcode.Cultivars
13811381
if !cult {
13821382
p.tail = " " + string(p.buffer[n.begin-1:len(p.buffer)-1])
13831383
return nil

ent/parser/engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package parser
33
import (
44
"io"
55

6+
"github.com/gnames/gnlib/ent/nomcode"
67
"github.com/gnames/gnparser/ent/internal/preparser"
7-
"github.com/gnames/gnparser/ent/nomcode"
88
"github.com/gnames/gnparser/ent/parsed"
99
"github.com/gnames/gnparser/io/dict"
1010
"github.com/gnames/tribool"

ent/parser/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package parser
22

33
import (
4-
"github.com/gnames/gnparser/ent/nomcode"
4+
"github.com/gnames/gnlib/ent/nomcode"
55
"github.com/gnames/gnparser/ent/parsed"
66
)
77

ent/parser/output.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func (sn *scientificNameNode) ToOutput(
1414
withDetails, withSpGr bool) parsed.Parsed {
1515
res := parsed.Parsed{
16-
NomCode: sn.code.String(),
16+
NomCode: sn.code.Abbr(),
1717
Verbatim: sn.verbatim,
1818
Canonical: sn.Canonical(withSpGr),
1919
Virus: sn.virus,

ent/parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"bytes"
77
"fmt"
88

9+
"github.com/gnames/gnlib/ent/nomcode"
910
"github.com/gnames/gnparser/ent/internal/preprocess"
10-
"github.com/gnames/gnparser/ent/nomcode"
1111
"github.com/gnames/gnparser/ent/parsed"
1212
"github.com/gnames/gnparser/ent/str"
1313
)

ent/parser/parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"testing"
66

7-
"github.com/gnames/gnparser/ent/nomcode"
7+
"github.com/gnames/gnlib/ent/nomcode"
88
"github.com/gnames/gnparser/ent/parser"
99
"github.com/stretchr/testify/assert"
1010
)

0 commit comments

Comments
 (0)