[racket] Reading racket files

From: Laurent (laurent.orseau at gmail.com)
Date: Mon Jun 11 04:08:00 EDT 2012

Hi,

Since it's not the first time I'm having a hard time with this issue (and I
know others have too), I'm going to ask for advice or for a feature request:

Reading arbitrary Racket-related files with `read' and `read-syntax'
becomes complicated when there are #lang and especially #reader lines. As
of today, I couldn't find a simple and general way to deal with that.

The #lang line can be handled properly with `read-language', but it still
eats the first non-whitespace character, thus continuing with `read' will
fail, so reading must be restarted from the beginning of the file.

The #reader "directive" is more problematic since what follows it can be
anything.

Does anyone know a way to deal with all that correctly?

If not, my feature request would be a more general `read' and `read-syntax'
that can read any Racket-based language file and turn it into a s-expr.
(It would be even better if comments could be read in something like
(struct comment ....) if an optional argument to `read' is provided!)

Thank you very much!
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120611/3119d64a/attachment.html>

Posted on the users mailing list.