core.match: regex + array patterns (full support); library-conformance directive
Finishes core.match — its full test suite (115/115) now passes, including the two patterns the earlier work left out: - Regex-literal patterns. A #"…" now reads as a regex VALUE (Clojure parity: the reader constructs the Pattern, so a macro receives a regex, not jolt's tagged form), and the analyzer compiles a regex value to the same :regex IR leaf via its source. emit-quoted handles a quoted regex; a regex value carries the java.util.regex.Pattern host tag so extend-protocol/instance? dispatch on it. - Primitive-array patterns. A ^Type hint's :tag is now the SYMBOL (e.g. `ints`), matching the JVM, so core.match's array-tag lookup engages the array specialization (alength/aget). jolt's :tag consumers already tolerate a symbol (hc-cell-num-ret normalizes; tag->nkind/def-meta handle both). Also: a library-conformance directive in CLAUDE.md, and the supported-libraries list (docs + site) simplified to one-line entries — a listed library is assumed to work fully, so no tallies or feature enumerations. core.match + transit-jolt added to the list. Seed change (reader/backend/30-macros) -> re-minted; the rest runtime. JVM- certified corpus rows; the stale `symbol hint -> :tag` divergence is dropped from the allowlist (jolt now matches the JVM). make test + shakesmoke green.
This commit is contained in:
parent
5737a39b7c
commit
67e642bdfb
13 changed files with 77 additions and 83 deletions
|
|
@ -289,7 +289,10 @@
|
|||
(define (rdr-meta-map m)
|
||||
(cond
|
||||
((keyword? m) (jolt-hash-map m #t))
|
||||
((symbol-t? m) (jolt-hash-map rdr-kw-tag (symbol-t-name m)))
|
||||
;; ^Type -> {:tag Type} with the SYMBOL (Clojure parity — core.match's
|
||||
;; array-tag and other libs look the tag up as a symbol; jolt's tag consumers
|
||||
;; tolerate a symbol). ^"Type" keeps the string.
|
||||
((symbol-t? m) (jolt-hash-map rdr-kw-tag m))
|
||||
((string? m) (jolt-hash-map rdr-kw-tag m))
|
||||
((pmap? m) m)
|
||||
(else (jolt-hash-map rdr-kw-tag m))))
|
||||
|
|
@ -419,9 +422,12 @@
|
|||
(values (rdr-make-set elems) j)))
|
||||
((char=? c #\() ; #(...) anonymous fn shorthand
|
||||
(rdr-read-anon-fn s i end))
|
||||
((char=? c #\") ; #"..." regex -> tagged :regex (raw source)
|
||||
((char=? c #\") ; #"..." -> a regex VALUE (Clojure parity:
|
||||
;; the reader constructs the Pattern, so a macro gets a regex, not a form).
|
||||
;; The analyzer compiles a regex value to the same :regex IR leaf via its
|
||||
;; source string.
|
||||
(let-values (((src j) (rdr-read-regex s (+ i 1) end)))
|
||||
(values (rdr-make-tagged (keyword #f "regex") src) j)))
|
||||
(values (jolt-re-pattern src) j)))
|
||||
((char=? c #\_) ; #_ discard the next form
|
||||
(let-values (((_ j) (rdr-read-form s (+ i 1) end)))
|
||||
(when (rdr-eof? _) (jolt-throw (jolt-ex-info "EOF after #_" (empty-pmap))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue