Numlex Documentation
Syntax Reference

Answer tokens

How live tokens are created and used: insertion rules, supported answers, unit conversion, copying and precision limits.

Main branch reference after R89 · released versions may differ docs/SYNTAX_REFERENCE.md @ 1ebc752

An answer token is a live reference to another line: double-click an answer, and a token appears that always shows that line’s current value. Tokens link to the source line, not to a copy of its text, so they survive edits and renames.

This page documents creation (including the automatic previous-answer path), insertion rules, exactly which answer kinds can be tokenized, unit conversion with tokens, copy behavior, the Line N fallback when a source disappears, and the current precision limits of mixed token arithmetic.

Creating a token

Double-click an answer line. Double-click tokenizes:

  • .number answers — including quantities with units, and the percent/multiplier/fraction display kinds;
  • built-in sum lines (they tokenize as an ordinary dimensionless number);
  • named values (.variable, including integer ones);
  • money sums (.money).

Boolean, date, geo and DMS answers are never tokenized. There is no Insert token item in the context menu, and no command for it.

There is also a separate automatic path: when a new line starts with an operator, the app inserts the previous answer’s token by itself. That path additionally accepts exact .integer values — which double-click does not tokenize.

A token is a U+FFFC marker carrying a stable UUID-based reference. It refers to the source line (stable line ID + 1-based label), not to the answer text, so it survives renaming and editing.

Insertion rules

  • Cursor or selection on a line other than the source: the marker is inserted at the cursor; a non-empty selection is replaced by the marker.
  • Cursor or selection on the source line itself: to avoid a circular self-reference, the marker lands on a new logical line immediately after the whole source line.
  • Duplicates are allowed: as many tokens as you like may point at the same answer.

Token behavior

  • Live link: whenever the source recalculates, every occurrence of its token updates.
  • Broken link: if the source line is deleted, the token shows Line N (the last known position) as unavailable.
  • Supported result kinds: numbers (scalar/percent/multiplier/fraction, and quantities with units; built-in sum lines are an ordinary dimensionless number), named values, exact integers (the radix representation is preserved) and money sums (the token carries the ISO currency code). Booleans, dates, geo and DMS results are not tokenized.
  • Unit conversion: <token> to <unit> — the token inherits the quantity and converts like an ordinary quantity.
  • Copying: a token copies as the answer (number/unit), not as the marker.
  • Local display: a source’s local display override does not change the token’s global format — the token renders by its own/global format, not by the source’s local override.
  • Integer lane: the token displays and copies the source’s exact radix label. Mixed token operations in the current version substitute through Double, so precision above 2^53 cannot be relied on in mixed token arithmetic. The exact form TOKEN & literal (bitwise with a token literal) is deferred.

Found an issue in these docs? Report it on GitHub .