[plt-scheme] Reading s-expression... syntaxes?

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Wed Jan 4 18:05:00 EST 2006

Matt-

Have you tried the port-count-lines! procedure?

-Felix

On Jan 4, 2006, at 5:59 PM, Matt Jadud wrote:

> Say I have s-expression-based Language X. I want to read it into  
> PLT Scheme, with source information intact, and use the matcher to  
> pull it apart. That is, I want to take the syntax, convert it into  
> structures (with source information from the read), and somewhere  
> in my tool be able to say "Error on line X, column Y" or similar.
>
> To explore this, I created a file "foo" containing
>
> (define x (+ 3 5))
>
> I then tried
>
> > (define ip (open-input-file "foo"))
> > (read-syntax (object-name ip) ip)
>
> which yielded the nifty syntax infomercial, but the fields for  
> "line" and "column" are both #f.
>
> I've been reading through the Help Desk regarding read-syntax,  
> honus, and some other exciting things I hadn't delved into before,  
> but... does anyone have a pointer to get me reading in the right  
> direction? I'm missing something (obvious?) here. How do I read s- 
> expressions in from a file with syntax location info intact? Do I  
> need to implement my own reader?
>
> Thanks,
> Matt
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.