Commit 9866727
feat(python-face): ADR-010 Priority 2 — Python-style surface syntax
Adds lib/python_face.ml: a source-level text transformer that maps
Python-style AffineScript to canonical AffineScript before lex+parse.
The compiler is entirely face-agnostic; only python_face.ml knows about
the transformation.
Supported surface mappings
def → fn, True/False/None → true/false/()
and/or/not → &&/||/!
class → type, pass → ()
# comment → // comment
import a.b → use a::b, from a import b → use a::b
INDENT/DEDENT → {}/} (indentation-based blocks)
colon-at-EOL → { (block-opening)
else:/elif COND: → else {/else if COND { (merged with dedent })
statement lines get automatic ;
CLI: `affinescript parse --face python FILE`
`affinescript preview-python FILE` (debug: show canonical text)
5 new E2E tests (Python-Face suite). 73/73 total: 0 regressions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 4322963 commit 9866727
6 files changed
Lines changed: 482 additions & 11 deletions
File tree
- .machine_readable/6a2
- bin
- lib
- test
- e2e/fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
62 | 70 | | |
63 | | - | |
| 71 | + | |
64 | 72 | | |
65 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
66 | 77 | | |
67 | 78 | | |
68 | 79 | | |
| |||
433 | 444 | | |
434 | 445 | | |
435 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
436 | 457 | | |
437 | 458 | | |
438 | 459 | | |
| |||
441 | 462 | | |
442 | 463 | | |
443 | 464 | | |
444 | | - | |
| 465 | + | |
445 | 466 | | |
446 | 467 | | |
447 | 468 | | |
| |||
473 | 494 | | |
474 | 495 | | |
475 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
476 | 502 | | |
477 | 503 | | |
478 | 504 | | |
479 | 505 | | |
480 | | - | |
| 506 | + | |
481 | 507 | | |
482 | 508 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments