From 7516d1e1f918d49b3c4ab102f87c2efd9b9670dd Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 18 Apr 2026 21:44:42 +0000 Subject: [PATCH] HS transition parser: handle *prop of target, possessive 's, inner targets Parser: - After parsing transition property, check for "of " inner target - Handle possessive 's token before property name in parse-one-transition - Inner target overrides outer target when present Fixes 6 transition parse errors: *width of #foo, #foo's width, query ref with of/possessive syntax. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/hyperscript/parser.sx | 41 ++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/hyperscript/parser.sx b/lib/hyperscript/parser.sx index 426ede76..6db6160e 100644 --- a/lib/hyperscript/parser.sx +++ b/lib/hyperscript/parser.sx @@ -1259,26 +1259,35 @@ (fn () (let - ((prop (cond ((= (tp-type) "style") (get (adv!) "value")) ((= (tp-val) "my") (do (adv!) (if (= (tp-type) "style") (get (adv!) "value") (get (adv!) "value")))) (true (get (adv!) "value"))))) + ((prop (cond ((= (tp-type) "style") (get (adv!) "value")) ((= (tp-val) "my") (do (adv!) (if (= (tp-type) "style") (get (adv!) "value") (get (adv!) "value")))) ((= (tp-val) "'s") (do (adv!) (if (= (tp-type) "style") (get (adv!) "value") (get (adv!) "value")))) (true (get (adv!) "value"))))) (let - ((from-val (if (match-kw "from") (let ((v (parse-atom))) (if (and v (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)) nil))) - (expect-kw! "to") + ((inner-tgt (if (match-kw "of") (parse-expr) nil))) (let - ((value (let ((v (parse-atom))) (if (and v (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)))) + ((eff-tgt (if inner-tgt inner-tgt tgt))) (let - ((dur (if (match-kw "over") (let ((v (parse-atom))) (if (and (number? v) (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)) nil))) + ((from-val (if (match-kw "from") (let ((v (parse-atom))) (if (and v (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)) nil))) + (expect-kw! "to") (let - ((using-val (if (match-kw "using") (parse-expr) nil))) - (if - from-val - (list - (quote transition-from) - prop - from-val - value - dur - tgt) - (list (quote transition) prop value dur tgt))))))))) + ((value (let ((v (parse-atom))) (if (and v (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)))) + (let + ((dur (if (match-kw "over") (let ((v (parse-atom))) (if (and (number? v) (= (tp-type) "ident") (not (hs-keyword? (tp-val)))) (let ((unit (get (adv!) "value"))) (list (quote string-postfix) v unit)) v)) nil))) + (let + ((using-val (if (match-kw "using") (parse-expr) nil))) + (if + from-val + (list + (quote transition-from) + prop + from-val + value + dur + eff-tgt) + (list + (quote transition) + prop + value + dur + eff-tgt))))))))))) (let ((first-t (parse-one-transition))) (define