[antlr-interest] How to remove this kind of warning
Edwards, Waverly
Waverly.Edwards at genesys.com
Fri Sep 5 09:01:18 PDT 2008
I don't think I understand this. Shouldn't IP address be defined as
IPFRAG '.' IPFRAG '.' IPFRAG ''.' IPFRAG
where IPFRAG is fragment constrained to a maximum 3 digit integer
You could later check to see if that value is 255 or less.
Would you look ahead to see if there were four dotted decimal integers before deciding to treat a number as a floating point or ip address?
Would that be painfully slow to check every time you came across a potential floating point number?
W.
________________________________
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: Friday, September 05, 2008 11:20 AM
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 22:15 +0800, Ronghui Yu wrote:
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
fragment
IP_Address : ;
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/8566ddff/attachment.html
More information about the antlr-interest
mailing list