[antlr-interest] grammar notation (every char except...)
bace.spam at gmx.net
bace.spam at gmx.net
Fri Apr 20 14:48:14 PDT 2007
Hi all,
I am totally new to antlr, but I have some practice with other parser gernerators. I want to recognize something like
"// comment/goes^&on //" and
"## comment/goes^&on ##"
So I want to allow everything inside, except the "//" and except the "##". It is a principle to let the tokens as much as atomic as possible, isn't it. I think
TOKEN_COMMENT : "//" .* "//";
is not recommended. Better should be
TOKEN_SLASH : '/';
I could also imagine to define
TOKEN_TAG : "//";
instead of TOKEN_SLASH.
How can I specify the content (all chars allowed, except "//") in the grammar with antlr (I use 2.7.7)?
comment
: TOKEN_TAG ~("//" | "##")* TOKEN_TAG
;
and a lot of other further notations like ( . | ~"//" | ~"##" )* are not accepted. Has anyone an idea to get this problem solved?
Thank you very much and looking forward to your reply,
Markus
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
More information about the antlr-interest
mailing list