cupertino-files / FormulaExpression
Type Alias: FormulaExpression
FormulaExpression = {
kind:"number";value:number; } | {kind:"string";value:string; } | {kind:"boolean";value:boolean; } | {column:Coordinate;kind:"ref";row:Coordinate; } | {column:Coordinate;kind:"crossRef";row?:Coordinate;table:string; } | {column:Coordinate;kind:"columnRef"; } | {from: {column:Coordinate;row:Coordinate; };kind:"range";to: {column:Coordinate;row:Coordinate; }; } | {args:FormulaExpression[];index?:number;kind:"call";name:string; } | {kind:"date";seconds:number; } | {kind:"duration";largestUnit:number;seconds:number;smallestUnit:number;style:number;unit:number; } | {expression:FormulaExpression;kind:"thunk"; } | {expression:FormulaExpression;kind:"group"; } | {kind:"binary";left:FormulaExpression;op:BinaryOperator;right:FormulaExpression; } | {kind:"unary";op:UnaryOperator;operand:FormulaExpression; } | {kind:"empty"; }
Defined in: src/tst/formula-builder.ts:65
An expression to compile. Built by parseFormula or by hand.
Union Members
Type Literal
{ kind: "number"; value: number; }
Type Literal
{ kind: "string"; value: string; }
Type Literal
{ kind: "boolean"; value: boolean; }
Type Literal
{ column: Coordinate; kind: "ref"; row: Coordinate; }
A cell, as an offset or an absolute index; undefined means "same".
Type Literal
{ column: Coordinate; kind: "crossRef"; row?: Coordinate; table: string; }
A cell on another table: Other::A1, or its whole column with row left out. Compiling needs a resolver.
Type Literal
{ column: Coordinate; kind: "columnRef"; }
A whole column, as in SUM(D): a reference with no row at all.
Type Literal
{ from: { column: Coordinate; row: Coordinate; }; kind: "range"; to: { column: Coordinate; row: Coordinate; }; }
A rectangle, stored as a colon tract. Each axis keeps its $ flag: C3:K6 stores relative ranges (offsets from the using cell) and $C$3:$K$6 absolute ones — measured, not assumed; the corpus's =SUM(C3:K6) is relative on both axes.
Type Literal
{ args: FormulaExpression[]; index?: number; kind: "call"; name: string; }
A function by name, or by registry index where the registry names none (index wins).
Type Literal
{ kind: "date"; seconds: number; }
A date literal, as a filter rule carries one: seconds since 2001-01-01.
Type Literal
{ kind: "duration"; largestUnit: number; seconds: number; smallestUnit: number; style: number; unit: number; }
A duration literal with the display fields the app writes beside its length: the unit it was typed in and the format it shows in.
Type Literal
{ expression: FormulaExpression; kind: "thunk"; }
An argument the engine evaluates lazily (an IF branch): the expression between thunk brackets.
Type Literal
{ expression: FormulaExpression; kind: "group"; }
A parenthesised expression, which the apps keep as a one-item list node.
Type Literal
{ kind: "binary"; left: FormulaExpression; op: BinaryOperator; right: FormulaExpression; }
Type Literal
{ kind: "unary"; op: UnaryOperator; operand: FormulaExpression; }
Type Literal
{ kind: "empty"; }
An omitted argument, as in DURATION(,,8).