grammar

package
v0.14.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pretty added in v0.13.1

func Pretty(pretty bool) func(*Engine) error

func Size added in v0.13.1

func Size(size int) func(*Engine) error

Types

type ApproxOutput

type ApproxOutput struct {
	Genus       *genusOutput       `json:"genus"`
	SpecEpithet *specEpithetOutput `json:"specificEpithet,omitempty"`
	Approx      string             `json:"annotationIdentification"`
	Ignored     *ignoredOutput     `json:"ignored,omitempty"`
}

type AuthGroupOutput added in v0.9.0

type AuthGroupOutput struct {
	Authors      []string       `json:"authors"`
	Year         *yearOutput    `json:"year,omitempty"`
	ExAuthors    *AuthorsOutput `json:"exAuthors,omitempty"`
	EmendAuthors *AuthorsOutput `json:"emendAuthors,omitempty"`
}

type AuthorFinder

type AuthorFinder interface {
	// contains filtered or unexported methods
}

type AuthorsOutput added in v0.9.0

type AuthorsOutput struct {
	Authors []string    `json:"authors"`
	Year    *yearOutput `json:"year,omitempty"`
}

type AuthorshipOutput added in v0.9.0

type AuthorshipOutput struct {
	Value       string           `json:"value"`
	Original    *AuthGroupOutput `json:"basionymAuthorship,omitempty"`
	Combination *AuthGroupOutput `json:"combinationAuthorship,omitempty"`
}

type BaseEngine

type BaseEngine struct {
	SN *ScientificNameNode

	Cardinality int
	Error       error
	Hybrid      bool
	Surrogate   bool
	Bacteria    bool
	Warnings    map[Warning]struct{}
	Tail        string
	// contains filtered or unexported fields
}

type Canonical

type Canonical struct {
	Value       string
	ValueRanked string
}

type Canonizer

type Canonizer interface {
	// contains filtered or unexported methods
}

type ComparisonOutput

type ComparisonOutput struct {
	Genus       *genusOutput       `json:"genus"`
	SpecEpithet *specEpithetOutput `json:"specificEpithet"`
	Comparison  string             `json:"annotationIdentification"`
}

type Engine

type Engine struct {
	BaseEngine

	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*Engine) AST

func (t *Engine) AST() *node32

func (*Engine) Add

func (t *Engine) Add(rule pegRule, begin, end, index uint32)

func (*Engine) AddWarn

func (p *Engine) AddWarn(w Warning)

func (*Engine) Execute

func (p *Engine) Execute()

func (*Engine) FullReset

func (p *Engine) FullReset()

func (*Engine) Init

func (p *Engine) Init(options ...func(*Engine) error) error

func (*Engine) IsBacteria

func (p *Engine) IsBacteria(gen string)

func (*Engine) NewNotParsedScientificNameNode

func (p *Engine) NewNotParsedScientificNameNode(pp *preprocess.Preprocessor)

func (*Engine) NewScientificNameNode

func (p *Engine) NewScientificNameNode()

func (*Engine) OutputAST

func (p *Engine) OutputAST()

func (*Engine) Parse

func (p *Engine) Parse(rule ...int) error

func (*Engine) ParsedName

func (p *Engine) ParsedName() string

func (*Engine) PrettyPrintSyntaxTree

func (t *Engine) PrettyPrintSyntaxTree(buffer string)

func (*Engine) Print

func (t *Engine) Print()

func (*Engine) PrintOutputSyntaxTree

func (p *Engine) PrintOutputSyntaxTree(w io.Writer)

func (*Engine) PrintSyntaxTree

func (p *Engine) PrintSyntaxTree()

func (*Engine) Reset

func (p *Engine) Reset()

func (*Engine) Tokens

func (t *Engine) Tokens() []token32

func (*Engine) Trim

func (t *Engine) Trim(length uint32)

func (*Engine) WriteSyntaxTree

func (p *Engine) WriteSyntaxTree(w io.Writer)

type InfraSpEpithetOutput added in v0.9.0

type InfraSpEpithetOutput struct {
	Value      string            `json:"value"`
	Rank       string            `json:"rank,omitempty"`
	Authorship *AuthorshipOutput `json:"authorship,omitempty"`
}

type Name

type Name interface {
	Valuer
	Canonizer
	Poser
	AuthorFinder
	Outputter
}

type Outputter

type Outputter interface {
	// contains filtered or unexported methods
}

type Pos

type Pos struct {
	Type  WordType
	Start int
	End   int
}

type Poser

type Poser interface {
	// contains filtered or unexported methods
}

type ScientificNameNode

type ScientificNameNode struct {
	Name
	Verbatim      string
	VerbatimID    string
	Cardinality   int
	Hybrid        bool
	Virus         bool
	Bacteria      bool
	Surrogate     bool
	Tail          string
	ParserVersion string
	Warnings      []Warning
}

func (*ScientificNameNode) AddVerbatim

func (sn *ScientificNameNode) AddVerbatim(s string)

func (*ScientificNameNode) Canonical

func (sn *ScientificNameNode) Canonical() *Canonical

func (*ScientificNameNode) Details

func (sn *ScientificNameNode) Details() []interface{}

func (*ScientificNameNode) LastAuthorship

func (sn *ScientificNameNode) LastAuthorship() *AuthorshipOutput

func (*ScientificNameNode) Pos

func (sn *ScientificNameNode) Pos() []Pos

func (*ScientificNameNode) Value

func (sn *ScientificNameNode) Value() string

type SpeciesOutput

type SpeciesOutput struct {
	Genus        *genusOutput            `json:"genus"`
	SpecEpithet  *specEpithetOutput      `json:"specificEpithet"`
	SubGenus     *subGenusOutput         `json:"infragenericEpithet,omitempty"`
	InfraSpecies []*InfraSpEpithetOutput `json:"infraspecificEpithets,omitempty"`
}

type UninomialOutput

type UninomialOutput struct {
	Uninomial *uniDetails `json:"uninomial"`
}

type Valuer

type Valuer interface {
	// contains filtered or unexported methods
}

type Warning

type Warning int
const (
	TailWarn Warning = iota
	ApostrOtherWarn
	AuthAmbiguousFiliusWarn
	AuthDoubleParensWarn
	AuthExWarn
	AuthExWithDotWarn
	AuthEmendWarn
	AuthEmendWithoutDotWarn
	AuthMissingOneParensWarn
	AuthQuestionWarn
	AuthShortWarn
	AuthUnknownWarn
	AuthUpperCaseWarn
	BacteriaMaybeWarn
	BotanyAuthorNotSubgenWarn
	CanonicalApostropheWarn
	CapWordQuestionWarn
	CharBadWarn
	GenusAbbrWarn
	GenusUpperCharAfterDash
	GreekLetterInRank
	HTMLTagsEntitiesWarn
	HybridCharNoSpaceWarn
	HybridFormulaWarn
	HybridFormulaIncompleteWarn
	HybridFormulaProbIncompleteWarn
	HybridNamedWarn
	NameApproxWarn
	NameComparisonWarn
	RankUncommonWarn
	SpaceMultipleWarn
	SpaceNonStandardWarn
	SpanishAndAsSeparator
	SpeciesNumericWarn
	SuperSpeciesWarn
	UTF8ConvBadWarn
	UninomialComboWarn
	WhiteSpaceTrailWarn
	YearCharWarn
	YearDotWarn
	YearOrigMisplacedWarn
	YearPageWarn
	YearParensWarn
	YearQuestionWarn
	YearRangeWarn
	YearSqBraketsWarn
)

type WordType

type WordType int

WordType designates semantic meaning of a word.

const (
	UnknownType WordType = iota
	ComparisonType
	ApproxType
	AuthorWordType
	AuthorWordExType
	AuthorWordEmendType
	AuthorWordFiliusType
	GenusType
	InfraSpEpithetType
	HybridCharType
	RankType
	RankUniType
	SpEpithetType
	SubGenusType
	SuperSpType
	UninomialType
	YearApproximateType
	YearType
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL