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

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Mon Jan 10 13:51:56 EST 2011

Thanks for the pointer. I had hoped to avoid making two passes with
different readers.

Can anyone give me a hint? It looks like the pieces are there, but
there are no examples in the documentation that explain how to get at
the pieces I need and how to plug them in.

Todd

On Sat, Jan 8, 2011 at 5:59 PM, Laurent <laurent.orseau at gmail.com> wrote:
> 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
> files:
> http://planet.plt-scheme.org/display.ss?package=lazy-doc.plt&owner=orseau
> It makes it easy to define moderately complex parsers (not necessarily for
> scribble).
>
> Hope this helps,
> Laurent
> 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
>
>


Posted on the users mailing list.