Fix hyperscript conformance: 54/112 passing (was 31/81 baseline)
Runtime visibility fix: - eval-hs now injects runtime helpers (hs-add, hs-falsy?, hs-strict-eq, hs-type-check, hs-matches?, hs-contains?, hs-coerce) via outer let binding so the tree-walker evaluator can resolve them Parser fixes: - null/undefined: return (null-literal) AST node instead of bare nil (nil was indistinguishable from "no parse result" sentinel) - === / !== tokenized as single 3-char operators - mod operator: emit (modulo) instead of (%) — modulo is a real primitive Compiler fixes: - null-literal → nil - % → modulo - contains? → hs-contains? (avoids tree-walker primitive arity conflict) Runtime additions: - hs-contains?: wraps list membership + string containment Tokenizer: - Added keywords: a, an (removed — broke all tokenization), exist - Triple operators: === and !== now tokenized correctly Scorecard: 54/112 test groups passing, +23 from baseline. Unlocked: really-equals, english comparisons, is-in, null is empty, null exists, type checks, strict equality, mod. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -172,13 +172,7 @@
|
||||
(n thunk)
|
||||
(define
|
||||
do-repeat
|
||||
(fn
|
||||
(i)
|
||||
(when
|
||||
(< i n)
|
||||
(log (str "[hs-repeat] iteration " i " of " n))
|
||||
(thunk)
|
||||
(do-repeat (+ i 1)))))
|
||||
(fn (i) (when (< i n) (thunk) (do-repeat (+ i 1)))))
|
||||
(do-repeat 0)))
|
||||
|
||||
;; Repeat forever (until break — relies on exception/continuation).
|
||||
@@ -310,4 +304,13 @@
|
||||
(if
|
||||
(string? target)
|
||||
(if (= pattern ".*") true (string-contains? target pattern))
|
||||
false)))
|
||||
false)))
|
||||
|
||||
(define
|
||||
hs-contains?
|
||||
(fn
|
||||
(collection item)
|
||||
(cond
|
||||
((list? collection) (some (fn (x) (= x item)) collection))
|
||||
((string? collection) (string-contains? collection item))
|
||||
(true false))))
|
||||
Reference in New Issue
Block a user