public class CodeGenerator extends Object
Modifier and Type | Field and Description |
---|---|
Grammar |
g |
int |
lineWidth |
Target |
target |
static String |
TEMPLATE_ROOT |
org.stringtemplate.v4.STGroup |
templates |
Tool |
tool |
static String |
VOCAB_FILE_EXTENSION |
static String |
vocabFilePattern |
Constructor and Description |
---|
CodeGenerator(Grammar g) |
CodeGenerator(Tool tool,
Grammar g,
String language) |
Modifier and Type | Method and Description |
---|---|
org.stringtemplate.v4.ST |
generateBaseListener() |
org.stringtemplate.v4.ST |
generateBaseVisitor() |
org.stringtemplate.v4.ST |
generateLexer() |
org.stringtemplate.v4.ST |
generateListener() |
org.stringtemplate.v4.ST |
generateParser() |
org.stringtemplate.v4.ST |
generateVisitor() |
String |
getBaseListenerFileName()
A given grammar T, return a blank listener implementation
such as TBaseListener.java, if we're using the Java target.
|
String |
getBaseVisitorFileName()
A given grammar T, return a blank listener implementation
such as TBaseListener.java, if we're using the Java target.
|
String |
getHeaderFileName() |
String |
getListenerFileName()
A given grammar T, return the listener name such as
TListener.java, if we're using the Java target.
|
String |
getRecognizerFileName()
Generate TParser.java and TLexer.java from T.g4 if combined, else
just use T.java as output regardless of type.
|
String |
getVisitorFileName()
A given grammar T, return the visitor name such as
TVisitor.java, if we're using the Java target.
|
String |
getVocabFileName()
What is the name of the vocab file generated for this grammar?
Returns null if no .tokens file should be generated.
|
void |
loadTemplates(String language) |
void |
write(org.stringtemplate.v4.ST code,
String fileName) |
void |
writeBaseListener(org.stringtemplate.v4.ST outputFileST) |
void |
writeBaseVisitor(org.stringtemplate.v4.ST outputFileST) |
void |
writeHeaderFile() |
void |
writeListener(org.stringtemplate.v4.ST outputFileST) |
void |
writeRecognizer(org.stringtemplate.v4.ST outputFileST) |
void |
writeVisitor(org.stringtemplate.v4.ST outputFileST) |
void |
writeVocabFile() |
public static final String TEMPLATE_ROOT
public static final String VOCAB_FILE_EXTENSION
public static final String vocabFilePattern
public Target target
public org.stringtemplate.v4.STGroup templates
public int lineWidth
public void loadTemplates(String language)
public org.stringtemplate.v4.ST generateLexer()
public org.stringtemplate.v4.ST generateParser()
public org.stringtemplate.v4.ST generateListener()
public org.stringtemplate.v4.ST generateBaseListener()
public org.stringtemplate.v4.ST generateVisitor()
public org.stringtemplate.v4.ST generateBaseVisitor()
public void writeRecognizer(org.stringtemplate.v4.ST outputFileST)
public void writeListener(org.stringtemplate.v4.ST outputFileST)
public void writeBaseListener(org.stringtemplate.v4.ST outputFileST)
public void writeVisitor(org.stringtemplate.v4.ST outputFileST)
public void writeBaseVisitor(org.stringtemplate.v4.ST outputFileST)
public void writeHeaderFile()
public void writeVocabFile()
public void write(org.stringtemplate.v4.ST code, String fileName)
public String getRecognizerFileName()
public String getListenerFileName()
public String getVisitorFileName()
public String getBaseListenerFileName()
public String getBaseVisitorFileName()
public String getVocabFileName()
public String getHeaderFileName()
Copyright © 1992-2013 ANTLR. All Rights Reserved.