Documentation
¶
Index ¶
- Constants
- Variables
- func SetDebug(flags dbgFlags)
- type Choices
- type Context
- type Error
- type ListRetProc
- type MatchToken
- type Matcher
- func Adjoin(a, b Matcher) Matcher
- func List(a, b Matcher) Matcher
- func Literal(tok token.Token, lit string) Matcher
- func Repeat0(r Matcher) Matcher
- func Repeat01(r Matcher) Matcher
- func Repeat1(r Matcher) Matcher
- func Sequence(items ...Matcher) Matcher
- func String(quoteCh byte) Matcher
- func Token(tok token.Token) Matcher
- func True() Matcher
- func WhiteSpace() Matcher
- type RecursiveError
- type RetProc
- type Var
Constants ¶
View Source
const ( DbgFlagMatchVar dbgFlags = 1 << iota DbgFlagAll = DbgFlagMatchVar )
Variables ¶
View Source
var ( // ErrVarAssigned error ErrVarAssigned = errors.New("variable is already assigned") )
Functions ¶
Types ¶
type Choices ¶ added in v1.3.8
type Choices struct {
// contains filtered or unexported fields
}
Choices represents a choice matcher.
func (*Choices) CheckConflicts ¶ added in v1.3.8
type Context ¶
type Context struct { Fset *token.FileSet FileEnd token.Pos Left int LastErr error // contains filtered or unexported fields }
Context represents the context of a matching process.
func NewContext ¶ added in v1.3.7
NewContext creates a new matching context.
func (*Context) SetLastError ¶ added in v1.3.7
SetLastError sets the last error.
type ListRetProc ¶ added in v1.3.7
type MatchToken ¶ added in v1.3.8
MatchToken represents a matching literal.
func (*MatchToken) String ¶ added in v1.3.8
func (p *MatchToken) String() string
type Matcher ¶
type Matcher interface { Match(src []*types.Token, ctx *Context) (n int, result any, err error) First(in []any) (first []any, mayEmpty bool) // can be token.Token or *MatchToken }
Matcher represents a matcher.
func WhiteSpace ¶ added in v1.3.8
func WhiteSpace() Matcher
WhiteSpace returns a matcher that matches whitespace.
type RecursiveError ¶ added in v1.3.8
type RecursiveError struct {
*Var
}
RecursiveError represents a recursive error.
func (RecursiveError) Error ¶ added in v1.3.8
func (e RecursiveError) Error() string
Click to show internal directories.
Click to hide internal directories.