improved the error reporting in the REPL and misc other minor changes

svn: r10014
This commit is contained in:
Robby Findler 2008-05-29 04:55:43 +00:00
parent 9777a6d079
commit 612f26972e
15 changed files with 6484 additions and 6158 deletions

File diff suppressed because it is too large Load Diff

View File

@ -52,26 +52,26 @@
test-coverage-tab-mixin)) test-coverage-tab-mixin))
(define-signature drscheme:debug^ extends drscheme:debug-cm^ (define-signature drscheme:debug^ extends drscheme:debug-cm^
(make-debug-error-display-handler (make-debug-error-display-handler
make-debug-error-display-handler/text
make-debug-eval-handler make-debug-eval-handler
hide-backtrace-window error-display-handler/stacktrace
print-bug-to-stderr
test-coverage-enabled test-coverage-enabled
profiling-enabled profiling-enabled
add-prefs-panel add-prefs-panel
get-error-color get-error-color
show-error-and-highlight hide-backtrace-window
open-and-highlight-in-file
show-backtrace-window show-backtrace-window
open-and-highlight-in-file
get-cm-key get-cm-key
display-srcloc-in-error ;show-error-and-highlight
show-syntax-error-context)) ;print-bug-to-stderr
;display-srclocs-in-error
;show-syntax-error-context
))
(define-signature drscheme:module-langauge-cm^ (define-signature drscheme:module-langauge-cm^
(module-language<%>)) (module-language<%>))

View File

@ -19,7 +19,8 @@
framework framework
(lib "syntax-browser.ss" "mrlib") (lib "syntax-browser.ss" "mrlib")
compiler/distribute compiler/distribute
compiler/bundle-dist) compiler/bundle-dist
"rep.ss")
(import [prefix drscheme:debug: drscheme:debug^] (import [prefix drscheme:debug: drscheme:debug^]
[prefix drscheme:tools: drscheme:tools^] [prefix drscheme:tools: drscheme:tools^]
@ -106,21 +107,6 @@
get-reader)) get-reader))
; ;;;
;
;
;;; ;;; ;;; ; ; ;;; ; ;;;
; ; ; ; ; ; ; ; ; ; ;
;;; ; ; ; ; ; ; ; ;;;;;
; ; ; ; ; ; ; ; ;
; ; ; ; ; ; ; ; ; ; ;
;;; ;;;;; ;; ; ;; ;;;; ;;;;;; ;;;
;
;
;;;
(define simple-module-based-language% (define simple-module-based-language%
(class* object% (simple-module-based-language<%>) (class* object% (simple-module-based-language<%>)
(init-field module (init-field module
@ -131,7 +117,8 @@
(documentation-reference #f) (documentation-reference #f)
(reader (λ (src port) (reader (λ (src port)
(let ([v (parameterize ([read-accept-reader #t]) (let ([v (parameterize ([read-accept-reader #t])
(read-syntax src port))]) (with-stacktrace-name
(read-syntax src port)))])
(if (eof-object? v) (if (eof-object? v)
v v
(namespace-syntax-introduce v))))) (namespace-syntax-introduce v)))))
@ -149,19 +136,6 @@
;; ;;; ;; ;;
; ; ; ;
; ; ; ; ;
; ;;; ; ;;; ;;;; ;; ;; ; ;;; ;;;; ;;;; ;;; ;;; ;;;;
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
;;;;; ; ; ; ; ; ; ; ; ; ; ; ;;;;; ;;;;; ; ; ;;;; ;;; ;;;;; ; ;
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
; ;; ; ;; ;;; ;;; ; ;;; ; ;;;;;; ;;; ; ;;; ;;; ; ;;; ;;; ;;; ;
;; simple-module-based-language->module-based-language : module-based-language<%> ;; simple-module-based-language->module-based-language : module-based-language<%>
;; transforms a simple-module-based-language into a module-based-language<%> ;; transforms a simple-module-based-language into a module-based-language<%>
(define simple-module-based-language->module-based-language-mixin (define simple-module-based-language->module-based-language-mixin
@ -502,23 +476,6 @@
(read-case-sensitive ,(simple-settings-case-sensitive setting))))) (read-case-sensitive ,(simple-settings-case-sensitive setting)))))
;;;
;
; ;
; ; ;;;; ; ;;; ;;; ;;; ;; ;;;; ;;; ; ;;;
; ; ; ;; ; ; ; ; ; ; ; ; ; ;
;;;;; ; ; ;;;; ; ; ; ; ; ; ;;;; ; ; ;;;;;
; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
; ;;;;;; ;;; ;;;; ;; ;;;; ;;; ; ;;; ; ;;;; ;;;
; ;
; ;
;;; ;;;
;; module-based-language->language : module-based-language -> language<%> ;; module-based-language->language : module-based-language -> language<%>
;; given a module-based-language, implements a language ;; given a module-based-language, implements a language
(define module-based-language->language-mixin (define module-based-language->language-mixin
@ -1147,7 +1104,8 @@
(namespace-syntax-introduce (namespace-syntax-introduce
(datum->syntax (datum->syntax
#f #f
(cons '#%top-interaction s))) (cons '#%top-interaction s)
s))
s)))) s))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -424,8 +424,7 @@
stx)) stx))
;; rewrite the module to use the scheme/base version of `module' ;; rewrite the module to use the scheme/base version of `module'
(values v-name (values v-name
#`(#,(datum->syntax #'here 'module) #`(#,(datum->syntax #'here 'module) name lang bodies ...)))]
name lang bodies ...)))]
[else [else
(raise-syntax-error 'module-language (raise-syntax-error 'module-language
"only module expressions are allowed" "only module expressions are allowed"

File diff suppressed because it is too large Load Diff

View File

@ -1124,13 +1124,10 @@ If the namespace does not, they are colored the unbound color.
(λ () ;; =drs= (λ () ;; =drs=
(show-error-report/tab)))) (show-error-report/tab))))
(drscheme:debug:show-error-and-highlight (drscheme:debug:error-display-handler/stacktrace
msg exn msg
(λ (src-to-display cms) ;; =user= exn
(parameterize ([current-eventspace drs-eventspace]) '())
(queue-callback
(λ () ;; =drs=
(send (send the-tab get-ints) highlight-errors src-to-display cms))))))
(semaphore-post error-display-semaphore))) (semaphore-post error-display-semaphore)))

View File

@ -296,18 +296,20 @@ all of the names in the tools library, for use defining keybindings
; ;;;; ; ;;;;
(proc-doc/names (proc-doc/names
drscheme:debug:show-error-and-highlight drscheme:debug:error-display-handler/stacktrace
(-> string? (->* (string? any/c)
(or/c any/c exn?) ((or/c false/c (listof srcloc?)))
(-> (listof srcloc?) (or/c false/c (listof (list/c (is-a?/c text%) number? number?))) any) any)
any) ((msg exn) ((stack #f)))
(msg exn highlight-errors) @{Displays the error message represented by the string, adding
@{The first two arguments are the same as the arguments to the error-display-handler. embellishments like those that appears in the DrScheme REPL,
This function prints the error message to the current-error-port, like the default error-display-handler specifically a clickable icon for the stack trace (if the srcloc location is not empty),
and also calls @scheme[highlight-errors] to do error highlighting. It is be passed the stack trace and a clickable icon for the source of the error (read & syntax errors show their source
for the error message. locations and otherwise the first place in the stack trace is shown).
This function should be called on the same thread/eventspace where the error happened.}) If @scheme[stack] is false, then the stack trace embedded in the @scheme[exn] argument (if any) is used.
This should be called in the same eventspace and on the same thread as the error.})
(proc-doc/names (proc-doc/names
drscheme:debug:make-debug-error-display-handler drscheme:debug:make-debug-error-display-handler
@ -323,7 +325,7 @@ all of the names in the tools library, for use defining keybindings
@scheme[drscheme:debug:make-debug-eval-handler]. @scheme[drscheme:debug:make-debug-eval-handler].
See also MzScheme's See also MzScheme's
MzLink{mz:p:error-display-handler}{error-display-handler} @scheme[error-display-handler]
parameter. parameter.
If the current-error-port is the definitions window in If the current-error-port is the definitions window in
@ -345,7 +347,7 @@ all of the names in the tools library, for use defining keybindings
This function is designed to work in conjunction with This function is designed to work in conjunction with
@scheme[drscheme:debug:make-debug-error-display-handler]. @scheme[drscheme:debug:make-debug-error-display-handler].
See also MzScheme's MzLink{mz:p:eval-handler}{eval-handler} See also MzScheme's @scheme[eval-handler]
parameter. parameter.
The resulting eval-handler expands and annotates the input The resulting eval-handler expands and annotates the input
@ -384,10 +386,8 @@ all of the names in the tools library, for use defining keybindings
(srcloc? . -> . void?) (srcloc? . -> . void?)
(debug-info) (debug-info)
@{This function opens a DrScheme to display @{This function opens a DrScheme to display
@scheme[debug-info]. The first element in @scheme[debug-info]. Only the src the position
the cons indicates where the file is and the span fields of the srcloc are considered.
and the two number indicate a range of
text to show.
See also See also
@scheme[drscheme:debug:get-cm-key].}) @scheme[drscheme:debug:get-cm-key].})

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -329,6 +329,11 @@ please adhere to these guidelines:
(help-desk-this-is-just-example-text (help-desk-this-is-just-example-text
"This is just example text for setting the font size. Open Help Desk proper (from Help menu) to follow these links.") "This is just example text for setting the font size. Open Help Desk proper (from Help menu) to follow these links.")
;; this appears in the bottom part of the frame the first time the user hits `f1'
;; (assuming nothing else has loaded the documentation index first)
;; see also: cs-status-loading-docs-index
(help-desk-loading-documentation-index "Help Desk: loading documentation index")
;; Help desk htty proxy ;; Help desk htty proxy
(http-proxy "HTTP Proxy") (http-proxy "HTTP Proxy")
(proxy-direct-connection "Direct connection") (proxy-direct-connection "Direct connection")

View File

@ -14,7 +14,7 @@
mzlib/etc mzlib/etc
(lib "gui.ss" "tests" "utils") (lib "gui.ss" "tests" "utils")
mzlib/contract) mzlib/contract)
(provide/contract (provide/contract
[use-get/put-dialog ((-> any) path? . -> . void?)]) [use-get/put-dialog ((-> any) path? . -> . void?)])

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@
(regexp "first>")) (regexp "first>"))
(make-test "(module m mzscheme (require (all-except (lib \"list.ss\") foldl)))" (make-test "(module m mzscheme (require (all-except (lib \"list.ss\") foldl)))"
"foldl" "foldl"
". reference to an identifier before its definition: foldl") ". . reference to an identifier before its definition: foldl")
(make-test "(module m mzscheme (require (prefix mz: mzscheme)))" "mz:+" #rx"procedure:+") (make-test "(module m mzscheme (require (prefix mz: mzscheme)))" "mz:+" #rx"procedure:+")
@ -72,7 +72,7 @@
`(module m (file ,(path->string (build-path this-dir "module-lang-test-tmp.ss"))) `(module m (file ,(path->string (build-path this-dir "module-lang-test-tmp.ss")))
x)) x))
"+" "+"
". reference to an identifier before its definition: +") ". . reference to an identifier before its definition: +")
(make-test (format "~s" '(module m mzscheme (provide lambda))) (make-test (format "~s" '(module m mzscheme (provide lambda)))
"(lambda (x) x)" "(lambda (x) x)"
@ -83,14 +83,14 @@
"1") "1")
(make-test (format "~s" '(module m mzscheme (define-syntax s (syntax 1)) (provide s))) (make-test (format "~s" '(module m mzscheme (define-syntax s (syntax 1)) (provide s)))
"s" "s"
"s: illegal use of syntax in: s") ". s: illegal use of syntax in: s")
(make-test (format "~s" '(module m mzscheme (define-syntax (x stx) #'(define a 10)) x x)) (make-test (format "~s" '(module m mzscheme (define-syntax (x stx) #'(define a 10)) x x))
"a" "a"
". reference to an identifier before its definition: a") ". . reference to an identifier before its definition: a")
(make-test (format "~s" '(module m mzscheme (define-syntax (x stx) #'(define-syntax (a stx) #'10)) x x)) (make-test (format "~s" '(module m mzscheme (define-syntax (x stx) #'(define-syntax (a stx) #'10)) x x))
"a" "a"
". reference to an identifier before its definition: a") ". . reference to an identifier before its definition: a")
(make-test (format "~s" '(module m mzscheme (define-syntax (x stx) #'(define a 10)) x x (define a 77))) (make-test (format "~s" '(module m mzscheme (define-syntax (x stx) #'(define a 10)) x x (define a 77)))
"a" "a"
"77") "77")
@ -210,7 +210,7 @@
[(regexp? (test-result test)) [(regexp? (test-result test))
(regexp-match (test-result test) after-int-output)])]) (regexp-match (test-result test) after-int-output)])])
(unless passed? (unless passed?
(printf "FAILED: ~a\n ~a\n expected: ~a\n got: ~a\n" (printf "FAILED: ~a\n ~a\n expected: ~s\n got: ~s\n"
(test-definitions test) (test-definitions test)
(or (test-interactions test) 'no-interactions) (or (test-interactions test) 'no-interactions)
(test-result test) (test-result test)

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,10 @@
. removed help-desk:help-desk from the tools interface. . removed help-desk:help-desk from the tools interface.
Use the help collection instead. Use the help collection instead.
. removed drscheme:debug:show-error-and-highlight from
the tools interface. Use drscheme:debug:error-display-handler/stacktrace
instead.
------------------------------ ------------------------------
Version 372 Version 372
------------------------------ ------------------------------