[antlr-interest] % in target code

Johannes Luber jaluber at gmx.de
Wed Mar 26 14:58:30 PDT 2008


Olivier Lefevre schrieb:
> I was using % (residue operator in Java) in an action block and got:
> 
>    error(146): invalid StringTemplate % shorthand syntax: '%'
> 
> What gives?? Why does ANTLR even try to parse the code within an action 
> block? It has no business to: target is target code.
> 
> -- O.L.
> 

Not true. ANTLR has to check at least for things like $a to be able to 
replace them with the correct value. '%' and '//' are probably 
considered as comments. I believe that this behaviour should be somehow 
customizable, because it is confusing to people from other languages.

Johannes


More information about the antlr-interest mailing list