[antlr-interest] C# generated code refering rules
Micheal J
open.zone at virgin.net
Thu Jul 5 10:38:59 PDT 2007
Hi,
Please try to choose more relevant, descriptive subjects for your post. For
instance, "ANTLR generates cryptic names such as T1...T9 for rules" is
better than what you have.
As for the problem, this simply indicates you are using a combined grammar
and ANTLR is automatically generating a lexer for you and generating names
for your (unnamed) tokens. To ensure the token names are meaningful, either
create your own lexer (in a separate file) or name you tokens.
E.g. Rather than:
class : 'class' ID ...
Do:
tokens
{
KW_CLASS = 'class';
}
class : KW_CLASS ID ...
Micheal
-----------------------
The best way to contact me is via the list/forum. My time is very limited.
-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Liviu U
Sent: 05 July 2007 10:35
To: antlr-interest at antlr.org
Subject: [antlr-interest] C# generated code refering rules
Hi guys,
ANTLR generates cryptic names for rules (TokenTypes). T1...T9.
when I check the TreeNode token type it is an integer and I would have like
to compare it against constant FORLOOP than against T23.
Do i miss something here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070705/2a672e65/attachment.html
More information about the antlr-interest
mailing list