[antlr-interest] Please advice about float
denis, alexis
adenis at bristol.ca
Mon Sep 19 07:30:57 PDT 2005
Hi,
I'm no expert in grammars but I'd say a float is an (INT'.'INT) and a NUMBER
is a FLOAT or an INT.
Alexis
-----Original Message-----
From: Gevik babakhani [mailto:gevik at xs4all.nl]
Sent: Monday, September 19, 2005 9:07 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Please advice about float
Dear all,
I would like to parse integers and simple floats without exponents. Is this
the correct grammar?
class MyLexer extends Lexer;
options {
k=2;
}
NUMBER : INT ((FLOAT)?)
;
protected
FLOAT : ('.' INT)
;
protected
INT : (DIGIT)+
;
protected
DIGIT : '0'..'9'
;
WS :
(' '
| '\t'
| '\r' '\n' { newline(); }
| '\n' { newline(); }
)
{ $setType(Token.SKIP); }
;
-------------------------------------------------------------------------------------------------------------------
"Confidentiality Disclaimer: This message and the documents attached is
intended for the addressee(s) only and may contain privileged, private or
confidential information. Unauthorized review, disclosure, dissemination,
distribution, duplication or other use of this information is strictly
prohibited. If you have received this message in error, please notify the
sender immediately via telephone or return email. Please, then delete the
original email and all copies from your system, servers, backups and
archives".
------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050919/ef7b06a4/attachment.html
More information about the antlr-interest
mailing list