From: Chris Hanson Date: Thu, 13 Apr 2000 15:55:56 +0000 (+0000) Subject: Change REXP-GROUP to take just one argument. X-Git-Tag: 20090517-FFI~4037 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f16bb49b241d9b0d3e57d46ab797e465c9563186;p=mit-scheme.git Change REXP-GROUP to take just one argument. --- diff --git a/v7/src/imail/rexp.scm b/v7/src/imail/rexp.scm index 76e726e7b..7992610c6 100644 --- a/v7/src/imail/rexp.scm +++ b/v7/src/imail/rexp.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: rexp.scm,v 1.2 2000/04/13 15:43:52 cph Exp $ +;;; $Id: rexp.scm,v 1.3 2000/04/13 15:55:56 cph Exp $ ;;; ;;; Copyright (c) 2000 Massachusetts Institute of Technology ;;; @@ -33,9 +33,9 @@ (and (fix:= 1 (length (cdr rexp))) (rexp? (cadr rexp)))))) (case (car rexp) - ((GROUP ALTERNATIVES SEQUENCE) + ((ALTERNATIVES SEQUENCE) (for-all? (cdr rexp) rexp?)) - ((? * +) + ((GROUP ? * +) (and (one-arg) (not (and (pair? rexp) (memq (car rexp) nongroupable-rexp-types))))) @@ -48,9 +48,9 @@ (assq (cadr rexp) syntax-type-alist))) (else #f)))))) -(define (rexp-group . rexps) `(GROUP ,@rexps)) (define (rexp-alternatives . rexps) `(ALTERNATIVES ,@rexps)) (define (rexp-sequence . rexps) `(SEQUENCE ,@rexps)) +(define (rexp-group rexp) `(GROUP ,rexp)) (define (rexp-optional rexp) `(? ,rexp)) (define (rexp* rexp) `(* ,rexp)) (define (rexp+ rexp) `(+ ,rexp)) @@ -69,7 +69,7 @@ (define (rexp-syntax-char type) `(SYNTAX-CHAR ,type)) (define (rexp-not-syntax-char type) `(NOT-SYNTAX-CHAR ,type)) -(define (rexp-compile-pattern rexp case-fold?) +(define (rexp-compile rexp case-fold?) (re-compile-pattern (rexp->regexp rexp) case-fold?)) (define (rexp->regexp rexp) @@ -92,7 +92,7 @@ (let ((alternatives (lambda () (separated-append (n-args) "\\|"))) - (repeat-arg + (group-arg (lambda () (rexp->regexp (rexp-groupify (one-arg))))) (syntax-type @@ -102,12 +102,12 @@ (cdr entry) (lose)))))) (case (car rexp) - ((GROUP) (string-append "\\(" (alternatives) "\\)")) ((ALTERNATIVES) (alternatives)) ((SEQUENCE) (apply string-append (n-args))) - ((?) (string-append (repeat-arg) "?")) - ((*) (string-append (repeat-arg) "*")) - ((+) (string-append (repeat-arg) "+")) + ((GROUP) (group-arg)) + ((?) (string-append (group-arg) "?")) + ((*) (string-append (group-arg) "*")) + ((+) (string-append (group-arg) "+")) ((ANY-CHAR) ".") ((LINE-START) "^") ((LINE-END) "$") diff --git a/v7/src/runtime/rexp.scm b/v7/src/runtime/rexp.scm index 76e726e7b..7992610c6 100644 --- a/v7/src/runtime/rexp.scm +++ b/v7/src/runtime/rexp.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: rexp.scm,v 1.2 2000/04/13 15:43:52 cph Exp $ +;;; $Id: rexp.scm,v 1.3 2000/04/13 15:55:56 cph Exp $ ;;; ;;; Copyright (c) 2000 Massachusetts Institute of Technology ;;; @@ -33,9 +33,9 @@ (and (fix:= 1 (length (cdr rexp))) (rexp? (cadr rexp)))))) (case (car rexp) - ((GROUP ALTERNATIVES SEQUENCE) + ((ALTERNATIVES SEQUENCE) (for-all? (cdr rexp) rexp?)) - ((? * +) + ((GROUP ? * +) (and (one-arg) (not (and (pair? rexp) (memq (car rexp) nongroupable-rexp-types))))) @@ -48,9 +48,9 @@ (assq (cadr rexp) syntax-type-alist))) (else #f)))))) -(define (rexp-group . rexps) `(GROUP ,@rexps)) (define (rexp-alternatives . rexps) `(ALTERNATIVES ,@rexps)) (define (rexp-sequence . rexps) `(SEQUENCE ,@rexps)) +(define (rexp-group rexp) `(GROUP ,rexp)) (define (rexp-optional rexp) `(? ,rexp)) (define (rexp* rexp) `(* ,rexp)) (define (rexp+ rexp) `(+ ,rexp)) @@ -69,7 +69,7 @@ (define (rexp-syntax-char type) `(SYNTAX-CHAR ,type)) (define (rexp-not-syntax-char type) `(NOT-SYNTAX-CHAR ,type)) -(define (rexp-compile-pattern rexp case-fold?) +(define (rexp-compile rexp case-fold?) (re-compile-pattern (rexp->regexp rexp) case-fold?)) (define (rexp->regexp rexp) @@ -92,7 +92,7 @@ (let ((alternatives (lambda () (separated-append (n-args) "\\|"))) - (repeat-arg + (group-arg (lambda () (rexp->regexp (rexp-groupify (one-arg))))) (syntax-type @@ -102,12 +102,12 @@ (cdr entry) (lose)))))) (case (car rexp) - ((GROUP) (string-append "\\(" (alternatives) "\\)")) ((ALTERNATIVES) (alternatives)) ((SEQUENCE) (apply string-append (n-args))) - ((?) (string-append (repeat-arg) "?")) - ((*) (string-append (repeat-arg) "*")) - ((+) (string-append (repeat-arg) "+")) + ((GROUP) (group-arg)) + ((?) (string-append (group-arg) "?")) + ((*) (string-append (group-arg) "*")) + ((+) (string-append (group-arg) "+")) ((ANY-CHAR) ".") ((LINE-START) "^") ((LINE-END) "$")