public abstract class Target extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
targetCharValueEscape
For pure strings of Java 16-bit Unicode char, how can we display
it in the target language as a literal.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Target(CodeGenerator gen,
String language) |
| Modifier and Type | Method and Description |
|---|---|
abstract String |
encodeIntAsCharEscape(int v)
Assume 16-bit char
|
protected void |
genFile(Grammar g,
org.stringtemplate.v4.ST outputFileST,
String fileName) |
protected void |
genListenerFile(Grammar g,
org.stringtemplate.v4.ST outputFileST) |
protected void |
genRecognizerHeaderFile(Grammar g,
org.stringtemplate.v4.ST headerFileST,
String extName) |
String |
getAltLabelContextStructName(String label) |
CodeGenerator |
getCodeGenerator() |
String |
getElementListName(String name) |
String |
getElementName(String name) |
String |
getImplicitRuleLabel(String ruleName) |
String |
getImplicitSetLabel(String id) |
String |
getImplicitTokenLabel(String tokenName) |
String |
getLanguage() |
String |
getListLabel(String label) |
String |
getLoopCounter(GrammarAST ast) |
String |
getLoopLabel(GrammarAST ast) |
String |
getRuleFunctionContextStructName(Rule r) |
String |
getRuleFunctionContextStructName(RuleFunction function)
If we know which actual function, we can provide the actual ctx type.
|
int |
getSerializedATNSegmentLimit()
Gets the maximum number of 16-bit unsigned integers that can be encoded
in a single segment of the serialized ATN.
|
abstract String |
getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator,
String literal,
boolean addQuotes)
Convert from an ANTLR string literal found in a grammar file to an
equivalent string literal in the target language.
|
String |
getTargetStringLiteralFromString(String s) |
String |
getTargetStringLiteralFromString(String s,
boolean quoted)
Given a random string of Java unicode chars, return a new string with
optionally appropriate quote characters for target language and possibly
with some escaped characters.
|
org.stringtemplate.v4.STGroup |
getTemplates() |
String |
getTokenTypeAsTargetLabel(Grammar g,
int ttype)
Get a meaningful name for a token type useful during code generation.
|
String[] |
getTokenTypesAsTargetLabels(Grammar g,
int[] ttypes) |
boolean |
grammarSymbolCausesIssueInGeneratedCode(GrammarAST idNode) |
protected org.stringtemplate.v4.STGroup |
loadTemplates() |
protected abstract boolean |
visibleGrammarSymbolCausesIssueInGeneratedCode(GrammarAST idNode) |
protected String[] targetCharValueEscape
Target subclass is free to alter the translated chars
or add more definitions. This is non-static so each target can have
a different set in memory at same time.protected Target(CodeGenerator gen, String language)
public CodeGenerator getCodeGenerator()
public String getLanguage()
public org.stringtemplate.v4.STGroup getTemplates()
protected void genListenerFile(Grammar g, org.stringtemplate.v4.ST outputFileST)
protected void genRecognizerHeaderFile(Grammar g, org.stringtemplate.v4.ST headerFileST, String extName)
public String getTokenTypeAsTargetLabel(Grammar g, int ttype)
public String getTargetStringLiteralFromString(String s, boolean quoted)
public abstract String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, String literal, boolean addQuotes)
public abstract String encodeIntAsCharEscape(int v)
public String getLoopLabel(GrammarAST ast)
public String getLoopCounter(GrammarAST ast)
public String getRuleFunctionContextStructName(RuleFunction function)
public int getSerializedATNSegmentLimit()
SerializedATN.getSegments()public boolean grammarSymbolCausesIssueInGeneratedCode(GrammarAST idNode)
protected abstract boolean visibleGrammarSymbolCausesIssueInGeneratedCode(GrammarAST idNode)
protected org.stringtemplate.v4.STGroup loadTemplates()
Copyright © 1992-2013 ANTLR. All Rights Reserved.