[plt-scheme] parser-tools

From: Scott Owens (Scott.Owens at cl.cam.ac.uk)
Date: Mon May 14 18:47:14 EDT 2007

There's the following note in docs:

NOTE: Since the lexer gets its source information from the port, use
port-count-lines! to enable the tracking of line and column information.
Otherwise the line and column information will return #f.


The lexer gets the line and column information directly from the  
port.  By default the port doesn't keep track of this information  
(presumably for efficiency reasons).  If you call port-count-lines!  
on the port before lexing it, then you should get the information you  
want.  See 11.2.1.1 of the MzScheme manual.

-Scott


On May 14, 2007, at 3:14 PM, Sean Gillespie wrote:

> Thanks for the reply
>
>>  "lex.ss" exports the following structures:
>>
>>> (struct position (offset line col))
>>     These structures are bound to start-pos and end-pos.
>>     Offset is the offset of the character in the input.
>>     Line in the line number of the character.
>>     Col is the offset in the current line.
>>
>>> (struct position-token (token start-pos end-pos))
>>     src-pos-lexers return these.
>>  ---------------------------------------------------------
>>
>>  So you can use position-offset, position-line, and position-col as
>>  accessors.
>
> position-line and position-col returns #f here.  Maybe I'm not using
> this right, but it doesn't seem to give me what I want.
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.