[antlr-interest] antlr 3 lexer question

Philippe Frankson Philippe.Frankson at Frsglobal.com
Tue Nov 16 10:35:59 PST 2010


Thank you Jim.
I knew this one but I could not manage to adapt it for my case.
But the solution that John provided me was what I needed.

Rgds
Philippe Frankson

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: 16 November 2010 16:51
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] antlr 3 lexer question

Read through this example and you should see how to do it.

http://www.antlr.org/wiki/display/ANTLR3/Lexer+grammar+for+floating+poin
t%2C
+dot%2C+range%2C+time+specs 

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Philippe Frankson
> Sent: Tuesday, November 16, 2010 2:37 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] antlr 3 lexer question
> 
> Hi,
> 
> I spent quite some time to find a solution to the following problem
but
> I could not find a suitable solution so any help would be very much
> appreciated.
> 
> When I have the following input:
> row1.subrow1.subsubrow1..row1.subrow1.subsubrow5
> I would like the lexer to return the following tokens: NAME RANGE NAME
> Where RANGE is '..', the first NAME would be 'row1.subrow1.subsubrow1'
> and the second one ' row1.subrow1.subsubrow5'.
> For info, the dot is not mandatory (we can have row1 alone, for
> example).
> Let's assume that we allow any alpha characters (apart from the dot)
->
> fragment ALPHA 	: ('a'..'z'|'A'..'Z');
> 
> Rem.: it is important to me to have a solution in the lexer side (I
> know it is possible to solve this in the parser but I would like to
> avoid it).
> 
> Thanks a lot in advance
> Philippe Frankson
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list