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

shmuel siegel antlr at shmuelhome.mine.nu
Wed Nov 21 02:30:15 PST 2007


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");};




More information about the antlr-interest mailing list