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

Alex Shneyderman a.shneyderman at gmail.com
Wed Jul 18 22:58:40 PDT 2007


> >> I run it with 3.0 final, so you guys might have fixed it ... ?
> >
> > AFAIK, lexer rules have no return values. But I might be mistaken.
> >
>
> Only tree and parser rules may include return values. The book states
> this on page 86.

True. Except the page is 98. (I have PDF version so that might explain
the difference)

Anyway, thanks everyone for clarifying. I really was not prepared for
a long discussion here. I am trying a first shot at a conversion from
v2 to v3 of a very long grammar. I have not really analyzed it much. I
was hoping an empty minded following of the instructions will work :-)
Well it is not that simple as it turns out.

So, at this point I can not justify the use of return values. Let me
work thru the grammar and see if it is really all that neccesary.
Still if you are curious the grammar is in the public domain, here is
the link: http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/antlr/groovy.g

The particular rule I am struggling with is STRING_CTOR_END, and it is
being referenced from STRING_LITERAL and a few other places.

Thanks,
Alex.


More information about the antlr-interest mailing list