[antlr-interest] greedy question

Pierre Attar pat at tireme.fr
Sun Mar 16 15:11:56 PDT 2008


Hi,

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 ?

Thanks, Pierre



Pierre Attar a écrit :
> Hi,
>
> I have some problems understanding lexer recognition.  Here is my need.
>
> Using the following string of characters, (string["using 
> ""quotes"""]), I want to extract the content : (using ""quotes"").
> I wrote the following rule;
>
> string : 'string["' (options {greedy=false;} : . ) '"]' ;
>
>
> This works for (string["essai"]) but does not works in my sample 
> (string["using ""quotes"""]) and I have a MismachedSetException.
>
> I try many different configurations but do not figure out how to solve 
> the string containing quotes.
> Is is possible to use the greedy feature in this case or should I 
> explore an other antlr recognition feature ?
>
> Any idea are welcome, Pierre
>
>>
>
>
>




More information about the antlr-interest mailing list