Skip to content

LineClassification

Defined in: packages/engine/src/lexer/ExpressionLexer.ts:35

What a line is and whether it holds anything to evaluate.

Produced by a character-level scan that never consults the keyword, unit or operator tables, so any lexer gives the same answer for the same line. See __tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts.

optional contentOffset?: number;

Defined in: packages/engine/src/lexer/ExpressionLexer.ts:57

Offset of the first evaluable character, when structural markup precedes it. Absolute, in the same coordinates the classification was asked for, and absent when the whole line is evaluable.

A list marker is markup, not arithmetic. - 100 + 20 is a bullet holding 100 + 20, but - is also a prefix operator, so without this the line evaluated as negative one hundred and answered -80: a wrong answer that looks like a right one. * and + in the same position could not even do that, one erroring and the other correct by luck, so the three markers disagreed with each other about the same document.

Consumers must slice both the text and the token stream from here, or the two describe different lines.


hasInlineSolve: boolean;

Defined in: packages/engine/src/lexer/ExpressionLexer.ts:41

Whether the line contains inline solve markers (s…“)


skip: boolean;

Defined in: packages/engine/src/lexer/ExpressionLexer.ts:39

Whether this line should be skipped (no expression evaluation)


type: MarkdownLineType;

Defined in: packages/engine/src/lexer/ExpressionLexer.ts:37

The type of this markdown line