expr_parser

package
v0.0.0-...-1c5f5a9 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExprNode

type ExprNode struct {
	Method    string      `json:"method"`
	Arguments []any       `json:"arguments,omitempty"`
	Children  []*ExprNode `json:"children,omitempty"`
}

func (*ExprNode) AddChild

func (n *ExprNode) AddChild(child *ExprNode)

type ExprParser

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

ExprParser 表达式解析器

func NewExprParser

func NewExprParser(expr string, proc Processor) *ExprParser

func (*ExprParser) BuildTree

func (slf *ExprParser) BuildTree() (tree *ExprTree, err error)

BuildTree 构建表达式树

func (*ExprParser) Result

func (slf *ExprParser) Result() bool

Result 计算表达式结果

func (*ExprParser) Verify

func (slf *ExprParser) Verify() error

Verify 验证表达式处理器

type ExprTree

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

func (*ExprTree) Bytes

func (slf *ExprTree) Bytes() []byte

func (*ExprTree) String

func (slf *ExprTree) String() string

type Processor

type Processor interface {
	Register(method string, handle func(args []any) bool)
	Verify(method string, args []any)
	Result(method string, args []any) bool
}

Jump to

Keyboard shortcuts

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