HS: elsewhere / from elsewhere modifier (+2 tests)
Parser: parse-on-feat now consumes `elsewhere` (or `from elsewhere`) as a modifier between event-name and source. When matched, sets a flag and emits :elsewhere true on parts. The `from elsewhere` form peeks one token ahead before consuming both keywords so plain `from #x` continues to parse as a source expression. Compiler: scan-on threads elsewhere?; when present, target becomes (dom-body) (so the listener attaches to body and bubbles see all clicks) and the handler body is wrapped with `(when (not (host-call me "contains" (host-get event "target"))) BODY)` so the handler fires only when the click originated outside the activated element. Generator: dropped supports "elsewhere" modifier and supports "from elsewhere" modifier from skip-list. hs-upstream-on: 48/70 → 50/70. Smoke 0-195 unchanged at 172/195. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2611,7 +2611,8 @@
|
||||
(let
|
||||
((flt (if (= (tp-type) "bracket-open") (do (adv!) (let ((f (parse-expr))) (if (= (tp-type) "bracket-close") (adv!) nil) f)) nil)))
|
||||
(let
|
||||
((source (if (match-kw "from") (parse-expr) nil)))
|
||||
((elsewhere? (cond ((match-kw "elsewhere") true) ((and (= (tp-type) "keyword") (= (tp-val) "from") (let ((nxt (if (< (+ p 1) tok-len) (nth tokens (+ p 1)) nil))) (and nxt (= (get nxt "type") "keyword") (= (get nxt "value") "elsewhere")))) (do (adv!) (adv!) true)) (true false)))
|
||||
(source (if (match-kw "from") (parse-expr) nil)))
|
||||
(let
|
||||
((h-margin nil) (h-threshold nil))
|
||||
(define
|
||||
@@ -2655,20 +2656,22 @@
|
||||
(let
|
||||
((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 count-filter (append parts (list :count-filter count-filter)) parts)))
|
||||
((parts (if source (append parts (list :from source)) 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 body))))
|
||||
parts))))))))))))))))))))))
|
||||
((parts (if finally-clause (append parts (list :finally finally-clause)) parts)))
|
||||
(let
|
||||
((parts (append parts (list body))))
|
||||
parts)))))))))))))))))))))))
|
||||
(define
|
||||
parse-init-feat
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user