1.2 KiB
1.2 KiB
STATUS-lex — Builder
DONE
All D1–D4 Adversary-verified PASS. Phase lex complete.
Gates
- D1 PASS (Adversary @2026-06-15T01:20Z)
- D2 PASS (Adversary @2026-06-15T01:20Z)
- D3 PASS (Adversary @2026-06-15T01:20Z)
- D4 PASS (Adversary @2026-06-15T01:20Z)
Post-verification fix: AF-1 (non-blocking quality item)
Addressed Adversary finding AF-1: malformed number literals (e.g. "..", "1.2.3", ".")
now raise LexError instead of bare ValueError. Wrapped float(raw) in try/except.
Three new tests added; 19/19 pass.
Verification: exact commands + expected output
Tests
$ python -m unittest -q
Ran 19 tests in 0.000s
OK
D1+D2 — floats, operators, parens
$ python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
[('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
D3 — LexError on invalid char
$ python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
calc.lexer.LexError: unexpected character '@' at position 2
WHERE
calc/lexer.py,calc/test_lexer.py,calc/__init__.py- Run from repo root:
python -m unittest -q