Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

LINES_PACKAGE

const LINES_PACKAGE: IEnginePackage;

Defined in: packages/engine/src/packages/lines/LinesPackage.ts:62

Cross-line data access, reading another line’s cached result from inside an expression. Confirmed by FOUR independent competitor apps wanting the exact same underlying capability (Numi’s prev, Notes Calculator’s line<N>, Numbr’s sum/total-to-header, NumPad’s line<N> plus range aggregation). See the internal parity notes’ “Confirmed engine limitations” item 1, now closed.

Built entirely on vm/VM.ts’s LineExecutionContext, threaded optionally through CALL_PLUGIN, every handler here explicitly checks for Pending/Error/unevaluated lines before doing arithmetic (see LinesPluginFunctions.ts’s module doc) rather than silently coercing via .toNumber() (which returns 0 for both Pending and Error).

Trigger-word collision decisions (this codebase’s established phrase-fusion-vs-bare-keyword policy, see ARCHITECTURE.md §5.1):

  • prev, bare keyword (nothing to phrase-fuse against, same shape as clamp). Accepted risk.
  • line1/line 1, normalizer-fused into LINE_REF, never claims bare line as a keyword (:line = 5 stays untouched). The l1/l 1 short alias documented by some competitors is deliberately NOT implemented in this pass, l is too common a variable name; ship line<N> first, add a narrower l<N> form later if real usage wants it.
  • line deleted, normalizer-fused into the same LINE_REF token, is what a reference becomes when its line is deleted and a host keeps references in step (LanguageService.shiftLineReferences). It answers with the named LINE_REFERENCE_DELETED error. Two identifiers side by side had no reading before, so it takes nothing that already meant something.
  • sum(/total(/average(, normalizer-fused ONLY when immediately followed by LPAREN, so :sum = 100 and MathPhrases’ existing "total of X, Y" phrase (no paren after “of”) are both unaffected.
  • “aggregate everything above until a blank line/heading” phrase-fused as "total above"/"sum above"/"average above" (deliberately NOT Numi/Numbr’s bare total/sum wording, that’s exactly the bare-keyword collision class this codebase already regressed on once, see MathPhrasesPackage.ts’s “total” note).
  • “aggregate the block under a named heading”, normalizer-fused as total of section "Travel" (and sum of/average of/count of) only when the word section and a quoted name both follow, so section is never a keyword and a variable of that name still reads.