abstract

package
v0.0.0-rc22 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveMatchedOps

func ResolveMatchedOps(originalStr string, in []*MatchedOp) string

Types

type IsCapturingGroup

type IsCapturingGroup interface {
	IsCapturingGroup()
}

type MatchedOp

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

func NewMatchedOp

func NewMatchedOp(op Op, tokens []*Token) *MatchedOp

func (*MatchedOp) MatchedSubstring

func (r *MatchedOp) MatchedSubstring(originalStr string) (string, bool)

type MatchedPath

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

func NewEmptyMatchedPath

func NewEmptyMatchedPath() *MatchedPath

func NewMatchedPathChild

func NewMatchedPathChild(parentOp *MatchedOp, childPath *MatchedPath) *MatchedPath

func NewMatchedPathSimple

func NewMatchedPathSimple(matchedOp *MatchedOp) *MatchedPath

func (*MatchedPath) CapturingGroupArr

func (r *MatchedPath) CapturingGroupArr() [][]*MatchedOp

func (*MatchedPath) Length

func (r *MatchedPath) Length() int

type MatchedResults

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

func NewMatchedResults

func NewMatchedResults() *MatchedResults

func (*MatchedResults) AddAllPaths

func (r *MatchedResults) AddAllPaths(collector *MatchedResults)

func (*MatchedResults) AddLocalPaths

func (r *MatchedResults) AddLocalPaths(collector *MatchedResults, op Op, opTokens []*Token)

func (*MatchedResults) AddMatchedPath

func (r *MatchedResults) AddMatchedPath(matchedPath *MatchedPath)

func (*MatchedResults) AddMatchedPathsAfterConsumeComplex

func (r *MatchedResults) AddMatchedPathsAfterConsumeComplex(op Op)

func (*MatchedResults) AddMatchedPathsAfterSimpleConsume

func (r *MatchedResults) AddMatchedPathsAfterSimpleConsume(lengths []int, op Op, allLeastTokens []*Token)

func (*MatchedResults) Index

func (r *MatchedResults) Index(index int) *MatchedPath

func (*MatchedResults) IsMatched

func (r *MatchedResults) IsMatched() bool

func (*MatchedResults) MatchedSubstring

func (r *MatchedResults) MatchedSubstring(originalStr string) string

func (*MatchedResults) Size

func (r *MatchedResults) Size() int

type Op

type Op interface {
	Relatives
	IsOp()
}

type OpComplex

type OpComplex interface {
	Op

	// ConsumeComplex
	//   returns *MatchedResults, which is matched by op
	//       for example, in usual regexps regexp `(?:ab|abc)` can match in string "abc" by two paths: "ab" & "abc"
	//       here are the same - return all matched paths
	ConsumeComplex(tokens []*Token) *MatchedResults
}

type OpPrimitive

type OpPrimitive interface {
	Op

	// ConsumePrimitive
	//   returns array of lengths, which are matched by op
	//       for example, in usual regexps regexp `a+` can match in string "aa" - matched lengths here []int{1,2}
	//       here are the same - return all matched paths (their lengths)
	//   returns nil if not matched
	ConsumePrimitive(tokens []*Token) []int
}

type Relatives

type Relatives interface {
	SetParent(Op)
	Parent() Op
	SetChildren([]Op)
	Children() []Op
}

type RelativesImpl

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

func NewRelativesImpl

func NewRelativesImpl() *RelativesImpl

func (*RelativesImpl) Children

func (r *RelativesImpl) Children() []Op

func (*RelativesImpl) Parent

func (r *RelativesImpl) Parent() Op

func (*RelativesImpl) SetChildren

func (r *RelativesImpl) SetChildren(in []Op)

func (*RelativesImpl) SetParent

func (r *RelativesImpl) SetParent(in Op)

type Token

type Token struct {
	AntlrToken antlr.Token
	LowerText  string
}

func NewToken

func NewToken(token antlr.Token) *Token

Jump to

Keyboard shortcuts

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