[antlr-interest] predicate and ambiguity
    Lloyd Dupont 
    ld at galador.net
       
    Sun Jul  8 16:31:07 PDT 2007
    
    
  
> =============
> unary : (PLUS|MINUS)? cast ;
>
> cast : {isType(input.LT(2))}? (LPAREN ID RPAREN) cast
>  | primary
>  ;
> =============
>
ok thanks!
I have one more question about predicate.
Yesterday I did write something like that  (MyFunction(input.LT(2).Text)), 
validating the text of the token.
But what if I should not validate a Token but a rule, as in:
parserrule:
    { Function(otherparserrule) }?  TOK1 otherparserrule TOK2
    | alternative
    ;
what if I have a rule like that. How could I write that?
I bet I cannot write input.LT(2) because I'm reading a parser rule and not a 
simple token..
Any tips?
Thanks for the help so far! :-) 
    
    
More information about the antlr-interest
mailing list