math_node

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryOpNode

type BinaryOpNode struct {
	Left     Node
	Operator string
	Right    Node
	Pos      int // 运算符在表达式中的位置,用于错误报告
}

BinaryOpNode 二元运算符节点

func (*BinaryOpNode) Eval

Eval 实现 BinaryOpNode 的 Eval 方法

type FunctionNode

type FunctionNode struct {
	FuncName string
	Args     []Node
	Pos      int // 函数在表达式中的位置,用于错误报告
}

FunctionNode 函数节点

func (*FunctionNode) Eval

Eval 实现 FunctionNode 的 Eval 方法

type Node

type Node interface {
	Eval(ctx context.Context, vars map[string]decimal.Decimal, config *math_config.CalcConfig) (decimal.Decimal, error)
}

Node 表达式节点接口

type NumberNode

type NumberNode struct {
	Value decimal.Decimal
}

NumberNode 数字节点

func (*NumberNode) Eval

Eval 实现 NumberNode 的 Eval 方法

type UnaryOpNode

type UnaryOpNode struct {
	Operator string
	Operand  Node
	Pos      int // 运算符在表达式中的位置,用于错误报告
}

UnaryOpNode 一元运算符节点

func (*UnaryOpNode) Eval

Eval 实现 UnaryOpNode 的 Eval 方法

type VariableNode

type VariableNode struct {
	VarName string
	Pos     int // 变量在表达式中的位置,用于错误报告
}

VariableNode 变量节点

func (*VariableNode) Eval

Eval 实现 VariableNode 的 Eval 方法

Jump to

Keyboard shortcuts

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