Skip to main content

Module cel

Module cel 

Source
Expand description

VAPP-191 (eApps Q2): expressions, the Rust twin of packages/exponential-ui/src/cel.ts (line by line; read its header for the language). A SUBSET of CEL with ONE number type (a double, like JSON), hand-written so both twins replay fixtures/expressions.json exactly: numbers, dates and error texts. No loops, no user functions, a length cap, no nested comprehensions and a step limit, so it always terminates. The functions are ONE table shared with the A2UI function form ({"call": "mul", …}, call_expression_function); dates run in the team zone (an offset per instant, ExpressionEnv::offset).

Structs§

ExpressionEnv
The clock, the team zone and the step limit an evaluation runs with.

Enums§

Node
A parsed expression (at = the code point it starts at).

Constants§

CALENDAR_UNITS
CALL_NAMES
The A2UI form’s names in the bind table (size = the existing len; expr = the string form, {expr, vars}).
DATE_UNITS
Every unit dateAdd / dateDiff take; startOf / endOf take the calendar ones.
DURATION_FORMATS
The formats formatDuration writes.
FUNCTION_NAMES
THE function table (spec §4.2), positional for CEL, named (args) for the A2UI form. Generic only: no working days, no holidays.
MAX_DEPTH
MAX_LENGTH
The cost caps (spec §4.2): characters (code points), nesting, steps.
MAX_STEPS

Functions§

call_expression_function
The A2UI function form {call: name, args} with its arguments resolved. Outer None = not an expression function; inner None = no value (an error, like every bind-time function).
check_expression
Type-check an expression against the names it may read (a kind’s fields, a binding’s value): the type, or the error (the parse error, or the first type error). Types are spelled as JSON ("number", [T], a row object).
evaluate_expression
Evaluate an expression over vars: the value, or the error (a syntax, type, range or cost error).
evaluate_node
Evaluate a parsed tree (see parse_expression).
format_timestamp
An instant as YYYY-MM-DDTHH:MM:SS.sssZ (JS toISOString), years 0..9999.
parse_expression
Parse once (at package validation, or before evaluating): the tree, or the first syntax / cost error (at <code point>: <reason>).
parse_timestamp
An ISO instant (YYYY-MM-DDTHH:MM[:SS[.fff]][Z|±HH:MM], no offset = UTC) as epoch ms; None when it is not one.
type_display
The name a type prints as in an error: a list list, a row map.
type_name
The runtime type name errors print.