[antlr-interest] Error in CodeGenTreeWalker

Jose San Leandro jose.sanleandro at ventura24.es
Thu Dec 14 12:01:51 PST 2006


Hi,

I'm working on a grammar which filters an input with lexical filters and 
modifies some stuff.

I've declared a lexer rule like this:

fragment
ANYTHING_BUT_BRACKET
    :   c=~('{'|'}')   {append((char) c);}
   ;

When executing ANTLR, it fails with the following message:

error(100): AntLangInner.g:0:0: syntax error: codegen: <AST>:0:0: unexpected 
end of subtree
error(10):  internal error: AntLangInner.g : java.lang.ClassCastException
org.antlr.codegen.CodeGenTreeWalker.alternative(CodeGenTreeWalker.java:1135)
org.antlr.codegen.CodeGenTreeWalker.block(CodeGenTreeWalker.java:1000)
org.antlr.codegen.CodeGenTreeWalker.ebnf(CodeGenTreeWalker.java:2397)
org.antlr.codegen.CodeGenTreeWalker.element(CodeGenTreeWalker.java:1856)

I don't know if that is expected or not. What the rule tries to do is to match 
and leave untouched anything but opening or closing brackets. Is there a 
better way to do it?

Thank you in advance,
Jose.


More information about the antlr-interest mailing list