[plt-scheme] Reporting syntax-error to a DrScheme tool
Jens Axel Søgaard wrote:
> In the parser I use
>
> ; css-parser : (-> token) -> sexp
> (define css-parser
> (parser
> (src-pos)
> ; TODO: wire the error function to the language level
> (error (lambda (a name val start end)
> (raise-read-error "read-error"
> (file-path)
> (position-line start)
> (position-col start)
> (position-offset start)
> (- (position-offset end)
> (position-offset start)))))
> ...
>
> to raise an read-error.
>
> In tool.ss I have the following on-execute method:
>
> (define/public (on-execute settings run-in-user-thread)
> ; (read-case-sensitive #f)
> (run-in-user-thread
> (lambda ()
> (error-display-handler
> (drscheme:debug:make-debug-error-display-handler
> (error-display-handler)))
> (void))))
>
> When I click "Execute" on a file with syntax-error all I get is
>
> read-error
>
> in the interaction window.
>
> What piece of the puzzle is missing?
Adding
(error-print-source-location #t)
to on-execute gives
#f:10:0: read-error
so it seems I need to set (file-path ...) from the tool to tell
the lexer which file path to use in the error message.
But what should I set it to?
--
Jens Axel Søgaard