[antlr-interest] Caveat on Using Line-Terminated Comments in ANTLR Grammar Actions

Randall R Schulz rschulz at sonic.net
Wed Jul 18 09:31:20 PDT 2007


Hi,

I just got an odd diagnostic from the Java compiler when I ran it on the 
output of a successful ANTLR invocation. The problem came from this 
line of my grammar file:

//  $t = fFF.definiteTerm(fFF.makeDetachedConstant($name.text));

ANTLR expanded $name.text with code that included newlines. Naturally, 
only the first line of the resulting code was commented, leading to a 
syntax error.


Randall Schulz


More information about the antlr-interest mailing list