[antlr-interest] Return types on lexer rules do not seem to work.

Kay Roepke kroepke at classdump.org
Wed Jul 18 10:37:22 PDT 2007


On Jul 18, 2007, at 10:29 AM, Alex Shneyderman wrote:

> They definitely used to exist (the return values) in v2, as
> I have it in the grammar I am trying to port to v3 :-)

Yeah, I meant v3.
I have had a comment in the ObjC target stating that we do not have  
lexer rule returns.
So I guess they got axed at some point in time.

> It is also inconsistent with the docs. Documentation
> (I mean the book) does not really state this limitation,
> it rather talks about how the rules are similar and differ
> only in upper case vs lower case start letter.
>
> So, I'd say it is a bug. But, I guess I will have to find a way
> to deal with this if no-can't-do is the answer.

At what points are you having return values? protected (=fragment)  
rules?
For "normal" lexer rules that produce tokens return values don't much  
sense, or
am I missing something? Where would the last return value go, as the  
lexer rules
are called from nextToken() and thus are not accessible to anyone,  
really.
Or are you calling the lexer rules directly for some reason?

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list