public static void twoST() { String result; STGroup group = new STGroupDir("."); ST st = group.getInstanceOf("decl"); st.add("type", "int"); st.add("name", "x"); st.add("value", 0); result = st.render(); // yields "int x = 0;" System.out.println(result); }..
public static void testSTG() { STGroup group = new STGroupFile("test.stg"); ST st = group.getInstanceOf("decl"); st.add("type", "int"); st.add("name", "x"); st.add("value", 0); String result = st.render(); // yields "int x = 0;" System.out.println(result); }
decl(type, name, value) ::= "<type> <name><init(value)>;"init(v) ::= "<if(v)> = <v><endif>"
int x = 0;
if(v) ::= "if <v>"
int x = 0;
int x if(0)= 0;
In your first decl.st, you have an <if(value)> that does not have a matching <endif> tag.
Other than that, I’m not sure what your question is.
Sam
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.