[antlr-interest] compilation error on grammar
kroepke at classdump.org
Thu Aug 2 17:01:26 PDT 2007
On Aug 3, 2007, at 1:52 AM, Warner Onstine wrote:
>>> on the package(); call Eclipse (and a normal build) is telling me
>>> that: illegal start of an expression
>>> <identifier>(or this) expected
>>> '(' expected
>> I advise against using line comments in the actions of ANTLR
>> All the lines of an action are passed through, without regard to
>> whether they happen to be partially or fully commented. The problem
>> comes from the fact that ANTLR (the target language-specific string
>> templates, I guess) sometimes expand portions of the actions with
>> content that includes a newline, thus prematurely terminating the
>> Instead, use only /* explicitly bounded */ comments inside actions.
> Ok, how do I turn this off? I'm not doing any comments in the Model.g
> file itself, all of the comments that show up in Java are generated by
> antlr. (If that's the problem you're referring to).
You can't turn it off, and it is not causing your problem. The
just annotations and are comments after all.
You do have a rule called 'package', right?
I guess that Java doesn't like that as a method name (which ANTLR
parser rule names into). I suggest renaming that rule.
Please provide the complete error message in your posts (or at least
the line number
reported). It took me a while of hard staring to sort through the
wrapped source code
to actually figure out why this code would be invalid or where the
error was supposed
More information about the antlr-interest