[plt-scheme] Reporting syntax-error to a DrScheme tool

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Feb 28 20:12:08 EST 2006

Robby Findler wrote:
> At Wed, 01 Mar 2006 01:41:07 +0100, Jens Axel Søgaard wrote:
> 
>>Robby Findler wrote:
>>
>>>Is errortrace annotating the code? 
>>
>>No? 
> 
> The error highlighting works by having the errortrace library rewrite
> the program to insert continuation marks all over the place. The
> error-display-handler (that you installed) reads out the continuation
> marks and uses them to display the error. So, I guess you'll want to
> read about errortrace. In the teaching languages, I install it in the
> eval-handler (the program must be fully expanded before calling
> errortrace). If the docs aren't clear from here, pls. ask more
> questions -- you might also look at
> plt/collects/drscheme/private/debug.ss.

Okay. I think what misled me was this note from the parser-tools/doc.txt

 > (file-path string) - sets the parameter file-path, which the lexer
    will use as the source location if it raises a read error.  This
    allows DrScheme to open the file containing the error.

and the example parser has the following

  (error (lambda (a name val start end)
               (raise-read-error
                "read-error"
                source-name
                (position-line start)
                (position-col start)
                (position-offset start)
                (- (position-offset end)
                   (position-offset start)))))

So I was thinking: "To signal an error just raise an read-error
exception".

I hadn't look at errortrace before (since the parse error is raised
before any "code" is generated).

-- 
Jens Axel Søgaard




Posted on the users mailing list.