Tweak to projection->gestalt; expose projection-spec; catch capture-in-pattern error

This commit is contained in:
Tony Garnock-Jones 2014-06-18 20:18:23 -04:00
parent cade391056
commit b3db1dd464
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@
project-subs
project-pubs
projection?
projection-spec
projection->gestalt
gestalt-project*
gestalt-project
@ -140,11 +141,12 @@
(projection ml l #t p (compile-projection p)))
;; 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)
(simple-gestalt (not (projection-get-advertisements? pr))
(projection->pattern (projection-spec pr))
(projection-level pr)
(+ (projection-level pr) 1)
(projection-metalevel pr)))
;; Gestalt × Nat × Nat × Boolean × CompiledProjection → Matcher

View File

@ -236,6 +236,7 @@
;; acc is the continuation-matcher for the matcher created from p.
(define (walk p acc)
(match p
[(capture sub) (error 'pattern->matcher* "Embedded capture in one of the patterns ~v" ps0)]
[(== ?) (rwild acc)]
[(cons p1 p2) (rseq SOL (walk p1 (walk-pair-chain p2 acc)))]
[(? vector? v) (rseq SOV (vector-foldr walk (rseq EOS acc) v))]