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

Method test1

output/java8/1.4.17/STViz.java:462–491  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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