[antlr-interest] How to remove this kind of warning
Ronghui Yu
Ronghui.Yu at sierraatlantic.com
Fri Sep 5 07:15:48 PDT 2008
I would like to have it as a lexer rule, but in my parser, there is a Floating_Point_Constant like
Floating_Point_Constant:
('0'..'9')+ '.' ('0'..'9')* ('e'|'E')?;
Then when an IP appears in the stream, it is divided into serveral floating point tokens, but not a complete IP token
Then I rewrite this rule to deal with double cases
Floating_Point_Constant:
('0'..'9')+ '.'
(
(('0'..'9')+ '.' ('0'..'9')+ '.' ('0'..'9')+) => ('0'..'9')+ '.' ('0'..'9')+ '.' ('0'..'9')+ {$type=IP_Address;}
|
('0'..'9')* ('e'|'E')?;
)
;
This rule can deal with both cases well, but I need to define a token IP_Address first, then comes the story.
If I define two rules for floating point and ip address respectively, seems one of them doesn't work properly.
________________________________
From: Jim Idle [mailto:jimi at temporal-wave.com]
Sent: 2008-9-5 (星期五) 21:59
To: Ronghui Yu
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] How to remove this kind of warning
On Fri, 2008-09-05 at 17:25 +0800, Ronghui Yu wrote:
no lexer rule corresponding to token: IP_Address
Everytime when I define a token in token section, it always issues this kind of warning.
I hate warnings, is there any way to remove it?
Don't define it in the tokens section, but as a lexer rule and it will go away.
Jim
Thanks!
==============================
Regards,
Ronghui Yu
Sierra Atlantic
__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation."
________________________________________________________________________________________________________________
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation."
________________________________________________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080905/16e14f13/attachment.html
More information about the antlr-interest
mailing list