Examples of STGroupString


Examples of org.stringtemplate.v4.STGroupString

  @Test public void testSimpleGroupFromString() throws Exception {
    String g =
      "a(x) ::= <<foo>>\n"+
      "b() ::= <<bar>>\n";
    STGroup group = new STGroupString(g);
    ST st = group.getInstanceOf("a");
    String expected = "foo";
    String result = st.render();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupString

  }

  @Test public void testEarlyEvalOfDefaultArgs() throws Exception {
    String templates =
      "s(x,y={<(x)>}) ::= \"<x><y>\"\n"; // should see x in def arg
    STGroup group = new STGroupString(templates);
    ST b = group.getInstanceOf("s");
    b.add("x", "a");
    String expecting = "aa";
    String result = b.render();
    assertEquals(expecting, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupString

         
         
//          System.out.println("##### TEMPLATE : " + f);
//          System.out.println(template.toString());
//          System.out.println("##### END TEMPLATE : " + f);
          STGroup group = new STGroupString("page", template.toString(), '$', '$');
          if (parent != null)
            group.importTemplates(parent);
          return group;
        } catch (Exception x) {
          log.warn("Caught", x);
        }
        return null;
View Full Code Here

Examples of org.stringtemplate.v4.STGroupString

    setFileName(fileName);
    // ensure we have the composite set to something
    if ( composite.delegateGrammarTreeRoot==null ) {
      composite.setDelegationRoot(this);
    }
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String) getOption("language"));
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupString

  public Grammar(Tool tool) {
    setTool(tool);
    builtFromString = true;
    composite = new CompositeGrammar(this);
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String)getOption("language"));
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupString

    setFileName(fileName);
    // ensure we have the composite set to something
    if ( composite.delegateGrammarTreeRoot==null ) {
      composite.setDelegationRoot(this);
    }
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String) getOption("language"));
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupString

  public Grammar(Tool tool) {
    setTool(tool);
    builtFromString = true;
    composite = new CompositeGrammar(this);
    STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate);
    lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar");
    target = CodeGenerator.loadLanguageTarget((String)getOption("language"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.