Module parser

Source
Expand description

Expression parsing and tokenization functions

Functions§

extract_line_references
Extract all line references from a text string Returns a vector of (start_pos, end_pos, line_number) tuples for each “lineN” found
is_valid_math_expression
Check if a string represents a valid mathematical expression
is_valid_mathematical_expression
Check if a sequence of tokens forms a valid mathematical expression
parse_line_reference
Parse a line reference string like “line1”, “line2” etc.
tokenize_with_units
Tokenize any text into tokens - always succeeds, may include non-mathematical tokens
update_line_references_in_text
Update line references in text by applying an offset to references >= threshold If offset is positive: increment references >= threshold If offset is negative: decrement references > threshold, mark deleted line refs as invalid