1.4 KiB
1.4 KiB
Status — phase lex
Claimed gates
- D1 — integers and floats tokenize to NUMBER with correct numeric value
- D2 —
+ - * / ( )tokenize to the right kinds - D3 — whitespace skipped; invalid chars raise
LexErrorwith offending char and position - D4 —
calc/test_lexer.pypassespython -m unittestwith 0 failures
How to verify (exact commands)
cd <repo-root>
# D4 — all tests green
python -m unittest -q
# D1/D2 — token kinds and values for 3.5*(1-2)
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
# D3 — LexError raised for invalid char
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
Expected results
python -m unittest -q:
Ran 18 tests in 0.000s
OK
tokenize('3.5*(1-2)'):
[('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
tokenize('1 @ 2'):
raises calc.lexer.LexError: unexpected character '@' at position 2
Files
calc/__init__.py— package markercalc/lexer.py—Token,LexError,tokenize()calc/test_lexer.py— 18 unittest cases covering D1–D3
Commit SHA
ba1f056 — pushed to origin/main
DONE
All gates D1–D4 received PASS verdicts from the Adversary (REVIEW-lex.md @2026-06-15T02:16Z). No veto. Phase lex is complete.