[antlr-interest] Quoted String Literal - confused by greed=false behavior.
Bart Kiers
bkiers at gmail.com
Wed Jul 27 13:19:58 PDT 2011
On Wed, Jul 27, 2011 at 10:06 PM, G. Richard Bellamy <rbellamy at pteradigm.com
> wrote:
> Thanks to both of you for your help.
>
> Clearly I understated things when I said I was confused.
>
> 1. I was under the impression that greedy=true was the default, in every
> case. For instance, in "The Definitive ANTLR Reference"...
By default, * and + are greedy, _except_ when preceded by the . (DOT).
See: The Definitive ANTLR reference, Ch 4, Extended BNF Subrules, page 86.
But as Jim mentioned, this is not the issue here. The rule:
STRING : '"' ('""' | ~'"')* '"';
matches input like:
"a b "" c"
just fine (as a single STRING).
Regards,
Bart.
More information about the antlr-interest
mailing list