[antlr-interest] token position defined by lexer

shmuel siegel antlr at shmuelhome.mine.nu
Tue Jun 13 04:37:30 PDT 2006


Michiel Vermandel wrote:
>
> Hi,
>
> In my lexer I have the following rule:
>
> QUOTED_STRING
>     :
>       '\''! ( WS | "\'\'" | ~('\'') )* '\''!
>     ;
>
> So the lexer does not return the quotes, just the string text.
>
> I do get the AST tree without the quotes but the column position of 
> the string is a bit strange, I think.
>
> If I have the following text:
>
> Hello 'world'
>
> then I get the lexer token world at column 7 instead of 8.
> So the quote gets removed but the column position of the token is not 
> shifted by 1.
>
> Is there some way to work around this?
>
> Thanks 
I question if you really want that. The quote is part of the matched 
token and hence the token really does start at column 7.


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.3/361 - Release Date: 6/11/2006



More information about the antlr-interest mailing list