[antlr-interest] Handling negative numbers
Zheng, Xiaoran
xzheng at doubleclick.net
Thu Aug 17 06:32:37 PDT 2006
You can just have a lex rule like
NUM: ('+'|'-')?('0'..'9')+ ;
and in the parser, you would refer to this token as NUM.
________________________________
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Sathish K
Sent: Thursday, August 17, 2006 7:23 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Handling negative numbers
Could anyone please guide me as to how to handle negative numbers while parsing?
I am currently unable to handle the number and the sign as a whole.
Thanks,
Sat
________________________________
Yahoo! Messenger with Voice. Make PC-to-Phone Calls <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com> to the US (and 30+ countries) for 2¢/min or less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060817/03faf195/attachment.html
More information about the antlr-interest
mailing list