expr

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalBooleanExpr

func EvalBooleanExpr(expr string, res *types.DocumentResult) bool

func EvalComparison

func EvalComparison(expr string, res *types.DocumentResult) bool

func EvalNumericExpr

func EvalNumericExpr(expr string, lookup func(id string) (float64, bool)) (float64, bool)

表达式求值(数字)支持 + - * / 和括号,以及函数 abs(x), approx(a,b,tol)->0/1, between(x,a,b)->0/1

func LookupGlobal

func LookupGlobal(res *types.DocumentResult, id string) (float64, bool)

LookupGlobal 解析 id 形如 chapter.field 或 globals.key,返回数值

func NormalizeNumber

func NormalizeNumber(v any) (any, bool)

func ParseNumber

func ParseNumber(s string) (float64, bool)

Types

type Parser

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

简单语法工具

func (*Parser) ParseExpr

func (p *Parser) ParseExpr() float64

func (*Parser) ParseFactor

func (p *Parser) ParseFactor() float64

func (*Parser) ParseTerm

func (p *Parser) ParseTerm() float64

Jump to

Keyboard shortcuts

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