Commit 629253d
feat(selfhost): AST dump span parity — tier 1 (@line:col) byte-exact 619/619
Producer (astdump.rss) now emits a per-node span suffix on every spanned node
HEAD, reading the node's REPRESENTATIVE token (the single token whose
line:col:len the parser records as Node.span):
- most nodes: their first (paren-trimmed) token
- Binary: the operator token; Try: the trailing `?`; ReceiverCall: the
receiver token; TypeRef: the NAME token (after prefix keywords)
- decls/stmts: the decl/stmt's first token (incl. attributes); MatchArm:
the arm's first token; if-let arms + synthetic protocol `Self` generic:
the `if`/`fn` token, as the parser sets them.
`expr_rep_tok` mirrors emit_expr's dispatch to recover an expr's span token
without descending (used for expr-statement heads and single-expression
closure bodies). New scan.rss accessors tk_col/tk_len; emit_at/spanof helpers.
Producer ALWAYS emits the richest ` @line:col:len` (like the lexer producer);
the harness (run_astdump) PROJECTS each line down to the active AST tier before
the byte-exact compare, so tier 0 stays span-less (619/619) and no tier flag
need thread through the producer. ast_parity_corpus prints the first differing
line per mismatch for fast iteration.
RSS_SELFHOST_AST_TIER=1 ast_parity_corpus: 619/619 byte-exact, 0 run-failures.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 1d86a43 commit 629253d
3 files changed
Lines changed: 261 additions & 99 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1473 | 1473 | | |
1474 | 1474 | | |
1475 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
1476 | 1483 | | |
1477 | 1484 | | |
1478 | 1485 | | |
1479 | 1486 | | |
1480 | | - | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
1481 | 1523 | | |
1482 | 1524 | | |
1483 | 1525 | | |
| |||
1596 | 1638 | | |
1597 | 1639 | | |
1598 | 1640 | | |
1599 | | - | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1600 | 1654 | | |
1601 | 1655 | | |
1602 | 1656 | | |
| |||
0 commit comments