[antlr-interest] Fragments and setText appear to not work at all - not even with code from the book

Jim Idle jimi at temporal-wave.com
Wed Nov 21 14:23:22 PST 2007


This has been discussed lots of times. Look through the archives before making pronouncements ;-).

You can do everything you need to with ANTLR3, it is just different because Ter fixed the performance overhead of copying the text from the input stream to the token on every token, when you many times did not need it. Your thoughts about performance penalties are not correct because in ANTLR3, you only incur such penalties when you actually need to.

You will mostly need to get your code to work with emit and perhaps think slightly differently about your lexer rules is all. It's different, but you will get the hang of it, I am sure.

Jim


> -----Original Message-----
> From: Harald Mueller [mailto:harald_m_mueller at gmx.de]
> Sent: Wednesday, November 21, 2007 1:53 PM
> To: Austin_Hastings at Yahoo.com
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Fragments and setText appear to not work at
> all - not even with code from the book
> 
> > I think the underlying source of your angst is the fact that setText()
> > works against a non-scoped (effectively: global) object.
> 
> It's not so much "angst" or something like that - it's the fact that ANTLR
> 2 has a well-defined and fully working feature for doing this; and that
> ANTLR 3 promises (even if only through an example in "the book") the same
> (and, implicitly, even more); and that I have non-trivial grammars using
> the ANTLR 2 feature - so I expect ANTLR 3 to provide the same.
> 
> Terrence should simply make this work (and for those you fear performance
> penalities: Simply declaring a local name for the fragment token will
> create a new object anyway - having the changed text assembled in it does
> not cost anything [if done through a suitable lazy-write obejct]).
> 
> I'm waiting for a design+bug fix on this ...
> 
> Regards & thx for the support
> Harald
> 
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger




More information about the antlr-interest mailing list