[antlr-interest] Strangeness when parsing strings and spaces
Kevin Jackson
foamdino at gmail.com
Mon Jan 17 23:49:49 PST 2011
Hi,
> Try something like this:
>
> QUOTED_TEXT
> : '"' ('a'..'z' | 'A'..'Z' | ' ' | ',' | '-')+ '"'
> {setText(getText().substring(0, getText().length()-1));}
> ;
Thanks, that works perfectly. I thought that there was a way to
achieve this through the lexer/tokenization process without resorting
to code fragments - I recall seeing something similar but cannot find
where I saw it in my history :(
A further question which I cannot find the answer too:
What is the difference between 'a'..'z'+ and ('a'..'z')+ ??
Thanks,
Kev
More information about the antlr-interest
mailing list