MCPcopy Index your code
hub / github.com/antlr/codebuff / test1

Method test1

output/java8/1.4.14/STViz.java:458–487  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

456 }
457
458 public static void test1() throws IOException
459 { // test rig
460 String templates = "method(type,name,locals,args,stats) ::= <<\n"+"public <type> <name>(<args:{a| int <a>}; separator=\", \">) {\n"+" <if(locals)>int locals[<locals>];<endif>\n"+" <stats;separator=\"\\n\">\n"+"}\n"+">>\n"+"assign(a,b) ::= \"<a> = <b>;\"\n"+"return(x) ::= <<return <x>;>>\n"+"paren(x) ::= \"(<x>)\"\n";
461 String tmpdir = System.getProperty("java.io.tmpdir");
462 writeFile(tmpdir, "t.stg", templates);
463 STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
464 ST st = group.getInstanceOf("method");
465 st.impl.dump();
466 st.add("type", "float");
467 st.add("name", "foo");
468 st.add("locals", 3);
469 st.add("args", new String[] {"x",
470 "y",
471 "z"});
472 ST s1 = group.getInstanceOf("assign");
473 ST paren = group.getInstanceOf("paren");
474 paren.add("x", "x");
475 s1.add("a", paren);
476 s1.add("b", "y");
477 ST s2 = group.getInstanceOf("assign");
478 s2.add("a", "y");
479 s2.add("b", "z");
480 ST s3 = group.getInstanceOf("return");
481 s3.add("x", "3.14159");
482 st.add("stats", s1);
483 st.add("stats", s2);
484 st.add("stats", s3);
485 STViz viz = st.inspect();
486 System.out.println(st.render()); // should not mess up ST event lists
487 }
488
489 public static void test2() throws IOException
490 { // test rig

Callers 1

mainMethod · 0.95

Calls 7

writeFileMethod · 0.95
addMethod · 0.95
inspectMethod · 0.95
renderMethod · 0.95
getPropertyMethod · 0.65
getInstanceOfMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected