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.

LineClassification

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

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:145

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:129

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


skip: boolean;

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

Whether this line should be skipped (no expression evaluation)


type: MarkdownLineType;

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

The type of this markdown line