HS toggle style: parse between/cycle, runtime, mock style dict
Parser: - Reorder toggle style parsing: target before between clause - Handle "indexed" keyword, "indexed by" syntax - Use parse-atom (not parse-expr) for between values to avoid consuming "and" as boolean operator - Support 3-4 value cycles via toggle-style-cycle Compiler: - Add toggle-style-cycle dispatch → hs-toggle-style-cycle! Runtime: - Add hs-toggle-style-between! (2-value toggle) - Add hs-toggle-style-cycle! (N-value round-robin) Mock DOM: - Parse CSS strings from setAttribute "style" into style sub-dict so dom-get-style/dom-set-style work correctly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -935,40 +935,64 @@
|
||||
(list (quote toggle-class) cls tgt)))))
|
||||
((= (tp-type) "style")
|
||||
(let
|
||||
((prop (do (let ((v (tp-val))) (adv!) v))))
|
||||
(if
|
||||
(match-kw "between")
|
||||
(let
|
||||
((val1 (parse-atom)))
|
||||
(expect-kw! "and")
|
||||
((prop (get (adv!) "value")))
|
||||
(let
|
||||
((tgt (if (match-kw "of") (parse-expr) (list (quote me)))))
|
||||
(if
|
||||
(match-kw "between")
|
||||
(let
|
||||
((val2 (parse-atom)))
|
||||
((val1 (parse-atom)))
|
||||
(expect-kw! "and")
|
||||
(let
|
||||
((tgt (parse-tgt-kw "on" (list (quote me)))))
|
||||
(list (quote toggle-style-between) prop val1 val2 tgt))))
|
||||
(let
|
||||
((tgt (parse-tgt-kw "on" (list (quote me)))))
|
||||
((val2 (parse-atom)))
|
||||
(if
|
||||
(match-kw "and")
|
||||
(let
|
||||
((val3 (parse-atom)))
|
||||
(if
|
||||
(match-kw "and")
|
||||
(let
|
||||
((val4 (parse-atom)))
|
||||
(list
|
||||
(quote toggle-style-cycle)
|
||||
prop
|
||||
tgt
|
||||
val1
|
||||
val2
|
||||
val3
|
||||
val4))
|
||||
(list
|
||||
(quote toggle-style-cycle)
|
||||
prop
|
||||
tgt
|
||||
val1
|
||||
val2
|
||||
val3)))
|
||||
(list
|
||||
(quote toggle-style-between)
|
||||
prop
|
||||
val1
|
||||
val2
|
||||
tgt))))
|
||||
(list (quote toggle-style) prop tgt)))))
|
||||
((= (tp-type) "attr")
|
||||
(let
|
||||
((attr-name (do (let ((v (tp-val))) (adv!) v))))
|
||||
(if
|
||||
(match-kw "between")
|
||||
(let
|
||||
((val1 (parse-atom)))
|
||||
(expect-kw! "and")
|
||||
((attr-name (get (adv!) "value")))
|
||||
(let
|
||||
((tgt (if (match-kw "on") (parse-expr) (list (quote me)))))
|
||||
(if
|
||||
(match-kw "between")
|
||||
(let
|
||||
((val2 (parse-atom)))
|
||||
((val1 (parse-expr)))
|
||||
(expect-kw! "and")
|
||||
(let
|
||||
((tgt (parse-tgt-kw "on" (list (quote me)))))
|
||||
((val2 (parse-expr)))
|
||||
(list
|
||||
(quote toggle-attr-between)
|
||||
attr-name
|
||||
val1
|
||||
val2
|
||||
tgt))))
|
||||
(let
|
||||
((tgt (parse-tgt-kw "on" (list (quote me)))))
|
||||
tgt)))
|
||||
(list (quote toggle-attr) attr-name tgt)))))
|
||||
((and (= (tp-type) "keyword") (= (tp-val) "my"))
|
||||
(do
|
||||
|
||||
Reference in New Issue
Block a user