HS runtime: empty/swap/compound events, host-set! fix — 403→423 (51%)

- Fix host-set → host-set! in emit-inc/emit-dec (increment/decrement properties)
- Implement empty/clear command: parser dispatch, compiler, polymorphic runtime
- Implement swap command: parser dispatch, compiler (let+do temp swap pattern)
- Add parse-compound-event-name: joins dot/colon tokens (example.event, htmx:load)
- Add hs-compile to source parser (was only in WASM deploy copy)
- Add clear/swap to tokenizer keywords and cmd-kw? list
- Generator: fix run() with extra args, String.raw support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 09:17:43 +00:00
parent e2fe070dd4
commit eaf3c88a36
9 changed files with 1159 additions and 35 deletions

View File

@@ -292,7 +292,7 @@
(let
((obj (hs-to-sx (nth expr 1))) (prop (nth expr 2)))
(list
(quote host-set)
(quote host-set!)
obj
prop
(list
@@ -344,7 +344,7 @@
(let
((obj (hs-to-sx (nth expr 1))) (prop (nth expr 2)))
(list
(quote host-set)
(quote host-set!)
obj
prop
(list
@@ -815,6 +815,18 @@
(nth ast 1)))))
((= head (quote remove-element))
(list (quote dom-remove) (hs-to-sx (nth ast 1))))
((= head (quote empty-target))
(list (quote hs-empty-target!) (hs-to-sx (nth ast 1))))
((= head (quote swap!))
(let
((lhs (nth ast 1)) (rhs (nth ast 2)))
(list
(quote let)
(list (list (quote _swap_tmp) (hs-to-sx lhs)))
(list
(quote do)
(emit-set lhs (hs-to-sx rhs))
(emit-set rhs (quote _swap_tmp))))))
((= head (quote remove-attr))
(let
((tgt (if (nil? (nth ast 2)) (quote me) (hs-to-sx (nth ast 2)))))