From b3db1dd4646fa16fb28936c524fc8ff88ae5aba3 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 18 Jun 2014 20:18:23 -0400 Subject: [PATCH] Tweak to projection->gestalt; expose projection-spec; catch capture-in-pattern error --- minimart/gestalt.rkt | 6 ++++-- minimart/route.rkt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/minimart/gestalt.rkt b/minimart/gestalt.rkt index 9388cd0..91e88ed 100644 --- a/minimart/gestalt.rkt +++ b/minimart/gestalt.rkt @@ -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 diff --git a/minimart/route.rkt b/minimart/route.rkt index 29cb596..8a86d28 100644 --- a/minimart/route.rkt +++ b/minimart/route.rkt @@ -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))]