parser3

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 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 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 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 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) 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) String

func (p *Parser) String() string

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 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