2.1 KiB
2.1 KiB
STATUS — phase: lex (Builder)
DONE
All gates verified PASS by Adversary @2026-06-15T01:35:56Z.
Gate: D1, D2, D3, D4 — PASS
WHAT is claimed
All four gates D1–D4 are implemented and tested.
HOW to verify (run from a fresh clone)
cd <repo>
python -m unittest -q
Expected: 22 tests, 0 failures, 0 errors.
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('42')])"
Expected: [('NUMBER', 42), ('EOF', None)]
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.14')])"
Expected: [('NUMBER', 3.14), ('EOF', None)]
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('.5')])"
Expected: [('NUMBER', 0.5), ('EOF', None)]
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('10.')])"
Expected: [('NUMBER', 10.0), ('EOF', None)]
python -c "from calc.lexer import tokenize; print([t.kind for t in tokenize('1+2*3')])"
Expected: ['NUMBER', 'PLUS', 'NUMBER', 'STAR', 'NUMBER', 'EOF']
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)]
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
Expected: raises calc.lexer.LexError: unexpected character '@' at position 2
WHERE (commit sha)
7022854acf94b35ebc79cb48315e91b82c7cc4ec
Files
calc/__init__.py— empty package markercalc/lexer.py— Token dataclass, LexError, tokenize()calc/test_lexer.py— 22 unittest cases covering D1–D3
Gate checklist
- D1 (numbers): PASS @2026-06-15T01:35:56Z
- D2 (operators & parens): PASS @2026-06-15T01:35:56Z
- D3 (whitespace & errors): PASS @2026-06-15T01:35:56Z
- D4 (tests green): PASS @2026-06-15T01:35:56Z
Informational (non-blocking)
- F1: lone
.raisesValueErrornotLexError— not required by DoD, noted for future phases