sx: step 4 — parser spans satisfied by step 3 tokenizer fix

Verified all 4 hs-upstream-core/sourceInfo tests now pass without any parser
changes. The parser already had `link-next-cmds` (sets `:next` on each command
in a CommandList when hs-span-mode is true) and `:true-branch` extraction in
`parse-cmd` for if statements; Step 3's `:end`/`:line` token fields were the
only missing pieces.

Probed via sx_eval against the parser:
  (hs-line-at "if true\n  log 'it was true'\n    log 'it was true'"
              (list :true-branch :next))
returns "    log 'it was true'" — matches the expected upstream behaviour.

Test runner output:
  PASS: hs-upstream-core/sourceInfo > debug
  PASS: hs-upstream-core/sourceInfo > get line works for statements
  PASS: hs-upstream-core/sourceInfo > get source works for expressions
  PASS: hs-upstream-core/sourceInfo > get source works for statements
This commit is contained in:
2026-05-06 22:27:26 +00:00
parent 1824058aa3
commit b7ad5152d8

View File

@@ -74,6 +74,10 @@ Mirror to `shared/static/wasm/sx/hs-parser.sx`.
**Verify:** All 4 `hs-upstream-core/sourceInfo` tests pass.
**Outcome:** Subsumed by Step 3. Once tokens carried `:end` and `:line`, the existing
parser plumbing (`link-next-cmds` for `:next`, `:true-branch` extraction in `parse-cmd`)
worked end-to-end. All 4 `hs-upstream-core/sourceInfo` tests pass with no parser changes.
---
## Phase 3 — Native ADTs (`define-type` / `match`)
@@ -184,7 +188,7 @@ these when operands are known numbers/lists.
| 1 — JIT combinator bug | [x] | 882a4b76 |
| 2 — letrec+resume | [x] | e80e655b |
| 3 — tokenizer :end/:line | [x] | 023bc2d8 |
| 4 — parser spans complete | [ ] | |
| 4 — parser spans complete | [x] | subsumed by 023bc2d8 |
| 5 — OCaml AdtValue + define-type + match | [ ] | — |
| 6 — JS AdtValue + define-type + match | [ ] | — |
| 7 — nested patterns | [ ] | — |