當前位置: 首頁>>代碼示例>>Java>>正文


Java ST.inspect方法代碼示例

本文整理匯總了Java中org.stringtemplate.v4.ST.inspect方法的典型用法代碼示例。如果您正苦於以下問題:Java ST.inspect方法的具體用法?Java ST.inspect怎麽用?Java ST.inspect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.stringtemplate.v4.ST的用法示例。


在下文中一共展示了ST.inspect方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test2

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test2() throws IOException
{ // test rig
    String templates = "t1(q1=\"Some\\nText\") ::= <<\n"+
                       "<q1>\n" +">>\n"+"\n"+"t2(p1) ::= <<\n"+
                       "<p1>\n"+
                       ">>\n"+
                       "\n"+
                       "main() ::= <<\n" +"START-<t1()>-END\n"+"\n"+"START-<t2(p1=\"Some\\nText\")>-END\n"+">>\n";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("main");
    STViz viz = st.inspect();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:15,代碼來源:STViz.java

示例2: test2

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test2() throws IOException
{ // test rig
    String templates = "t1(q1=\"Some\\nText\") ::= <<\n"+"<q1>\n"+">>\n"+"\n"+"t2(p1) ::= <<\n"+"<p1>\n"+">>\n"+"\n"+"main() ::= <<\n"+"START-<t1()>-END\n"+"\n"+"START-<t2(p1=\"Some\\nText\")>-END\n"+">>\n";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("main");
    STViz viz = st.inspect();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:10,代碼來源:STViz.java

示例3: test1

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test1() throws IOException
{ // test rig
    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";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("method");
    st.impl.dump();
    st.add("type", "float");
    st.add("name", "foo");
    st.add("locals", 3);
    st.add("args", new String[] {"x",
                                 "y",
                                 "z"});
    ST s1 = group.getInstanceOf("assign");
    ST paren = group.getInstanceOf("paren");
    paren.add("x", "x");
    s1.add("a", paren);
    s1.add("b", "y");
    ST s2 = group.getInstanceOf("assign");
    s2.add("a", "y");
    s2.add("b", "z");
    ST s3 = group.getInstanceOf("return");
    s3.add("x", "3.14159");
    st.add("stats", s1);
    st.add("stats", s2);
    st.add("stats", s3);
    STViz viz = st.inspect();
    System.out.println(st.render()); // should not mess up ST event lists
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:31,代碼來源:STViz.java

示例4: test3

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test3() throws IOException
{
    String templates = "main() ::= <<\n"+"Foo: <{bar};format=\"lower\">\n"+">>\n";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("main");
    st.inspect();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:10,代碼來源:STViz.java

示例5: test3

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test3() throws IOException
{
    String templates = "main() ::= <<\n"+
                       "Foo: <{bar};format=\"lower\">\n" +">>\n";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("main");
    st.inspect();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:11,代碼來源:STViz.java

示例6: test2

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test2() throws IOException
{ // test rig
    String templates = "t1(q1=\"Some\\nText\") ::= <<\n"+"<q1>\n"+">>\n"+"\n"+"t2(p1) ::= <<\n"+
                       "<p1>\n"+
                       ">>\n"+
                       "\n" +"main() ::= <<\n"+"START-<t1()>-END\n"+"\n"+"START-<t2(p1=\"Some\\nText\")>-END\n"+">>\n";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("main");
    STViz viz = st.inspect();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:13,代碼來源:STViz.java

示例7: test1

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test1() throws IOException { // test rig
      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";

      String tmpdir = System.getProperty("java.io.tmpdir");
      writeFile(tmpdir, "t.stg", templates);
      STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
      ST st = group.getInstanceOf("method");
      st.impl.dump();
      st.add("type", "float");
      st.add("name", "foo");
      st.add("locals", 3);
      st.add("args", new String[] {"x", "y", "z"});
      ST s1 = group.getInstanceOf("assign");
      ST paren = group.getInstanceOf("paren");
      paren.add("x", "x");
      s1.add("a", paren);
      s1.add("b", "y");
      ST s2 = group.getInstanceOf("assign");
      s2.add("a", "y");
      s2.add("b", "z");
      ST s3 = group.getInstanceOf("return");
      s3.add("x", "3.14159");
      st.add("stats", s1);
      st.add("stats", s2);
      st.add("stats", s3);

STViz viz = st.inspect();
System.out.println(st.render()); // should not mess up ST event lists
  }
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:39,代碼來源:STViz.java

示例8: test2

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test2() throws IOException
{ // test rig
    String templates = "t1(q1=\"Some\\nText\") ::= <<\n"+
                       "<q1>\n" +">>\n"+"\n"+"t2(p1) ::= <<\n" +
                       "<p1>\n"+
                       ">>\n"+
                       "\n"+
                       "main() ::= <<\n" +"START-<t1()>-END\n"+"\n"+"START-<t2(p1=\"Some\\nText\")>-END\n"+">>\n";
    String tmpdir = System.getProperty("java.io.tmpdir");
    writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("main");
    STViz viz = st.inspect();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:15,代碼來源:STViz.java

示例9: test4

import org.stringtemplate.v4.ST; //導入方法依賴的package包/類
public static void test4() throws IOException
{
    String templates = "main(t) ::= <<\n"+"hi: <t>\n"+">>\n"+"foo(x,y={hi}) ::= \"<bar(x,y)>\"\n"+"bar(x,y) ::= << <y> >>\n"+"ignore(m) ::= \"<m>\"\n";
    STGroup group = new STGroupString(templates);
    ST st = group.getInstanceOf("main");
    ST foo = group.getInstanceOf("foo");
    st.add("t", foo);
    ST ignore = group.getInstanceOf("ignore");
    ignore.add("m", foo); // embed foo twice!
    st.inspect();
    st.render();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:13,代碼來源:STViz.java


注:本文中的org.stringtemplate.v4.ST.inspect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。