[racket] How to keep comments when reading a file?

From: Laurent (laurent.orseau at gmail.com)
Date: Sat Jan 8 12:59:10 EST 2011

Hi Todd,

This is not really what you're looking for, but just in case it can help:

Maybe you can use both readers and make two passes on the file?
You'd need to reassemble things afterwards though.

IIRC, in the docs about documenting packages with scribble, a special reader
is used to format code with comments. Maybe this can help too.

Also, just in case, the Lazy-doc package might be of interest for parsing
It makes it easy to define moderately complex parsers (not necessarily for

Hope this helps,
P.S. : I know Lazy-doc is probably not really suited to document packages,
especially for a Scheme community, but I was young... ;)

On Sat, Jan 8, 2011 at 16:36, Todd O'Bryan <toddobryan at gmail.com> wrote:

> I'm trying to do some analysis of my student's source files. Trying to
> grade 90 assignments per week by brute force with no TAs just doesn't
> work.
> I want to pull out things like data definitions, contracts, templates,
> etc., so I can auto-grade the ones that are what I expect them to be,
> and quickly look at ones that aren't as expected to figure out how
> many points they should get.
> Unfortunately, I can't figure out how to get everything that I want.
> If I use wxme-read, all the comments and comment boxes are just gone,
> but I still have images and other stuff. If I use
> wxme-port->text-port, I can use port->string to get all the comments
> and the original code, but comment boxes get changed to have a single
> semi-colon in front of each line and things like images get converted
> to either a dot (for old-style images) or nothing (for 2htdp/image,
> although I think Robby has updated this to produce dots).
> I'm sure that I need to either modify wxme-read to convert comments to
> something that won't disappear or add something to
> wxme-port->port--probably through register-lib-mapping!--so that when
> the reader comes upon comment boxes or images it outputs something I
> can use.
> Can someone give me some direction?
> Thanks!
> Todd
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110108/c5954b7c/attachment.html>

Posted on the users mailing list.