[antlr-interest] Syntactic predicates

Pascal Julien PascalJulien at gmx.de
Thu Aug 2 14:43:35 PDT 2007


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