HS: add {prop: value; ...} CSS block syntax in add command
Parser: - Handle brace-open token in parse-add-cmd - Parse colon-separated property:value pairs until brace-close - Produces (set-styles ((prop val) ...) target) Compiler: - set-styles → (do (dom-set-style target prop1 val1) ...) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -822,6 +822,32 @@
|
||||
(let
|
||||
((tgt (if (match-kw "to") (parse-expr) (list (quote me)))))
|
||||
(list (quote set-style) prop value tgt))))
|
||||
((= (tp-type) "brace-open")
|
||||
(do
|
||||
(adv!)
|
||||
(let
|
||||
((pairs (list)))
|
||||
(define
|
||||
collect-pairs!
|
||||
(fn
|
||||
()
|
||||
(when
|
||||
(and
|
||||
(not (= (tp-type) "brace-close"))
|
||||
(not (at-end?)))
|
||||
(let
|
||||
((prop (get (adv!) "value")))
|
||||
(when (= (tp-type) "colon") (adv!))
|
||||
(let
|
||||
((val (tp-val)))
|
||||
(adv!)
|
||||
(set! pairs (cons (list prop val) pairs))
|
||||
(collect-pairs!))))))
|
||||
(collect-pairs!)
|
||||
(when (= (tp-type) "brace-close") (adv!))
|
||||
(let
|
||||
((tgt (if (match-kw "to") (parse-expr) (list (quote me)))))
|
||||
(list (quote set-styles) (reverse pairs) tgt)))))
|
||||
(true
|
||||
(let
|
||||
((value (parse-expr)))
|
||||
|
||||
Reference in New Issue
Block a user