Tweak to projection->gestalt; expose projection-spec; catch capture-in-pattern error
This commit is contained in:
parent
cade391056
commit
b3db1dd464
|
@ -13,6 +13,7 @@
|
||||||
project-subs
|
project-subs
|
||||||
project-pubs
|
project-pubs
|
||||||
projection?
|
projection?
|
||||||
|
projection-spec
|
||||||
projection->gestalt
|
projection->gestalt
|
||||||
gestalt-project*
|
gestalt-project*
|
||||||
gestalt-project
|
gestalt-project
|
||||||
|
@ -140,11 +141,12 @@
|
||||||
(projection ml l #t p (compile-projection p)))
|
(projection ml l #t p (compile-projection p)))
|
||||||
|
|
||||||
;; GestaltProjection -> Gestalt
|
;; GestaltProjection -> Gestalt
|
||||||
;; Converts a projection to an atomic unit of gestalt.
|
;; Converts a projection to an atomic unit of gestalt that will detect
|
||||||
|
;; things extractable by the projection.
|
||||||
(define (projection->gestalt pr)
|
(define (projection->gestalt pr)
|
||||||
(simple-gestalt (not (projection-get-advertisements? pr))
|
(simple-gestalt (not (projection-get-advertisements? pr))
|
||||||
(projection->pattern (projection-spec pr))
|
(projection->pattern (projection-spec pr))
|
||||||
(projection-level pr)
|
(+ (projection-level pr) 1)
|
||||||
(projection-metalevel pr)))
|
(projection-metalevel pr)))
|
||||||
|
|
||||||
;; Gestalt × Nat × Nat × Boolean × CompiledProjection → Matcher
|
;; Gestalt × Nat × Nat × Boolean × CompiledProjection → Matcher
|
||||||
|
|
|
@ -236,6 +236,7 @@
|
||||||
;; acc is the continuation-matcher for the matcher created from p.
|
;; acc is the continuation-matcher for the matcher created from p.
|
||||||
(define (walk p acc)
|
(define (walk p acc)
|
||||||
(match p
|
(match p
|
||||||
|
[(capture sub) (error 'pattern->matcher* "Embedded capture in one of the patterns ~v" ps0)]
|
||||||
[(== ?) (rwild acc)]
|
[(== ?) (rwild acc)]
|
||||||
[(cons p1 p2) (rseq SOL (walk p1 (walk-pair-chain p2 acc)))]
|
[(cons p1 p2) (rseq SOL (walk p1 (walk-pair-chain p2 acc)))]
|
||||||
[(? vector? v) (rseq SOV (vector-foldr walk (rseq EOS acc) v))]
|
[(? vector? v) (rseq SOV (vector-foldr walk (rseq EOS acc) v))]
|
||||||
|
|
Loading…
Reference in New Issue