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

View File

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

View File

@ -424,8 +424,7 @@
stx))
;; rewrite the module to use the scheme/base version of `module'
(values v-name
#`(#,(datum->syntax #'here 'module)
name lang bodies ...)))]
#`(#,(datum->syntax #'here 'module) name lang bodies ...)))]
[else
(raise-syntax-error 'module-language
"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=
(show-error-report/tab))))
(drscheme:debug:show-error-and-highlight
msg exn
(λ (src-to-display cms) ;; =user=
(parameterize ([current-eventspace drs-eventspace])
(queue-callback
(λ () ;; =drs=
(send (send the-tab get-ints) highlight-errors src-to-display cms))))))
(drscheme:debug:error-display-handler/stacktrace
msg
exn
'())
(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
drscheme:debug:show-error-and-highlight
(-> string?
(or/c any/c exn?)
(-> (listof srcloc?) (or/c false/c (listof (list/c (is-a?/c text%) number? number?))) any)
any)
(msg exn highlight-errors)
@{The first two arguments are the same as the arguments to the error-display-handler.
This function prints the error message to the current-error-port, like the default error-display-handler
and also calls @scheme[highlight-errors] to do error highlighting. It is be passed the stack trace
for the error message.
This function should be called on the same thread/eventspace where the error happened.})
drscheme:debug:error-display-handler/stacktrace
(->* (string? any/c)
((or/c false/c (listof srcloc?)))
any)
((msg exn) ((stack #f)))
@{Displays the error message represented by the string, adding
embellishments like those that appears in the DrScheme REPL,
specifically a clickable icon for the stack trace (if the srcloc location is not empty),
and a clickable icon for the source of the error (read & syntax errors show their source
locations and otherwise the first place in the stack trace is shown).
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
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].
See also MzScheme's
MzLink{mz:p:error-display-handler}{error-display-handler}
@scheme[error-display-handler]
parameter.
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
@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.
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?)
(debug-info)
@{This function opens a DrScheme to display
@scheme[debug-info]. The first element in
the cons indicates where the file is
and the two number indicate a range of
text to show.
@scheme[debug-info]. Only the src the position
and the span fields of the srcloc are considered.
See also
@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
"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
(http-proxy "HTTP Proxy")
(proxy-direct-connection "Direct connection")

View File

@ -14,7 +14,7 @@
mzlib/etc
(lib "gui.ss" "tests" "utils")
mzlib/contract)
(provide/contract
[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>"))
(make-test "(module m mzscheme (require (all-except (lib \"list.ss\") 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:+")
@ -72,7 +72,7 @@
`(module m (file ,(path->string (build-path this-dir "module-lang-test-tmp.ss")))
x))
"+"
". reference to an identifier before its definition: +")
". . reference to an identifier before its definition: +")
(make-test (format "~s" '(module m mzscheme (provide lambda)))
"(lambda (x) x)"
@ -83,14 +83,14 @@
"1")
(make-test (format "~s" '(module m mzscheme (define-syntax s (syntax 1)) (provide 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))
"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))
"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)))
"a"
"77")
@ -210,7 +210,7 @@
[(regexp? (test-result test))
(regexp-match (test-result test) after-int-output)])])
(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)
(or (test-interactions test) 'no-interactions)
(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.
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
------------------------------