Package org.stringtemplate.v4

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


  }

  @Override
  public void warning(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


      g.tool.errMgr.grammarError(ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText());
      return epsilon(ID);
    }

    cmdST.add("arg", arg.getText());
    return action(cmdST.render());
  }

  @Override
  public Handle lexerCommand(GrammarAST ID) {
    LexerAction lexerAction = createLexerAction(ID, null);
View Full Code Here

    if (cmdST.impl.formalArguments != null && cmdST.impl.formalArguments.containsKey("arg")) {
      g.tool.errMgr.grammarError(ErrorType.MISSING_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText());
      return epsilon(ID);
    }

    return action(cmdST.render());
  }

  @Override
  public Handle range(GrammarAST a, GrammarAST b) {
    ATNState left = newState(a);
View Full Code Here

   *  just use T.java as output regardless of type.
   */
  public String getRecognizerFileName() {
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String recognizerName = g.getRecognizerName();
    return recognizerName+extST.render();
  }

  /** A given grammar T, return the listener name such as
   *  TListener.java, if we're using the Java target.
    */
 
View Full Code Here

    */
  public String getListenerFileName() {
    assert g.name != null;
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String listenerName = g.name + "Listener";
    return listenerName+extST.render();
  }

  /** A given grammar T, return the visitor name such as
   *  TVisitor.java, if we're using the Java target.
    */
 
View Full Code Here

    */
  public String getVisitorFileName() {
    assert g.name != null;
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String listenerName = g.name + "Visitor";
    return listenerName+extST.render();
  }

  /** A given grammar T, return a blank listener implementation
   *  such as TBaseListener.java, if we're using the Java target.
    */
 
View Full Code Here

    */
  public String getBaseListenerFileName() {
    assert g.name != null;
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String listenerName = g.name + "BaseListener";
    return listenerName+extST.render();
  }

  /** A given grammar T, return a blank listener implementation
   *  such as TBaseListener.java, if we're using the Java target.
    */
 
View Full Code Here

    */
  public String getBaseVisitorFileName() {
    assert g.name != null;
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String listenerName = g.name + "BaseVisitor";
    return listenerName+extST.render();
  }

  /** What is the name of the vocab file generated for this grammar?
   *  Returns null if no .tokens file should be generated.
   */
 
View Full Code Here

  public String getHeaderFileName() {
    ST extST = getTemplates().getInstanceOf("headerFileExtension");
    if ( extST==null ) return null;
    String recognizerName = g.getRecognizerName();
    return recognizerName+extST.render();
  }

}
View Full Code Here

        for (int i = 0; i < pairs.length; i+=2) {
            String action = pairs[i];
            String expected = pairs[i+1];
            ST st = new ST(template);
            st.add(location, action);
            String grammar = st.render();
            testErrors(new String[] {grammar, expected}, false);
        }
    }
}
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.