From 3c46cbfadb38c63657159628f7652ae63813f195 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 12 Apr 2006 18:12:36 +0000 Subject: [PATCH] added provide/contract as something that automatically gets []s svn: r2665 original commit: 0002ea598bf1e1301458c93bdc6fe8aecf21f4fa --- collects/framework/private/scheme.ss | 12 +++++++++--- collects/tests/framework/keys.ss | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/collects/framework/private/scheme.ss b/collects/framework/private/scheme.ss index a2bd4b94..9a789aa9 100644 --- a/collects/framework/private/scheme.ss +++ b/collects/framework/private/scheme.ss @@ -1243,7 +1243,10 @@ ;; there is a sexp before this, but it isn't parenthesized. ;; if it is the `cond' keyword, we get a square bracket. otherwise not. (if (and (beginning-of-sequence? text backward-match) - (text-between-equal? "cond" text backward-match before-whitespace-pos)) + (ormap + (λ (x) + (text-between-equal? x text backward-match before-whitespace-pos)) + '("cond" "provide/contract"))) #\[ #\()]))] [(not (zero? before-whitespace-pos)) @@ -1275,13 +1278,16 @@ #\(]))] [else #\(]))))) + ;; beginning-of-sequence? : text number -> boolean + ;; determines if this position is at the beginning of a sequence + ;; that begins with a parenthesis. (define (beginning-of-sequence? text start) (let ([before-space (send text skip-whitespace start 'backward #t)]) (cond [(zero? before-space) #t] [else - (member (send text get-character (- before-space 1)) - '(#\( #\[ #\{))]))) + (equal? (send text get-character (- before-space 1)) + #\()]))) (define (text-between-equal? str text start end) (and (= (string-length str) (- end start)) diff --git a/collects/tests/framework/keys.ss b/collects/tests/framework/keys.ss index fca16a7a..1e36c5cb 100644 --- a/collects/tests/framework/keys.ss +++ b/collects/tests/framework/keys.ss @@ -119,6 +119,7 @@ (build-open-bracket-spec "(f let (" 8 #\() (build-open-bracket-spec "(let (" 6 #\[) (build-open-bracket-spec "(let (" 5 #\() + (build-open-bracket-spec "(provide/contract " 18 #\[) (build-open-bracket-spec "(kond " 5 #\() (build-open-bracket-spec "(cond " 5 #\[) (build-open-bracket-spec "(let ([]" 8 #\[) @@ -134,7 +135,8 @@ (build-open-bracket-spec "(let (" 6 #\[) (build-open-bracket-spec "(new x% " 8 #\[) (build-open-bracket-spec "#\\" 1 #\[) - (build-open-bracket-spec "#\\a" 1 #\[))) + (build-open-bracket-spec "#\\a" 1 #\[) + (build-open-bracket-spec "(let ([let (" 12 #\())) (send-sexp-to-mred `(send (make-object frame:basic% "dummy to trick frame group") show #t))