Package org.antlr.stringtemplate

Examples of org.antlr.stringtemplate.StringTemplateGroup


        StringBuffer buf = compileToBuffer(junitFileName, lexerName, parserName);
        writeTestFile(".", junitFileName+".java", buf.toString());
    }

    public StringBuffer compileToBuffer(String className, String lexerName, String parserName) {
        StringTemplateGroup group = StringTemplateGroup.loadGroup("junit");
        StringBuffer buf = new StringBuffer();
        buf.append(genClassHeader(group, className, lexerName, parserName));
        buf.append(genTestRuleMethods(group));
        buf.append("\n\n}");
        return buf;
View Full Code Here


  private StringTemplateGroup getTemplateGroup() {
    StringTemplateGroupLoader loader = new CommonGroupLoader("org/antlr/gunit", null);
    StringTemplateGroup.registerGroupLoader(loader);
    StringTemplateGroup.registerDefaultLexer(AngleBracketTemplateLexer.class);
    StringTemplateGroup group = StringTemplateGroup.loadGroup("gUnitTestResult");
    return group;
  }
View Full Code Here

  StringTemplateGroup templates;
 
  @BeforeClass
  public void fetchTemplates() throws IOException{
    FileReader reader = new FileReader("StringTemplates/Tool/PRX.stg");
    templates = new StringTemplateGroup(reader);
    reader.close();
  }
View Full Code Here

  public String toSource(){
    FileReader reader;
    String output = "";
    try {
      reader = new FileReader(toolTemplate());
      StringTemplateGroup templates = new StringTemplateGroup(reader);
      StringTemplate cdfTemplate = templates.lookupTemplate("cdfFile");
      cdfTemplate.setAttribute("cls", this);
      output = cdfTemplate.toString();
    } catch (FileNotFoundException e) {
      ToolModelActivator.showError("Error generating Tool source", e);
    }
View Full Code Here

   
  }

  public void writePrxFile(String templateFileName) throws IOException, CoreException{
    FileReader reader = new FileReader(templateFileName);
    StringTemplateGroup templates = new StringTemplateGroup(reader);
    StringTemplate prxTemplate = templates.lookupTemplate("prxFile");
    prxTemplate.setAttribute("plan", this);
    String output = prxTemplate.toString();
    if (this.document != null && this.provider != null){
      this.document.set(output);
      this.provider.saveDocument(new NullProgressMonitor(), this.file, this.document, true);
View Full Code Here

    String output = "";
    try {
      URL url = Platform.getBundle(ToolPlugin.PLUGIN_ID).getEntry("StringTemplates/Tool/" + templateFileName);
      templateFile = new File(FileLocator.toFileURL(url).toURI());
      reader = new FileReader(templateFile);
      StringTemplateGroup templates = new StringTemplateGroup(reader);
      StringTemplate wexTemplate = templates.lookupTemplate(templateNam);
      for (TemplateAttribute att : attributes){
        wexTemplate.setAttribute(att.name, att.value);
      }
      output = wexTemplate.toString();
    } catch (FileNotFoundException e) {
View Full Code Here

    }
   

    public LinkViz() throws IOException {
        FileReader fr = new FileReader("DOT.stg");
        templates = new StringTemplateGroup(fr);
        fr.close();
    }
View Full Code Here

        if ( args[0].equals("-sql") ) groupFile = "SQL2.stg";
        else if ( args[0].equals("-java") ) groupFile = "persist.stg";
        else {System.err.println("java DBGen [-sql|-java]"); return;}
        // LOAD TEMPLATES
        FileReader fr = new FileReader(groupFile);
        StringTemplateGroup templates = new StringTemplateGroup(fr);
        fr.close();
        templates.registerRenderer(Class.class, new TypeRenderer());
        // GEN OUTPUT
        StringTemplate output = gen(templates, Person.class);
        System.out.println(output.toString());
    }
View Full Code Here

        CommonTree tree = (CommonTree)r.getTree();    // get tree result
        //System.out.println("tree: "+tree.toStringTree());

        // LOAD TEMPLATES (via classpath)
        FileReader fr = new FileReader("Cymbol.stg");
        StringTemplateGroup templates = new StringTemplateGroup(fr);
        fr.close();
        //  CREATE TREE NODE STREAM FOR TREE PARSERS
        CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
        nodes.setTokenStream(tokens);        // where to find tokens
        Gen gen = new Gen(nodes);
View Full Code Here

        System.out.println(schemaST.toString());
    }
   
    public GenSchema() throws IOException {
        FileReader fr = new FileReader("SQL.stg");
        templates = new StringTemplateGroup(fr);
        fr.close();
    }
View Full Code Here

TOP

Related Classes of org.antlr.stringtemplate.StringTemplateGroup

Copyright © 2018 www.massapicom. 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.