[antlr-interest] Lexer not as smart as it should be?

Nigel Sheridan-Smith nbsherid at secsme.org.au
Thu Oct 20 17:17:42 PDT 2005


-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jon Schewe
Sent: Friday, 21 October 2005 9:03 AM
To: ANTLR Interest
Subject: [antlr-interest] Lexer not as smart as it should be?

 

I'm trying to handle IP addresses in my lexer.  Below are the important
rules.





Have a browse of this thread from June regarding IPv4/IPv6 addresses and MAC
addresses:

 

http://www.antlr.org/pipermail/antlr-interest/2005-June/012655.html

 

You probably need to increase k>=4 in the lexer, if you are defining one
rule as three digits followed by a dot. This is required to distinguish
between integers and IP addresses. If you then add floats you will have a
problem, so you probably need syntactic or semantic predicates for
disambiguation, or one big "anything goes" token that combines the lot.  

 

Mark and I had some good ideas for a suitable grammer, so check out the URL.

 

Nigel

--
Nigel Sheridan-Smith
PhD research student

Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20051021/ec0e103c/attachment-0001.html


More information about the antlr-interest mailing list