[antlr-interest] greedy question
Gavin Lambert
antlr at mirality.co.nz
Sun Mar 16 23:35:07 PDT 2008
At 11:11 17/03/2008, Pierre Attar wrote:
>Finally, I solve this problem by adding a star to the content
for
>repetition:
>string : 'string["' (options {greedy=false;} : . )* '"]' ;
>
>The remaining problem is that I always have the following
message
>1>..\resources\mff.g3pl(234,87) : warning 200 : Decision can
match
>input such as "'"]'" using multiple alternatives: 1, 2 As a
result,
>alternative(s) 1 were disabled for that input
>
>How ca I say something like "any thing but not "]" for solving
>ambiguity ?
Spell it out explicitly:
STRING : 'string["' (~('"') | '"' ~(']'))* '"]';
(Note the upper case as well. This should almost certainly be a
lexer rule, not a parser rule.)
More information about the antlr-interest
mailing list