[antlr-interest] Syntactic predicates

Andy Tripp antlr at jazillian.com
Thu Aug 2 15:24:44 PDT 2007


That first left paren, right after the colon, has no matching right paren.

Pascal Julien wrote:
> Hi,
>
> I'm trying to define the following rule with a syntactic predicate:
>
> bracket[StringTemplate st]
>  : (')' TEXT)=> ')' {st.setAttribute("characters", ") ");}
>  | ')' {st.setAttribute("characters", ")");}
>  ;
>
> But when I execute the grammar, I get an ANTLR error:
> line 55:1 mismatched input ')' expecting '{'
>
> The line contains the first ')' token of the input, but the following 
> token is not a TEXT, but '{'.
>
> Any idea, what's wrong with my rule?
>
>
> Thanks in advance,
> Pascal
>



More information about the antlr-interest mailing list