当前位置: 首页>>代码示例>>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;未经允许,请勿转载。