2.4 KiB
2.4 KiB
REVIEW-lex.md — Adversary verdicts
Status
All D1–D4 PASS. Phase complete.
Verdicts
lex/D1: PASS @2026-06-15T01:20Z
Cold-ran:
tokenize("42")→[Token('NUMBER', 42), Token('EOF', None)]— value isint✓tokenize("3.14")→NUMBER(3.14)asfloat✓tokenize(".5")→NUMBER(0.5)asfloat✓tokenize("10.")→NUMBER(10.0)asfloat✓- EOF is always the final token with
value=Noneacross all inputs ✓
lex/D2: PASS @2026-06-15T01:20Z
Cold-ran:
tokenize("+-*/()")→PLUS MINUS STAR SLASH LPAREN RPAREN EOF✓tokenize("1+2*3")→NUMBER PLUS NUMBER STAR NUMBER EOF✓tokenize("3.5*(1-2)")→[('NUMBER',3.5),('STAR','*'),('LPAREN','('),('NUMBER',1),('MINUS','-'),('NUMBER',2),('RPAREN',')'),('EOF',None)]— matches expected exactly ✓
lex/D3: PASS @2026-06-15T01:20Z
Cold-ran:
tokenize(" 12 + 3 ")→NUMBER(12) PLUS NUMBER(3) EOF(spaces skipped) ✓tokenize("1\t+\t2")→ tabs skipped ✓tokenize("1 @ 2")→ raisesLexError: unexpected character '@' at position 2✓tokenize("$5")→ raisesLexErrorwith'$'in message ✓tokenize("1 x 2")→ raisesLexErrorwith'x'in message ✓- Error message includes the offending char and its position ✓
lex/D4: PASS @2026-06-15T01:20Z
Cold-ran python -m unittest -q from repo root:
Ran 16 tests in 0.000s
OK
16 tests, 0 failures. Required coverage confirmed present:
" 12 + 3 "tested intest_spaces_between✓"3.5*(1-2)"tested intest_complex_expr✓"1 @ 2"raisesLexErrortested intest_at_raisesandtest_error_position_in_message✓
Adversary findings
AF-1: ValueError on malformed number literals (not a DoD blocker)
Malformed number sequences raise bare ValueError instead of LexError:
tokenize("..") → ValueError: could not convert string to float: '..'
tokenize("1.2.3") → ValueError: could not convert string to float: '1.2.3'
tokenize(".") → ValueError: could not convert string to float: '.'
Root cause: lexer.py:32 calls float(raw) without a try/except. The number scanner at lines 29–31 greedily consumes any sequence of digits and dots without validating it's a valid float first.
This does NOT block D1–D4 — these inputs are outside the explicit DoD scope (D3 only requires LexError for @, $, and letters). Filing as a quality note for the Builder to address optionally, or for a future phase.