HS: wip — parser every-fix, integration boot, test tooling expansion
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -87,12 +87,11 @@
|
||||
(not (dom-get-data script "hs-script-loaded"))
|
||||
(let
|
||||
((src (host-get script "innerHTML")))
|
||||
(when
|
||||
(and src (not (= src "")))
|
||||
(guard
|
||||
(_e (true nil))
|
||||
(eval-expr-cek (hs-to-sx-from-source src)))
|
||||
(dom-set-data script "hs-script-loaded" true)))))
|
||||
(guard
|
||||
(_e (true nil))
|
||||
(let
|
||||
((handler (eval-expr-cek (hs-to-sx-from-source src))))
|
||||
(handler (dom-body)))))))
|
||||
(hs-query-all "script[type=text/hyperscript]"))))
|
||||
|
||||
;; ── Boot: scan entire document ──────────────────────────────────
|
||||
@@ -131,8 +130,13 @@
|
||||
(dom-set-data el "hs-script" src)
|
||||
(dom-set-data el "hs-active" true)
|
||||
(dom-set-attr el "data-hyperscript-powered" "true")
|
||||
(host-set! (host-global "window") "__hs_current_me" el)
|
||||
(guard
|
||||
(_e (true nil))
|
||||
(_e
|
||||
(true
|
||||
(do
|
||||
(dom-dispatch el "hyperscript:parse-error" {:errors (list _e)})
|
||||
nil)))
|
||||
(let
|
||||
((handler (hs-handler src)))
|
||||
(let
|
||||
@@ -146,6 +150,7 @@
|
||||
safe-handler
|
||||
(hs-query-all (or comp-name "")))
|
||||
(safe-handler el))))))
|
||||
(host-set! (host-global "window") "__hs_current_me" nil)
|
||||
(dom-dispatch el "hyperscript:after:init" nil)))))))
|
||||
|
||||
(define
|
||||
|
||||
@@ -3015,7 +3015,7 @@
|
||||
(fn
|
||||
()
|
||||
(let
|
||||
((every? (match-kw "every")) (first? (match-kw "first")))
|
||||
((first? (match-kw "first")))
|
||||
(let
|
||||
((event-name (parse-compound-event-name)))
|
||||
(let
|
||||
@@ -3079,42 +3079,44 @@
|
||||
(= (tp-val) "queue"))
|
||||
(do (adv!) (adv!)))
|
||||
(let
|
||||
((having (if (or h-margin h-threshold) (dict "margin" h-margin "threshold" h-threshold) nil)))
|
||||
((every? (match-kw "every")))
|
||||
(let
|
||||
((body (parse-cmd-list)))
|
||||
((having (if (or h-margin h-threshold) (dict "margin" h-margin "threshold" h-threshold) nil)))
|
||||
(let
|
||||
((catch-clause (if (match-kw "catch") (let ((var (let ((v (tp-val))) (adv!) v)) (handler (parse-cmd-list))) (list var handler)) nil))
|
||||
(finally-clause
|
||||
(if
|
||||
(match-kw "finally")
|
||||
(parse-cmd-list)
|
||||
nil)))
|
||||
(match-kw "end")
|
||||
((body (parse-cmd-list)))
|
||||
(let
|
||||
((parts (list (quote on) event-name)))
|
||||
((catch-clause (if (match-kw "catch") (let ((var (let ((v (tp-val))) (adv!) v)) (handler (parse-cmd-list))) (list var handler)) nil))
|
||||
(finally-clause
|
||||
(if
|
||||
(match-kw "finally")
|
||||
(parse-cmd-list)
|
||||
nil)))
|
||||
(match-kw "end")
|
||||
(let
|
||||
((parts (if every? (append parts (list :every true)) parts)))
|
||||
((parts (list (quote on) event-name)))
|
||||
(let
|
||||
((parts (if flt (append parts (list :filter flt)) parts)))
|
||||
((parts (if every? (append parts (list :every true)) parts)))
|
||||
(let
|
||||
((parts (if elsewhere? (append parts (list :elsewhere true)) parts)))
|
||||
((parts (if flt (append parts (list :filter flt)) parts)))
|
||||
(let
|
||||
((parts (if source (append parts (list :from source)) parts)))
|
||||
((parts (if elsewhere? (append parts (list :elsewhere true)) parts)))
|
||||
(let
|
||||
((parts (if (> (len or-sources) 0) (append parts (list :or-sources or-sources)) parts)))
|
||||
((parts (if source (append parts (list :from source)) parts)))
|
||||
(let
|
||||
((parts (if count-filter (append parts (list :count-filter count-filter)) parts)))
|
||||
((parts (if (> (len or-sources) 0) (append parts (list :or-sources or-sources)) parts)))
|
||||
(let
|
||||
((parts (if of-filter (append parts (list :of-filter of-filter)) parts)))
|
||||
((parts (if count-filter (append parts (list :count-filter count-filter)) parts)))
|
||||
(let
|
||||
((parts (if having (append parts (list :having having)) parts)))
|
||||
((parts (if of-filter (append parts (list :of-filter of-filter)) parts)))
|
||||
(let
|
||||
((parts (if catch-clause (append parts (list :catch catch-clause)) parts)))
|
||||
((parts (if having (append parts (list :having having)) parts)))
|
||||
(let
|
||||
((parts (if finally-clause (append parts (list :finally finally-clause)) parts)))
|
||||
((parts (if catch-clause (append parts (list :catch catch-clause)) parts)))
|
||||
(let
|
||||
((parts (append parts (list (if (> (len event-vars) 0) (cons (quote do) (append (map (fn (nm) (list (quote ref) nm)) event-vars) (if (and (list? body) (= (first body) (quote do))) (rest body) (list body)))) body)))))
|
||||
parts)))))))))))))))))))))))))
|
||||
((parts (if finally-clause (append parts (list :finally finally-clause)) parts)))
|
||||
(let
|
||||
((parts (append parts (list (if (> (len event-vars) 0) (cons (quote do) (append (map (fn (nm) (list (quote ref) nm)) event-vars) (if (and (list? body) (= (first body) (quote do))) (rest body) (list body)))) body)))))
|
||||
parts))))))))))))))))))))))))))
|
||||
(define
|
||||
parse-init-feat
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user