[antlr-interest] Embedding templates in itself

Terence Parr parrt at cs.usfca.edu
Mon Jul 7 12:23:58 PDT 2008


ST handles nested templates very well and can do recursive, unlike  
many other tools. I'm not sure why that error is occurring, but like  
it or not somehow you are embedding a block template in itself. what  
does block template look like?
Ter
On Jul 7, 2008, at 12:59 AM, Oliver B. Fischer wrote:

> Hello,
>
> I have a tree parser to parse nested blocks like "{{}{}}". The  
> generated tree looks fine: (PROGRAM (FUNC void function (BLOCK  
> (BLOCK BLOCK)))).
>
> Unfortunately it seems to be impossible to embed templates in itself  
> as I try it:
>
> block
>  : ^(BLOCK (blo+=block)*)
>    -> block(st={$blo})
>  ;
>
> Doing this, I always get IllegalArgumentException saying "cannot  
> embed template block in itself". But who can I handle such structure  
> with StringTemplate?
>
> Best regards,
>
> Oliver
>
> -- 
> Oliver B. Fischer, Schönhauser Allee 64, 10437 Berlin
> Tel. +49 30 44793251, Mobil: +49 178 7903538
> Mail: o.b.fischer at gmx.de Blog: http://www.sw-blog.net



More information about the antlr-interest mailing list