Expand description
Pure string transforms that turn raw user input into a meval-ready
expression, plus the classification of an input line into a Statement.
Nothing here evaluates or holds state; the service drives the pipeline,
supplying the previous answer and variable values. The separator handling is
deliberately lenient on input (see preprocess) while display formatting
stays strict in crate::domain::format.
Enums§
- Statement
- What a single input line asks the calculator to do.
Constants§
- COMMENT_
CHAR - The character that starts an inline comment (to the end of the line).
Functions§
- classify
- Classifies a raw input line as a save, an assignment or an expression.
- is_
si_ prefix - Whether
cis an accepted SI-prefix letter (the single source of truth for both SI expansion and number highlighting). - is_
valid_ var_ name - Whether
nameis a valid variable name: non-empty[A-Za-z0-9_]not starting with a digit. - looks_
incomplete - Whether
inputlooks like it is still being typed rather than genuinely malformed, so a live validity warning should be suppressed. - prepend_
ans - Prepends
answhenexprbegins with a binary operator and a previous answer exists, so+5continues from the last result. - preprocess
- Turns a raw expression into a meval-ready one:
**→^, lenient separator normalization and SI-prefix expansion. - references
- Whether
exprreferences the identifiernameat a word boundary. - strip_
comment - Returns the code part of
input: everything before the first comment marker. The comment itself is kept by the caller (history/display) but never evaluated. - substitute_
ans - Replaces the
anstoken with the previous answer (parenthesized for safety). - substitute_
identifier - Replaces every whole-word occurrence of
namewith(value). - substitute_
identifier_ with - Replaces every whole-word occurrence of
namewithreplacementverbatim.