racket/collects/macro-debugger/view/warning.ss
Ryan Culpepper 056683743d Merged changes to macro-debugger from /branches/ryanc/md5 4899:5119
updated to change in expansion of lexical variables
  many UI updates and tweaks
  improved syntax properties panel
  added expand-only and expand/hide
  added rudimentary textual stepper
  fixed PR 8395 by adding snipclass for hrule-snip
  fixed PR 8431: reductions and block splicing
  fixed PR 8433: handling unquote and macro hiding w/ errors in hidden terms

svn: r5120
2006-12-14 21:25:21 +00:00

58 lines
2.1 KiB
Scheme

(module warning mzscheme
(require (lib "class.ss")
(lib "mred.ss" "mred")
(lib "framework.ss" "framework"))
(provide warnings-frame%)
;; warnings-frame%
(define warnings-frame%
(class frame%
(super-new (label "Macro stepper warnings") (width 400) (height 300))
(define text (new text:hide-caret/selection% (auto-wrap #t)))
(define ec (new editor-canvas% (parent this) (editor text)))
(send text lock #t)
(define -nonlinearity-text #f)
(define -localactions-text #f)
(define -lifts-text #f)
(define/private (add-nonlinearity-text)
(unless -nonlinearity-text
(set! -nonlinearity-text #t)
(add-text "An opaque macro duplicated one of its subterms. "
"Macro hiding requires opaque macros to use their subterms linearly. "
"The macro stepper is showing the expansion of that macro use.")))
(define/private (add-localactions-text)
(unless -localactions-text
(set! -localactions-text #t)
(add-text "An opaque macro called local-expand, syntax-local-lift-expression, "
"etc. Macro hiding cannot currently handle local actions. "
"The macro stepper is showing the expansion of that macro use.")))
(define/private (add-lifts-text)
(unless -lifts-text
(set! -lifts-text #t)
(add-text "A transparent macro called syntax-local-lift-expression or "
"syntax-local-lift-module-end-declaration. "
"The macro stepper is only hiding macro after the "
"lifts are caught.")))
(define/public (add-text . strs)
(send text lock #f)
(for-each (lambda (s) (send text insert s)) strs)
(send text insert "\n\n")
(send text lock #t))
(define/public (add-warning tag)
(case tag
((nonlinearity)
(add-nonlinearity-text))
((localactions)
(add-localactions-text))
((lifts)
(add-lifts-text))))
(send this show #t)))
)