Search in sources :

Example 26 with ST

use of edu.princeton.cs.algs4.ST in project antlr4 by antlr.

the class CppTarget method getVisitorFileName.

@Override
public String getVisitorFileName(boolean header) {
    assert gen.g.name != null;
    ST extST = getTemplates().getInstanceOf(header ? "headerFileExtension" : "codeFileExtension");
    String listenerName = gen.g.name + "Visitor";
    return listenerName + extST.render();
}
Also used : GrammarAST(org.antlr.v4.tool.ast.GrammarAST) ST(org.stringtemplate.v4.ST)

Example 27 with ST

use of edu.princeton.cs.algs4.ST in project antlr4 by antlr.

the class CppTarget method getListenerFileName.

@Override
public String getListenerFileName(boolean header) {
    assert gen.g.name != null;
    ST extST = getTemplates().getInstanceOf(header ? "headerFileExtension" : "codeFileExtension");
    String listenerName = gen.g.name + "Listener";
    return listenerName + extST.render();
}
Also used : GrammarAST(org.antlr.v4.tool.ast.GrammarAST) ST(org.stringtemplate.v4.ST)

Example 28 with ST

use of edu.princeton.cs.algs4.ST in project antlr4 by antlr.

the class CppTarget method getBaseListenerFileName.

@Override
public String getBaseListenerFileName(boolean header) {
    assert gen.g.name != null;
    ST extST = getTemplates().getInstanceOf(header ? "headerFileExtension" : "codeFileExtension");
    String listenerName = gen.g.name + "BaseListener";
    return listenerName + extST.render();
}
Also used : GrammarAST(org.antlr.v4.tool.ast.GrammarAST) ST(org.stringtemplate.v4.ST)

Example 29 with ST

use of edu.princeton.cs.algs4.ST in project antlr4 by antlr.

the class Target method getListenerFileName.

/** A given grammar T, return the listener name such as
	 *  TListener.java, if we're using the Java target.
 	 */
public String getListenerFileName(boolean header) {
    assert gen.g.name != null;
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String listenerName = gen.g.name + "Listener";
    return listenerName + extST.render();
}
Also used : GrammarAST(org.antlr.v4.tool.ast.GrammarAST) ST(org.stringtemplate.v4.ST)

Example 30 with ST

use of edu.princeton.cs.algs4.ST in project antlr4 by antlr.

the class Target method getVisitorFileName.

/** A given grammar T, return the visitor name such as
	 *  TVisitor.java, if we're using the Java target.
 	 */
public String getVisitorFileName(boolean header) {
    assert gen.g.name != null;
    ST extST = getTemplates().getInstanceOf("codeFileExtension");
    String listenerName = gen.g.name + "Visitor";
    return listenerName + extST.render();
}
Also used : GrammarAST(org.antlr.v4.tool.ast.GrammarAST) ST(org.stringtemplate.v4.ST)

Aggregations

ST (org.stringtemplate.v4.ST)197 GrammarAST (org.antlr.v4.tool.ast.GrammarAST)37 STGroup (org.stringtemplate.v4.STGroup)24 File (java.io.File)19 ArrayList (java.util.ArrayList)16 IOException (java.io.IOException)12 STGroupFile (org.stringtemplate.v4.STGroupFile)12 Path (java.nio.file.Path)10 Test (org.junit.Test)10 ATNFactory (org.antlr.v4.automata.ATNFactory)9 LexerATNFactory (org.antlr.v4.automata.LexerATNFactory)9 ParserATNFactory (org.antlr.v4.automata.ParserATNFactory)9 CodeGenerator (org.antlr.v4.codegen.CodeGenerator)9 SemanticPipeline (org.antlr.v4.semantics.SemanticPipeline)9 Grammar (org.antlr.v4.tool.Grammar)9 LexerGrammar (org.antlr.v4.tool.LexerGrammar)9 STGroupString (org.stringtemplate.v4.STGroupString)9 LinkedHashMap (java.util.LinkedHashMap)7 URL (java.net.URL)6 Map (java.util.Map)6