[antlr-interest] An error occurs in template example

Terence Parr parrt at cs.usfca.edu
Tue Jan 12 18:52:28 PST 2010


the error says you don't have an "init" parameter to the template. do you have one?
Ter
On Jan 12, 2010, at 6:35 PM, Chen Hongjun-R66092 wrote:

> Hi,
> 
> I am new to ANTLR, and am reading the book The Definitive ANTLR
> Reference. When I tried the template example 'template/generator/2pass'
> without any modification, and met an error as below:
> 
> Exception in thread "main" java.util.NoSuchElementException: no such
> attribute: init in template context [jasminFile]
> 	at
> org.antlr.stringtemplate.StringTemplate.checkNullAttributeAgainstFormalA
> rguments(StringTemplate.java:1311)
> 	at
> org.antlr.stringtemplate.StringTemplate.getAttribute(StringTemplate.java
> :684)
> 	at
> org.antlr.stringtemplate.language.ActionEvaluator.attribute(ActionEvalua
> tor.java:360)
> 	at
> org.antlr.stringtemplate.language.ActionEvaluator.expr(ActionEvaluator.j
> ava:136)
> 	at
> org.antlr.stringtemplate.language.ActionEvaluator.action(ActionEvaluator
> .java:84)
> 	at
> org.antlr.stringtemplate.language.ASTExpr.write(ASTExpr.java:149)
> 	at
> org.antlr.stringtemplate.StringTemplate.write(StringTemplate.java:705)
> 	at
> org.antlr.stringtemplate.StringTemplate.toString(StringTemplate.java:167
> 0)
> 	at
> org.antlr.stringtemplate.StringTemplate.toString(StringTemplate.java:166
> 1)
> 	at Test.main(Test.java:45)
> 
> I appreciate your any suggestions or ideas!
> 
> Thanks,
> Hongjun
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list