exprident

package
v1.0.0-alpha.15 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package exprident is the one parse-only reading of the names an expr-lang expression mentions: the free identifiers it reads from its env and the functions it calls by name. It never compiles or runs an expression.

It imports only the expr-lang parser and AST, so the no-execute layers (internal/vectors, internal/descriptor) and the engine (internal/processing) share it: the vector-reference count that decides PULSE_VECTOR_UNREFERENCED, the names an expression program binds, and the overlay built-in refusal read the same walk and cannot disagree about what an expression names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Callees

func Callees(src string) (names []string, parsed bool)

Callees returns the names an expression calls as functions (`name(...)` with an identifier callee), in walk order without repeats; parsed=false when the expression does not parse. Stock expr-lang built-ins (len, abs, ...) parse as BuiltinNode and are not callees.

func FirstCallee

func FirstCallee(src string, match func(string) bool) string

FirstCallee returns the first name, in Callees order, the expression calls for which match reports true; "" when none does or the expression does not parse (a compile then reports the syntax error). The overlay formula built-in refusal reads it at both predict hosts and the runtime compile with exprenv.OverlayRefused.

func Free

func Free(src string) (names []string, usesEnv, parsed bool)

Free returns the names an expression reads from its env, in first-use order: every identifier that is not a callee, a let binding or $env, plus `$env.name` / `$env["name"]` members; usesEnv reports any use of $env. parsed=false when the expression does not parse (a compile then reports the syntax error).

Types

type Call

type Call struct {
	Name string
	Args []string
}

Call is one call of a named function: the callee name and, per argument, the free identifier the argument IS — "" for any other argument (a literal, a nested call such as vcenter(v), an operator expression, a let-bound name or $env).

func Calls

func Calls(src string) (calls []Call, parsed bool)

Calls returns every call of a named function in the expression, in walk order (post-order: an inner call before the call enclosing it); parsed=false when the expression does not parse. The vector-kind fit check reads it to judge `cosine(v, w)` on a kind-declared vector: a bare identifier argument is the vector itself, anything else is a transform of it and is not judged.

Jump to

Keyboard shortcuts

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