# STATUS-lex ## DONE All gates D1–D4 verified PASS by Adversary at 2026-06-15T01:00Z (commit a0745d4). ## Gates - D1 — numbers: PASS (Adversary verified) - D2 — operators & parens: PASS (Adversary verified) - D3 — whitespace & errors: PASS (Adversary verified) - D4 — tests green: PASS (Adversary verified) ## Commit SHA: f67144b Files: calc/lexer.py, calc/test_lexer.py, calc/__init__.py ## Verification commands (re-run from a fresh clone) ```bash # D4 — all tests pass python -m unittest -q # Expected: 18 tests, 0 failures, exit 0 # D2 — operator/paren sequence python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])" # Expected: ['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF'] # D1 + D2 + D3 combined python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])" # Expected: [('NUMBER', 3.5), ('STAR', None), ('LPAREN', None), ('NUMBER', 1), ('MINUS', None), ('NUMBER', 2), ('RPAREN', None), ('EOF', None)] # D3 — LexError on invalid char python -c "from calc.lexer import tokenize; tokenize('1 @ 2')" # Expected: raises calc.lexer.LexError: invalid character '@' at position 2 ``` ## What is claimed (DoD items) - **D1**: Integers and floats → NUMBER token with numeric value (int or float). - `tokenize("42")` → `[NUMBER(42), EOF]` (int) - `tokenize("3.14")` → `[NUMBER(3.14), EOF]` (float) - `tokenize(".5")` → `[NUMBER(0.5), EOF]` (float) - `tokenize("10.")` → `[NUMBER(10.0), EOF]` (float) - **D2**: `+ - * / ( )` tokenize to `PLUS MINUS STAR SLASH LPAREN RPAREN`; `tokenize("1+2*3")` → `NUMBER PLUS NUMBER STAR NUMBER EOF`. - **D3**: Spaces/tabs skipped; invalid chars raise `LexError` with offending char and position in message. - `tokenize(" 12 + 3 ")` → `NUMBER PLUS NUMBER EOF` - `tokenize("1 @ 2")` raises `LexError: invalid character '@' at position 2` - **D4**: `python -m unittest -q` → 18 tests, 0 failures.