[antlr-interest] why "null" does not work (String Template)

Johannes Luber jaluber at gmx.de
Sat Aug 16 06:03:36 PDT 2008


gaochunguang schrieb:
> 
>   StringTemplate st = new
>        StringTemplate("<chars; wrap, null=\"0\">",    
>        AngleBracketTemplateLexer.class);
>   st.setAttribute("chars", "a");
>   st.setAttribute("chars", "b");
>   st.setAttribute("chars", "c");
>   st.setAttribute("chars", null);
>   st.setAttribute("chars", "e");
>   st.setAttribute("chars", "f");
>   System.out.println(st.toString());
>  
> output is abcef.
>  
> thanks!

Is your intent do define a default parameter? Then using null won't work
as it is a keyword. IIRC, the wiki for StringTemplate has a complete
list of them.

Johannes


More information about the antlr-interest mailing list