[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specialized input parsing for code/REPL in DrScheme?



Apologies, this was indeed a bug in the tool that I sent you (I 
didn't read my own interfaces carefully enough!). The attached 
good-unit.ss should solve the problems you were having. It works in 
both debug and non-debug modes (and the teaching languages as well).

Hope that helps,
Robby

At 8:50 AM -0400 9/6/00, Paul Fernhout wrote:
>All-
>
>Robby just pointed out that I should be running MrEd without debugging
>to use this feature.  I changed the language/debug setting to "Graphical
>without Debugging", reloaded, and now both good-unit and bad-unit
>examples work.
>
>-Paul Fernhout
>Kurtz-Fernhout Software
>=========================================================
>Developers of custom software and educational simulations
>Creators of the Garden with Insight(TM) garden simulator
>http://www.kurtz-fernhout.com
>
>Paul Fernhout wrote:
>>  I tried the good unit you sent earlier as a tool under the just released
>>  103 (by creating under c:/plt/collects/drscheme/tools" an "indentation"
>>  directory with a "unit.ss" file  in it from renaming "good-unit.ss"). I
>>  got this error message when I tried to execute any code:
(unit/sig ()
    (import mred^
            mzlib:core^
            framework^
            [print-convert : mzlib:print-convert^]
            [drscheme : drscheme:export^]
            [zodiac : zodiac:system^])

    (define (my-reader port)
      (message-box "my reader!" "my reader!")
      (read port))

    (drscheme:get/extend:extend-interactions-text
     (lambda (%)
       (class % args
         (inherit run-in-evaluation-thread)
         (rename [super-reset-console reset-console])
         (override
           [reset-console
	  (lambda ()
              (super-reset-console)
              (run-in-evaluation-thread
               (lambda ()
                 (drscheme:basis:raw-reader my-reader)

                 ;; this just sets all source locations to 0,0
                 ;; so the debugging information is all useless
                 ;; it would be better to develop a reader that
                 ;; returns the zodiac structures directly,
                 ;; instead of using zodiac:structurize-syntax
                 (drscheme:basis:zodiac-reader
                  (opt-lambda ([port/thunk (current-input-port)]
                               [loc (zodiac:make-zodiac 1 1 #f)]
                               [script? #t]
                               [first-column 1])
                    ;; we ignore the script? field for now
                    (lambda ()
                      (let ([ans
                             (my-reader
                              (if (port? port/thunk)
                                  port/thunk
                                  (make-input-port
                                   (lambda ()
                                     (let ([ans (port/thunk)])
                                       (cond
                                         [(char? ans) ans]
                                         [(eof-object? ans) eof]
                                         [else #\.])))
                                   (lambda () #t)
                                   void)))])
                        (if (eof-object? ans)
                            (zodiac:make-eof loc)
                            (zodiac:structurize-syntax
                             ans
                             (zodiac:make-zodiac (zodiac:make-origin 
'source 'source)
                                                 loc loc))))))))))])
         (sequence (apply super-init args))))))