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
|
|
@ -64,7 +64,7 @@
|
|||
(and (pmap? x)
|
||||
(eq? (jolt-get x hc-kw-jolt-type) hc-kw-jolt-tagged)
|
||||
(eq? (jolt-get x hc-kw-tag) tag)))
|
||||
(define (hc-regex? x) (hc-tagged-of x hc-kw-regex))
|
||||
(define (hc-regex? x) (regex-t? x)) ; #"..." reads as a regex VALUE now
|
||||
(define (hc-inst? x) (hc-tagged-of x hc-kw-inst))
|
||||
(define (hc-uuid? x) (hc-tagged-of x hc-kw-uuid))
|
||||
(define (hc-bigdec? x) (hc-tagged-of x hc-kw-bigdec))
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
(seq->list (jolt-seq (jolt-keys x))))) (acc '()))
|
||||
(if (null? ks) (apply jolt-vector (reverse acc))
|
||||
(loop (cdr ks) (cons (jolt-vector (car ks) (jolt-get x (car ks))) acc)))))))
|
||||
(define (hc-regex-source x) (jolt-get x hc-kw-form))
|
||||
(define (hc-regex-source x) (regex-t-source x))
|
||||
(define (hc-inst-source x) (jolt-get x hc-kw-form))
|
||||
(define (hc-uuid-source x) (jolt-get x hc-kw-form))
|
||||
|
||||
|
|
@ -188,9 +188,10 @@
|
|||
;; read from its meta. Lets jolt.passes.numeric type a call to it.
|
||||
(define (hc-cell-num-ret cell)
|
||||
(let ((m (and cell (hashtable-ref var-meta-table cell #f))))
|
||||
(and m (let ((t (jolt-get m hc-kw-tag)))
|
||||
(cond ((equal? t "double") hc-kw-double)
|
||||
((equal? t "long") hc-kw-long)
|
||||
(and m (let* ((t (jolt-get m hc-kw-tag)) ; ^double/^long is a symbol; ^"double" a string
|
||||
(s (cond ((symbol-t? t) (symbol-t-name t)) ((string? t) t) (else #f))))
|
||||
(cond ((equal? s "double") hc-kw-double)
|
||||
((equal? s "long") hc-kw-long)
|
||||
(else #f))))))
|
||||
|
||||
;; A slash-free dotted symbol whose final segment is Capitalized is a class
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue