[antlr-interest] ANTLR V3 Comments parsing (and retaining them)

Ben Corne ben.corne at gmail.com
Sun Feb 27 14:14:56 PST 2011


I want to create a documentation tool for some language, this involves
introducing new syntax which can be ignored by the normal parser, but is
taken into account when feeding a program to the documenter-parser.

Here's where I started off with: (the language itself is added after I get
the comments right)
http://pastebin.com/q9L8sKcP

ANTLR complains with warnings about line 29, 30 and 39.
Any explanation why it warns me?
line 29 & 30 boil down to this:
//@<anything until a newline>
or
//<anything until a newline>

I don't see what is wrong with it. Note however that when removing the
multiline comments, it does build:
http://pastebin.com/W47wn70k
however still with warnings (stating that documentation can match COMMENT
(for which I see no problem: // some text //more commented text)

When I remove the documentation rule part, "life is peachy" (cfr javadude's
tutorial)

Any clues what goes wrong? I guess I should get rid of the warnings in the
annotation part before adding multiline comment/annotation


More information about the antlr-interest mailing list