Hyperscript: precedes/follows comparisons, tokenizer keywords

Parser: precedes/follows comparison operators in parse-cmp.
Tokenizer: precedes, follows, ignoring, case keywords.
Runtime: precedes?, follows? string comparison functions.

372/831 (45%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 12:20:13 +00:00
parent ae32254dfb
commit 7d798be14f
14 changed files with 218 additions and 187 deletions

View File

@@ -586,6 +586,10 @@
(list (quote strict-eq) left (parse-expr))))
((and (= typ "keyword") (or (= val "contain") (= val "include") (= val "includes")))
(do (adv!) (list (quote contains?) left (parse-expr))))
((and (= typ "keyword") (= val "precedes"))
(do (adv!) (list (quote precedes?) left (parse-atom))))
((and (= typ "keyword") (= val "follows"))
(do (adv!) (list (quote follows?) left (parse-atom))))
(true left)))))
(define
parse-collection

View File

@@ -415,6 +415,10 @@
(hs-contains? (rest collection) item)))))
(true false))))
;; Method dispatch — obj.method(args)
(define precedes? (fn (a b) (< (str a) (str b))))
;; ── 0.9.90 features ─────────────────────────────────────────────
;; beep! — debug logging, returns value unchanged
(define
hs-empty?
(fn
@@ -425,13 +429,11 @@
((list? v) (= (len v) 0))
((dict? v) (= (len (keys v)) 0))
(true false))))
;; ── 0.9.90 features ─────────────────────────────────────────────
;; beep! — debug logging, returns value unchanged
(define hs-first (fn (lst) (first lst)))
;; Property-based is — check obj.key truthiness
(define hs-last (fn (lst) (last lst)))
(define hs-first (fn (lst) (first lst)))
;; Array slicing (inclusive both ends)
(define hs-last (fn (lst) (last lst)))
;; Collection: sorted by
(define
hs-template
(fn
@@ -517,7 +519,7 @@
(set! i (+ i 1))
(tpl-loop)))))))
(do (tpl-loop) result))))
;; Collection: sorted by
;; Collection: sorted by descending
(define
hs-make-object
(fn
@@ -529,7 +531,7 @@
(fn (pair) (dict-set! d (first pair) (nth pair 1)))
pairs)
d))))
;; Collection: sorted by descending
;; Collection: split by
(define
hs-method-call
(fn
@@ -552,9 +554,9 @@
(if (= (first lst) item) i (idx-loop (rest lst) (+ i 1))))))
(idx-loop obj 0)))
(true nil))))
;; Collection: split by
(define hs-beep (fn (v) v))
;; Collection: joined by
(define hs-beep (fn (v) v))
(define hs-prop-is (fn (obj key) (not (hs-falsy? (host-get obj key)))))
(define

View File

@@ -166,7 +166,11 @@
"select"
"reset"
"default"
"halt"))
"halt"
"precedes"
"follows"
"ignoring"
"case"))
(define hs-keyword? (fn (word) (some (fn (k) (= k word)) hs-keywords)))