HS: parser attaches source spans to AST nodes

This commit is contained in:
2026-04-25 19:09:04 +00:00
parent 20a643806b
commit 9c8da50003
4 changed files with 228 additions and 88 deletions

View File

@@ -789,11 +789,12 @@
(cons (quote do) (map hs-to-sx body)))))))
(fn
(ast)
(cond
((nil? ast) nil)
((number? ast) ast)
((string? ast) ast)
((boolean? ast) ast)
(let ((ast (if (and (dict? ast) (get ast :hs-ast)) (get ast :children) ast)))
(cond
((nil? ast) nil)
((number? ast) ast)
((string? ast) ast)
((boolean? ast) ast)
((and (symbol? ast) (= (str ast) "sender"))
(list (quote hs-sender) (quote event)))
((not (list? ast)) ast)
@@ -2207,7 +2208,7 @@
(list (quote hs-halt!) (quote event) (nth ast 1)))
((= head (quote focus!))
(list (quote dom-focus) (hs-to-sx (nth ast 1))))
(true ast))))))))
(true ast)))))))))
;; ── Convenience: source → SX ─────────────────────────────────
(define hs-to-sx-from-source (fn (src) (hs-to-sx (hs-compile src))))