536 B
536 B
JOURNAL — phase lex
Approach
Tokenis adataclasswithkind: strandvalue: Union[int, float, str, None].tokenize()is a simple single-pass scanner using indexi.- Numbers: greedy scan of digits and
.; if.present →float, else →int. - Operators/parens: single-char dispatch via
_SINGLEdict. - Whitespace (space, tab): skipped silently.
- Anything else: raises
LexErrorwith the offending char and position. EOFtoken appended at the end.