526 B
526 B
JOURNAL — phase lex
Implementation notes
- Used
dataclassforTokenso equality works naturally in tests. valuefield: int for integers, float for floats (including.5and10.), str for operators, None for EOF.- Number parsing handles leading-dot (
.5) and trailing-dot (10.) cases via a single scan loop trackinghas_dot. LexErrorextendsExceptiondirectly; message includes the char repr and position index.- 15 tests cover all DoD items plus edge cases (tab whitespace,
$, letterx).