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
|
|
@ -158,6 +158,8 @@
|
|||
((or (cseq? obj) (empty-list-t? obj)) '("ASeq" "ISeq" "IPersistentCollection" "Sequential" "Collection" "Iterable" "java.lang.Iterable" "Object"))
|
||||
;; java.net.URI jhost — extend-protocol java.net.URI (hiccup ToURI/ToStr).
|
||||
((and (jhost? obj) (string=? (jhost-tag obj) "uri")) '("URI" "java.net.URI" "Object"))
|
||||
;; a regex VALUE — extend-protocol java.util.regex.Pattern (core.match.regex).
|
||||
((regex-t? obj) '("Pattern" "java.util.regex.Pattern" "Object"))
|
||||
;; host value types a library may extend a protocol to by class (data.json
|
||||
;; extends JSONWriter to java.util.UUID / java.util.Date / java.math.BigDecimal).
|
||||
((juuid? obj) '("UUID" "java.util.UUID" "Object"))
|
||||
|
|
@ -236,6 +238,7 @@
|
|||
"Map" "java.util.Map" "List" "java.util.List" "Set" "java.util.Set"
|
||||
"Collection" "java.util.Collection" "Iterable" "java.lang.Iterable"
|
||||
"UUID" "BigDecimal" "Date" "Timestamp" "Instant" "java.sql.Date"
|
||||
"Pattern" "java.util.regex.Pattern"
|
||||
;; java.time value types (extend-protocol Duration / ZonedDateTime / …)
|
||||
"Duration" "Period" "LocalDate" "LocalTime" "LocalDateTime"
|
||||
"ZonedDateTime" "OffsetDateTime" "OffsetTime" "ZoneId" "ZoneOffset"
|
||||
|
|
@ -247,6 +250,7 @@
|
|||
(and (> (string-length s) pl) (string=? (substring s 0 pl) p) (substring s pl (string-length s)))))
|
||||
(define (canonical-host-tag type-name)
|
||||
(let ((base (or (strip-prefix type-name "java.lang.")
|
||||
(strip-prefix type-name "java.util.regex.")
|
||||
(strip-prefix type-name "java.util.")
|
||||
(strip-prefix type-name "java.net.")
|
||||
(strip-prefix type-name "java.math.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue