HS parser/compiler/mock: fix 31 test failures across 7 issues
Parser: - Relax (number? v) to v in parse-one-transition so (expr)unit works - Add (match-kw "then") before parse-cmd-list in parse-for-cmd - Handle "indexed by" syntax alongside "index" in for loops - Add "indexed" to hs-keywords to prevent unit-suffix consumption Compiler: - Use map-indexed instead of for-each for indexed for-loops Test generator: - Preserve \" escapes in process_hs_val via placeholder/restore Mock DOM: - Coerce insertAdjacentHTML values via dom_stringify (match browser) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -267,10 +267,10 @@
|
||||
(if
|
||||
(and (> (len ast) 4) (= (nth ast 4) :index))
|
||||
(list
|
||||
(quote for-each)
|
||||
(quote map-indexed)
|
||||
(list
|
||||
(quote fn)
|
||||
(list (make-symbol var-name) (make-symbol (nth ast 5)))
|
||||
(list (make-symbol (nth ast 5)) (make-symbol var-name))
|
||||
body)
|
||||
collection)
|
||||
(list
|
||||
|
||||
@@ -1223,10 +1223,10 @@
|
||||
(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")))))
|
||||
(let
|
||||
((from-val (if (match-kw "from") (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
|
||||
((value (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))))
|
||||
((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
|
||||
@@ -1521,9 +1521,9 @@
|
||||
(let
|
||||
((collection (parse-expr)))
|
||||
(let
|
||||
((idx (if (match-kw "index") (let ((iname (tp-val))) (adv!) iname) nil)))
|
||||
((idx (cond ((match-kw "index") (let ((iname (tp-val))) (adv!) iname)) ((match-kw "indexed") (do (match-kw "by") (let ((iname (tp-val))) (adv!) iname))) (true nil))))
|
||||
(let
|
||||
((body (parse-cmd-list)))
|
||||
((body (do (match-kw "then") (parse-cmd-list))))
|
||||
(match-kw "end")
|
||||
(if
|
||||
idx
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
"detail"
|
||||
"sender"
|
||||
"index"
|
||||
"indexed"
|
||||
"increment"
|
||||
"decrement"
|
||||
"append"
|
||||
|
||||
Reference in New Issue
Block a user