filters

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: BSD-3-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRootVarname

func IsRootVarname(varname string) bool

func Parse

func Parse(tab *OperationsTable, s string) (*Expr, Info, error)

func Sprint

func Sprint(info *Info, e *Expr) string

func Walk

func Walk(e *Expr, callback func(e *Expr) bool)

Types

type Expr

type Expr struct {
	Op   Operation
	Num  int32
	Args []*Expr
	Str  string
}

type Info

type Info struct {
	FilePredicates     []SpecialPredicate
	FunctionPredicates []SpecialPredicate

	Vars []string

	OpTab *OperationsTable
}

func (*Info) String

func (info *Info) String() string

type Operation

type Operation uint32
const (
	OpInvalid Operation = 0

	// OpNop = do nothing (should be optimized-away, unless it's a top level op)
	OpNop Operation = math.MaxUint32 - iota

	// OpString is a string literal that holds the value inside $Str.
	OpString

	// OpNot = !$Args[0]
	OpNot

	// OpAnd = $Args[0] && $Args[1]
	OpAnd

	// OpOr = $Args[0] || $Args[1]
	OpOr

	// OpEq = $Args[0] == $Args[1]
	OpEq

	// OpNotEq = $Args[0] != $Args[1]
	OpNotEq

	// OpFunctionVarFunc = function.$Str()
	OpFunctionVarFunc
)

func (Operation) IsBuiltin

func (op Operation) IsBuiltin() bool

func (Operation) String

func (i Operation) String() string

type OperationsTable

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

func NewOperationTable

func NewOperationTable(varFuncs map[string]Operation) *OperationsTable

type SpecialPredicate

type SpecialPredicate struct {
	Name    string
	Negated bool
}

Jump to

Keyboard shortcuts

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