[antlr-interest] Syntactic predicates

Pascal Julien PascalJulien at gmx.de
Thu Aug 2 15:44:43 PDT 2007


It has (right after TEXT).
Perhaps my explanation was not clear.
The error I get is no syntax error from ANTLR, but from the executed 
code generated by ANTLR.

Andy Tripp schrieb:
> 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