parser3

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionExpr added in v1.3.2

type ActionExpr struct {
	Expr   Expr
	Action func([]stringParsing.ParsedNode) (stringParsing.ParsedNode, error)
}

func (ActionExpr) Parse added in v1.3.2

func (a ActionExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type Adapter added in v1.3.5

type Adapter struct {
	Parser *Parser
}

func (*Adapter) ParseFlat added in v1.3.5

func (a *Adapter) ParseFlat(code string, o ...*parsing.ParseOption) ([]stringParsing.ParsedNode, error)

func (*Adapter) String added in v1.3.5

func (a *Adapter) String() string

type AndExpr added in v1.3.5

type AndExpr struct {
	Expr Expr
}

func (AndExpr) Parse added in v1.3.5

func (a AndExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type Associativity added in v1.3.5

type Associativity int
const (
	LeftAssoc Associativity = iota
	RightAssoc
	NonAssoc
)

type ChoiceExpr

type ChoiceExpr struct {
	Alternatives []Expr
}

func (ChoiceExpr) Parse

func (c ChoiceExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type Expr

type Expr interface {
	Parse(p *Parser) ([]stringParsing.ParsedNode, error)
}

type Grammar

type Grammar map[string]Rule

type InfixInfo added in v1.3.5

type InfixInfo struct {
	Precedence int
	Assoc      Associativity
}

type NamedExpr

type NamedExpr struct {
	RuleName string
}

func (NamedExpr) Parse

func (n NamedExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type NodeExpr

type NodeExpr struct {
	NodeType string
	Expr     Expr
}

func (NodeExpr) Parse

func (n NodeExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type NotExpr added in v1.3.5

type NotExpr struct {
	Expr Expr
}

func (NotExpr) Parse added in v1.3.5

func (n NotExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type OptionalExpr

type OptionalExpr struct {
	Expr Expr
}

func (OptionalExpr) Parse

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(lexer *stringParsing.Lexer, grammar Grammar, startRule string, ignoreTypes []string) *Parser

func (*Parser) Errorf

func (p *Parser) Errorf(format string, args ...interface{}) error

func (*Parser) Expect

func (p *Parser) Expect(tokenType string) (stringParsing.ParsedNode, error)

func (*Parser) NextToken added in v1.3.2

func (p *Parser) NextToken() (stringParsing.ParsedNode, error)

func (*Parser) Parse

func (p *Parser) Parse(code string, opts ...*parsing.ParseOption) ([]stringParsing.ParsedNode, error)

func (*Parser) Peek

func (p *Parser) Peek() (stringParsing.ParsedNode, error)

func (*Parser) SkipIgnored added in v1.3.2

func (p *Parser) SkipIgnored()

func (*Parser) String

func (p *Parser) String() string

type PeekExpr added in v1.3.5

type PeekExpr struct {
	TokenType string
}

func (PeekExpr) Parse added in v1.3.5

func (p PeekExpr) Parse(prs *Parser) ([]stringParsing.ParsedNode, error)

type PrattExpr added in v1.3.5

type PrattExpr struct {
	Atom     Expr
	Prefixes map[string]Expr
	Infixes  map[string]InfixInfo
}

func (*PrattExpr) Parse added in v1.3.5

func (p *PrattExpr) Parse(prs *Parser) ([]stringParsing.ParsedNode, error)

type RepeatExpr

type RepeatExpr struct {
	Expr Expr
	Min  int
}

func (RepeatExpr) Parse

func (r RepeatExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

type Rule

type Rule struct {
	Name string
	Expr Expr
}

type SeparatedRepeatExpr added in v1.3.5

type SeparatedRepeatExpr struct {
	Element Expr
	Sep     string
	Min     int
	Max     int
}

func (SeparatedRepeatExpr) Parse added in v1.3.5

type SequenceExpr

type SequenceExpr struct {
	Exprs []Expr
}

func (SequenceExpr) Parse

type TokenExpr

type TokenExpr struct {
	TokenType string
}

func (TokenExpr) Parse

func (t TokenExpr) Parse(p *Parser) ([]stringParsing.ParsedNode, error)

Jump to

Keyboard shortcuts

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