added provide/contract as something that automatically gets []s

svn: r2665
This commit is contained in:
Robby Findler 2006-04-12 18:12:36 +00:00
parent abb9cc18a0
commit 0002ea598b
2 changed files with 12 additions and 4 deletions

View File

@ -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))

View File

@ -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))