HS: ask/answer + prompt/confirm mock (+4 tests)

Wire up the `ask` and `answer` commands end-to-end:

- tokenizer.sx: register `ask` and `answer` as hs-keywords.

- parser.sx: cmd-kw? gains both; parse-cmd dispatches to new
  parse-ask-cmd (emits `(ask MSG)`) and parse-answer-cmd, which
  reads `answer MSG [with YES or NO]`. The with/or pair reads
  yes/no via parse-atom — parse-expr would collapse
  `"Yes" or "No"` into `(or "Yes" "No")` before match-kw "or"
  could fire. The no-`with` form emits `(answer-alert MSG)`.

- compiler.sx: three new cond branches (ask, answer, answer-alert)
  compile to a let that binds __hs-a, sets `the-result` and `it`,
  and returns the value — so `then put it into ...` works.

- runtime.sx: hs-ask / hs-answer / hs-answer-alert call
  window.prompt / confirm / alert via host-call + host-global.

- tests/hs-run-filtered.js: test-name-keyed globalThis.{alert,
  confirm,prompt}; __currentHsTestName is updated before each
  test. Host-set! for innerHTML/textContent now coerces JS
  null → "null" (browser behaviour) so `prompt → null` →
  `put it into #out` renders literal text "null", which the
  fourth test depends on.

Suite hs-upstream-askAnswer: 1/5 -> 5/5.
Smoke 0-195: 166/195 -> 170/195.
This commit is contained in:
2026-04-24 14:08:25 +00:00
parent 30fca2dd19
commit 6c1da9212a
11 changed files with 244 additions and 60 deletions

View File

@@ -4,10 +4,10 @@ Live tally for `plans/hs-conformance-to-100.md`. Update after every cluster comm
```
Baseline: 1213/1496 (81.1%)
Merged: 1260/1496 (84.2%) delta +47
Merged: 1264/1496 (84.5%) delta +51
Worktree: all landed
Target: 1496/1496 (100.0%)
Remaining: ~236 tests
Remaining: ~232 tests
```
## Cluster ledger
@@ -53,7 +53,7 @@ Remaining: ~236 tests
|---|---------|--------|---|--------|
| 26 | resize observer mock + `on resize` | done | +3 | 304a52d2 |
| 27 | intersection observer mock + `on intersection` | done | +3 | 0c31dd27 |
| 28 | `ask`/`answer` + prompt/confirm mock | pending | (+4 est) | — |
| 28 | `ask`/`answer` + prompt/confirm mock | done | +4 | SHA-PENDING |
| 29 | `hyperscript:before:init` / `:after:init` / `:parse-error` | pending | (+46 est) | — |
| 30 | `logAll` config | done | +1 | 64bcefff |
@@ -87,7 +87,7 @@ Defer until AD drain. Estimated ~25 recoverable tests.
|--------|-----:|--------:|--------:|--------:|--------:|------------:|------:|
| A | 12 | 4 | 0 | 0 | 1 | — | 17 |
| B | 5 | 0 | 0 | 1 | 1 | — | 7 |
| C | 3 | 0 | 0 | 2 | 0 | — | 5 |
| C | 4 | 0 | 0 | 1 | 0 | — | 5 |
| D | 0 | 0 | 0 | 5 | 0 | — | 5 |
| E | 0 | 0 | 0 | 0 | 0 | 5 | 5 |
| F | — | — | — | ~10 | — | — | ~10 |