From 867afdbf63ec903f297108e167b04f5d2dc1975b Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 17 Jun 2014 17:15:34 -0400 Subject: [PATCH] matcher->pretty-string --- minimart/core.rkt | 1 + minimart/route.rkt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/minimart/core.rkt b/minimart/core.rkt index 25f5677..8de10dc 100644 --- a/minimart/core.rkt +++ b/minimart/core.rkt @@ -21,6 +21,7 @@ ?! (struct-out capture) pretty-print-matcher + matcher->pretty-string matcher-key-set matcher-key-set/single projection->pattern diff --git a/minimart/route.rkt b/minimart/route.rkt index 52fbe4b..8fe202a 100644 --- a/minimart/route.rkt +++ b/minimart/route.rkt @@ -39,6 +39,7 @@ ;; Printing and Serialization pretty-print-matcher + matcher->pretty-string matcher->jsexpr jsexpr->matcher @@ -51,7 +52,7 @@ (require racket/set) (require racket/match) -(require (only-in racket/port call-with-output-string)) +(require (only-in racket/port call-with-output-string with-output-to-string)) (require (only-in racket/class object?)) (require rackunit) @@ -869,6 +870,9 @@ (newline port) m) +(define (matcher->pretty-string m #:indent [initial-indent 0]) + (with-output-to-string (lambda () (pretty-print-matcher m #:indent initial-indent)))) + ;; Matcher (Value -> JSExpr) -> JSExpr ;; Serializes a matcher to a JSON expression. (define (matcher->jsexpr m success->jsexpr)