Package org.stringtemplate.v4

Examples of org.stringtemplate.v4.ST.render()


      createTab_stmt.add(SORT_BUCKET, tbl_sort_bucket);
      createTab_stmt.add(ROW_FORMAT, tbl_row_format);
      createTab_stmt.add(TBL_LOCATION, tbl_location);
      createTab_stmt.add(TBL_PROPERTIES, tbl_properties);

      outStream.writeBytes(createTab_stmt.render());
      ((FSDataOutputStream) outStream).close();
      outStream = null;
    } catch (FileNotFoundException e) {
      LOG.info("show create table: " + stringifyException(e));
      return 1;
View Full Code Here


      dot.add("startState",
          Utils.integer(startState.stateNumber));
      walkRuleNFACreatingDOT(dot, startState);
        }
    dot.add("rankdir", rankdir);
        return dot.render();
    }

    /** Return a String containing a DOT description that, when displayed,
     *  will show the incoming state machine visually.  All nodes reachable
     *  from startState will be included.
View Full Code Here

    for (int i = 0; i < delegateNames.size(); i++) {
      String dname = delegateNames.get(i);
      matchTokenRuleST.add("rules", dname+".Tokens");
    }
    //System.out.println("tokens rule: "+matchTokenRuleST.toString());
    GrammarAST r = parseArtificialRule(matchTokenRuleST.render());
    addRule(grammarAST, r);
    //addRule((GrammarAST)parser.getAST());
    //return (GrammarAST)parser.getAST();
    return r;
  }
View Full Code Here

        if (grammar.type == Grammar.COMBINED) {
            // add autogenerated lexer; e.g., TLexer.java TLexer.h TLexer.tokens
            // don't add T__.g (just a temp file)
           
            String suffix = Grammar.grammarTypeToFileNameSuffix[Grammar.LEXER];
            String lexer = grammar.name + suffix + extST.render();
            files.add(new File(outputDir, lexer));

            // TLexer.h
            if (headerExtST != null) {
                String header = grammar.name + suffix + headerExtST.render();
View Full Code Here

        // handle generated files for imported grammars
        List<Grammar> imports =
                grammar.composite.getDelegates(grammar.composite.getRootGrammar());
        for (Grammar g : imports) {
            outputDir = tool.getOutputDirectory(g.getFileName());
            String fname = groomQualifiedFileName(outputDir.toString(), g.getRecognizerName() + extST.render());
            files.add(new File(fname));
        }

        if (files.isEmpty()) {
            return null;
View Full Code Here

    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    ST recogST = generator.genRecognizer();
    String code = recogST.render();
    assertTrue("not expecting label", code.indexOf("x=b();")<0);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
  }
View Full Code Here

      "        System.out.println(tokens);\n" +
      "    }\n" +
      "}"
      );
    outputFileST.add("lexerName", lexerName);
    writeFile(tmpdir, "Test.java", outputFileST.render());
  }

  protected void writeTreeTestFile(String parserName,
                   String treeParserName,
                   String lexerName,
View Full Code Here

    }

  public void panic(ErrorType errorType, Object... args) {
    ToolMessage msg = new ToolMessage(errorType, args);
    ST msgST = getMessageTemplate(msg);
    String outputMsg = msgST.render();
    if ( formatWantsSingleLineMessage() ) {
      outputMsg = outputMsg.replace('\n', ' ');
    }
    panic(outputMsg);
  }
View Full Code Here

    }

    StringBuilder buf = new StringBuilder();
    for (ANTLRMessage m : all) {
      ST st = tool.errMgr.getMessageTemplate(m);
      buf.append(st.render());
      buf.append("\n");
    }

    return buf.toString();
  }
View Full Code Here

  }

  @Override
  public void error(ANTLRMessage msg) {
    ST msgST = tool.errMgr.getMessageTemplate(msg);
    String outputMsg = msgST.render();
    if (tool.errMgr.formatWantsSingleLineMessage()) {
      outputMsg = outputMsg.replace('\n', ' ');
    }
    System.err.println(outputMsg);
  }
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.