Documentation
¶
Index ¶
Constants ¶
View Source
const And = PatternType(6)
View Source
const Concat = PatternType(4)
View Source
const Contains = PatternType(11)
View Source
const Empty = PatternType(1)
View Source
const Interleave = PatternType(13)
View Source
const Node = PatternType(2)
View Source
const Not = PatternType(9)
View Source
const Optional = PatternType(12)
View Source
const Or = PatternType(5)
View Source
const Reference = PatternType(8)
View Source
const ZAny = PatternType(10)
View Source
const ZeroOrMore = PatternType(7)
Variables ¶
This section is empty.
Functions ¶
func Interpret ¶
Interpret interprets the grammar given the parser and returns whether the parser is valid given the grammar. Interpret uses derivatives and simplification to recusively derive the resulting grammar. This resulting grammar's nullability then represents the result of the function. This implementation does not handle immediate recursion, see the HasRecursion function.
Types ¶
type Construct ¶
type Construct interface {
AddGrammar(g *ast.Grammar) (*Pattern, error)
AddPatternDecl(name string, p *ast.Pattern) (*Pattern, error)
SetContext(context *funcs.Context)
Deref(name string) *Pattern
NewPattern(this *ast.Pattern) (*Pattern, error)
NewConcat(ps []*Pattern) (*Pattern, error)
NewOr(ps []*Pattern) (*Pattern, error)
NewAnd(ps []*Pattern) (*Pattern, error)
NewInterleave(ps []*Pattern) (*Pattern, error)
NewZAny() *Pattern
NewEmpty() *Pattern
NewNotZAny() *Pattern
NewNot(*Pattern) (*Pattern, error)
NewZeroOrMore(*Pattern) (*Pattern, error)
}
func NewConstructor ¶
func NewConstructor() Construct
func NewConstructorOptimizedForRecords ¶
func NewConstructorOptimizedForRecords() Construct
type IfExpr ¶
func DeriveCalls ¶
type Pattern ¶
type Pattern struct {
Type PatternType
Func funcs.Bool
Patterns []*Pattern
Ref string
// contains filtered or unexported fields
}
func DeriveReturns ¶
type PatternType ¶
type PatternType int
type SetOfPatterns ¶
type SetOfPatterns struct {
List []*Patterns
Hashes map[uint64][]int
SetOfBits sets.BitsSet
SetOfZipIndexes sets.Ints
}
SetOfPatterns represents an indexed list of list of Patterns. It reverse maps a list of Patterns into a single int.
func NewSetOfPatterns ¶
func NewSetOfPatterns() *SetOfPatterns
func (*SetOfPatterns) Add ¶
func (this *SetOfPatterns) Add(ps []*Pattern) int
func (*SetOfPatterns) Get ¶
func (this *SetOfPatterns) Get(i int) *Patterns
type ZippedPatterns ¶
func Zip ¶
func Zip(patterns []*Pattern) *ZippedPatterns
func (*ZippedPatterns) Unzip ¶
func (z *ZippedPatterns) Unzip() []*Pattern
Click to show internal directories.
Click to hide internal directories.