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

Harald Mueller harald_m_mueller at gmx.de
Wed Nov 21 02:36:37 PST 2007


Hi Shmuel -

Output is: foobar
:-(
(at least with my antlr-3.0.1 ... did it work for you?)

Regards
Harald

-------- Original-Nachricht --------
> Datum: Wed, 21 Nov 2007 12:30:15 +0200
> Von: shmuel siegel <antlr at shmuelhome.mine.nu>
> An: antlr-interest at antlr.org
> Betreff: Re: [antlr-interest] Fragments and setText appear to not work at all - not even with code from the book

> Harald Mueller wrote:
> >> Anyway, what you refer to is not a 
> >> bug in the sense that it was a deliberate design decision for the sake 
> >> of performance. [...] In other words, "settext" that 
> >> you do in a fragment rule is irrelevant.
> >>     
> >
> > Aha.
> > And how do you then convert an ANTLR2 grammar with ! in protected rules
> to ANTLR3?
> > And why is the example in the book, which explicitly DOES use setText()
> in a fragment??????
> >
> > Regards
> > Harald
> >
> >   
> Consider,
> 
> Tok: f=FOO b=BAR {setText(f.getText()+b.getText();};
> FOO: 'foo' {setText("123");};
> BAR:'bar' {setText("456");};
> 

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


More information about the antlr-interest mailing list