[antlr-interest] Antlr v3 -- Lexing '..' and '1.'

Loring Craymer lgcraymer at yahoo.com
Thu Jul 27 19:20:25 PDT 2006


Ter--

Not supported as of b3.  Lexer.token is single-valued; it needs to be an array to support multiple emits.  The three emits would only result in returning the last DOT.

--Loring

Terence Parr <parrt at cs.usfca.edu> wrote: 
On Jul 27, 2006, at 6:09 PM, John B. Brodie wrote:

> Greetings!
>
> I am trying to construct a lexer under Antlr v3 that will recognize a
> RANGE (e.g. '..') operator, FLOAT (e.g. 1.) numbers, and some other  
> stuff.

Hi. Nice analysis.  My intended solution was simply to allow you to  
emit more than one token per lexer rule. :)  So, when you are in  
FLOAT and see a following '.' then just emit INT DOT DOT with three  
emit() calls.  ANTLR will know you have emitted a token and will not  
auto-emit. :)

Ter



 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060727/454b806b/attachment.html


More information about the antlr-interest mailing list