[stringtemplate-interest] antlr & stringtemplate rewrite=true

tilman walter tilman.walter at gmx.de
Mon Jul 7 02:51:21 PDT 2008


hi list,

I try to emit text through stringtemplate in a treegrammar.
when not using "rewrite=true" and defining rewrite-rules for all rules I 
get a fairly correct result.

However the output only slightly differs from the input, so I'd like to 
define just rewrite rules for the parts that differ.
Unfortunately Iturning on rewrite=true results in several warnings of 
type: 
    [java] ANTLR Parser Generator  Version 3.1b1 (May 20, 2008)  1989-2008
    [java] warning(153): MyTree.g:287:4: with rewrite=true, alt 1 not 
simple node or obvious tree element; text attribute for rule not 
guaranteed to be              correct

And by trying to run it leads to a java.lang.ClassCastException: 
org.antlr.runtime.CommonTokenStream

Anybody an idea what i am doing wrong?

Is it not possible to only define a template-rule for special parts of 
my grammar or is it restricted to simple grammar-constructs?

Thanks in advance
Tilman


More information about the stringtemplate-interest mailing list