OptionalcontextIf the token is part of a a function this will be set. This will be the 'closest' function if nested.
OptionalevalAllows for partial formula evaluation for tooltips or formula writing. Only available for tokens types that can be evaluated.
OptionalreferenceThe reference literal this token is part of, as an offset into ICalculation.IFormula.getReferences. Tokens sharing an index are one reference span — an editor colors them as one unit.
A1), the range operator joining two cells (: in A1:B2), a spill anchor
(#), an error reference (#REF!), and every part of a structured reference (Sales[Col],
brackets included).INDEX, OFFSET), and on an operator whose operands are not both cells
(A1:INDEX(…), @A1).OptionalrefFor a reference cell token, which part of the reference it is — 'self' for a standalone cell,
or 'left'/'right' for the operands of a range : (see ReferenceSide). Lets an editor
pick the range corner for IFormula.setReferenceModeAt (F4) without re-parsing. Absent on
non-reference tokens.
OptionaltextThe raw source text this token occupied — exactly the characters that produced it (a whitespace
token holds the literal spaces). Concatenating text across the whole array reproduces the
original expression, so a consumer can derive each token's character offset as the running sum
of text.length — no separate start/end is needed.
Pairs with value: text is what was typed, value is the resolved/normalized form. The
two diverge exactly where normalization is lossy — a number (3.0 → 3, 1**2 → 100) or a
cell (raw b2 vs the resolved coords). undefined only for a token with no captured source
image (e.g. a reference the engine rewrote programmatically rather than one the user typed).
A reference literal is ONE span: a typed sheet qualifier and a trailing spill anchor ride inside
the cell/named token's text (Sheet2!A1#), so the caret rules an editor applies per token
treat the whole reference as one. The anchor keeps its own postfix token (carrying the same
referenceIndex) imaging the empty string, so the concatenation above still holds.
The type of token.
The resolved/normalized form of the token; the shape depends on type.
Reference tokens are structured — a cell token carries IRange.FixableCellCoords,
a named or parameter token a NamedRef, a tableColumn or tableSpecifier token a
TablePartRef, and an error REFERENCE token (#REF!, #NAME?) an
ErrorRef, each holding its own sheet qualifier (coords.scope / ref.scope) so
serializers can re-emit Sheet1!…. Most other tokens (operators, function names, separators)
carry a string; literals carry their parsed value (number, boolean), an error literal its
canonical label (#DIV/0!).
Represents a portion of a formula for rendering typical in an editor.
Remarks
A token is plain data — no functions, no class instances — so a token array survives
JSON.stringifyandstructuredClone, and can cross a worker or process boundary. What the parse knows about a token (its FormulaToken.context, the names in scope there, what an unfinished part may become) is carried on the token in that form, so every consumer reads the same answer.