Documentation ¶
Index ¶
- Constants
- func ErrPos(s string, pos int) string
- func ExprASTResult(expr ExprAST, exprDatas ...ParameterExprData) float64
- func ExprASTResultByAntlr(expr ExprAST, exprDatas ParameterExprData) float64
- func ExprASTResultWithType(expr ExprAST, exprDatas ParameterExprData, astType string) float64
- type AST
- type BinaryExprAST
- type ExprAST
- type NumberExprAST
- type ParameterExprAST
- type ParameterExprData
- type Parser
- type Token
Constants ¶
View Source
const ( // 字面量,e.g. 50 Literal = iota // 操作符, e.g. + - * / Operator // 参数变量 Parameter )
Variables ¶
This section is empty.
Functions ¶
func ExprASTResult ¶
func ExprASTResult(expr ExprAST, exprDatas ...ParameterExprData) float64
一个典型的后序遍历求解算法
func ExprASTResultByAntlr ¶ added in v2.2.5
func ExprASTResultByAntlr(expr ExprAST, exprDatas ParameterExprData) float64
func ExprASTResultWithType ¶ added in v2.2.5
func ExprASTResultWithType(expr ExprAST, exprDatas ParameterExprData, astType string) float64
Types ¶
type AST ¶
type AST struct { // 词法分析的结果 Tokens []*Token // 错误收集 Err error // contains filtered or unexported fields }
AST 生成器结构体
type BinaryExprAST ¶
操作表达式节点
type ExprAST ¶
type ExprAST interface {
// contains filtered or unexported methods
}
基础表达式节点接口
func GetExpASTByAntlr ¶ added in v2.2.5
func GetExpASTWithType ¶ added in v2.2.5
type ParameterExprAST ¶
type ParameterExprAST struct {
Val string
}
type ParameterExprData ¶
Click to show internal directories.
Click to hide internal directories.