From 2b21f30aa7cd9cd62c878c8640a4df86044564b3 Mon Sep 17 00:00:00 2001 From: ben Date: Sun, 6 Dec 2015 23:11:58 -0500 Subject: [PATCH] [regexp] simpler way to dispatch on 1st arg --- regexp.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/regexp.rkt b/regexp.rkt index 8aaa4d6..46aac41 100644 --- a/regexp.rkt +++ b/regexp.rkt @@ -19,8 +19,6 @@ (define-syntax regexp-match! (syntax-parser [(f pat-stx arg* ...) - #:when (or (string? (syntax-e #'pat-stx)) - (regexp? (syntax-e #'pat-stx))) #:with num-groups (count-groups (format "~a" (syntax-e #'pat-stx)) #:src #'f) #:with ((index* . group-id*) ...) #`#,(for/list ([i (in-range (syntax-e #'num-groups))]) @@ -37,7 +35,8 @@ (define-for-syntax (count-groups v #:src stx) (cond [(string? v) (count-groups/string v #:src stx)] - [(regexp? v) (count-groups/regexp v #:src stx)] + ;[(regexp? v) (count-groups/regexp v #:src stx)] + ;[(pregexp? v) (count-groups/pregexp v #:src stx)] [else (error 'regexp-match! "Internal error on input" v)])) ;; Count the number of matched parentheses in a regexp pattern. @@ -66,6 +65,9 @@ (define-for-syntax (count-groups/regexp rxp #:src stx) (error 'regexp-match! "Not implemented")) +(define-for-syntax (count-groups/regexp pxp #:src stx) + (error 'regexp-match! "Not implemented")) + (define-for-syntax (group-error str reason) (raise-argument-error 'regexp-match!