HS: parse-feat keyword-first guard — fix assert-throws for command-like scripts (+2 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s

parse-feat true fallback now routes directly to parse-cmd-list when the first
token is a keyword (e.g. "add - to"), so command-keyword scripts always produce
parse errors rather than being treated as subtraction expressions. Non-keyword
tokens (numbers, identifiers, paren-open) still try expression-first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 19:27:19 +00:00
parent 37f8ed74c7
commit 42c7a593cf
2 changed files with 20 additions and 14 deletions

View File

@@ -3219,14 +3219,17 @@
"worker plugin is not installed — see https://hyperscript.org/features/worker")) "worker plugin is not installed — see https://hyperscript.org/features/worker"))
((= val "bind") (do (adv!) (parse-bind-feat))) ((= val "bind") (do (adv!) (parse-bind-feat)))
(true (true
(let (if
((saved-p p)) (= (tp-type) "keyword")
(parse-cmd-list)
(let (let
((expr (guard (_e (true nil)) (parse-expr)))) ((saved-p p))
(if (let
(and expr (at-end?)) ((expr (guard (_e (true nil)) (parse-expr))))
expr (if
(do (set! p saved-p) (parse-cmd-list)))))))))) (and expr (at-end?))
expr
(do (set! p saved-p) (parse-cmd-list)))))))))))
(define (define
coll-feats coll-feats
(fn (fn

View File

@@ -3219,14 +3219,17 @@
"worker plugin is not installed — see https://hyperscript.org/features/worker")) "worker plugin is not installed — see https://hyperscript.org/features/worker"))
((= val "bind") (do (adv!) (parse-bind-feat))) ((= val "bind") (do (adv!) (parse-bind-feat)))
(true (true
(let (if
((saved-p p)) (= (tp-type) "keyword")
(parse-cmd-list)
(let (let
((expr (guard (_e (true nil)) (parse-expr)))) ((saved-p p))
(if (let
(and expr (at-end?)) ((expr (guard (_e (true nil)) (parse-expr))))
expr (if
(do (set! p saved-p) (parse-cmd-list)))))))))) (and expr (at-end?))
expr
(do (set! p saved-p) (parse-cmd-list)))))))))))
(define (define
coll-feats coll-feats
(fn (fn