public class CTarget extends Target
targetCharValueEscape
Constructor and Description |
---|
CTarget() |
Modifier and Type | Method and Description |
---|---|
protected org.stringtemplate.v4.ST |
chooseWhereCyclicDFAsGo(Tool tool,
CodeGenerator generator,
Grammar grammar,
org.stringtemplate.v4.ST recognizerST,
org.stringtemplate.v4.ST cyclicDFAST) |
protected void |
genRecognizerFile(Tool tool,
CodeGenerator generator,
Grammar grammar,
org.stringtemplate.v4.ST outputFileST) |
protected void |
genRecognizerHeaderFile(Tool tool,
CodeGenerator generator,
Grammar grammar,
org.stringtemplate.v4.ST headerFileST,
String extName) |
String |
getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator,
String literal)
Convert from an ANTLR char literal found in a grammar file to
an equivalent char literal in the target language.
|
String |
getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator,
String literal)
Convert from an ANTLR string literal found in a grammar file to
an equivalent string literal in the C target.
|
boolean |
isValidActionScope(int grammarType,
String scope)
Is scope in @scope::name {action} valid for this kind of grammar?
Targets like C++ may want to allow new scopes like headerfile or
some such.
|
protected void |
performGrammarAnalysis(CodeGenerator generator,
Grammar grammar)
Overrides the standard grammar analysis so we can prepare the analyser
a little differently from the other targets.
|
encodeIntAsCharEscape, getMaxCharValue, getTarget64BitStringFromValue, getTargetStringLiteralFromString, getTargetStringLiteralFromString, getTokenTypeAsTargetLabel, postProcessAction, useBaseTemplatesForSynPredFragments
protected void genRecognizerFile(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST outputFileST) throws IOException
genRecognizerFile
in class Target
IOException
protected void genRecognizerHeaderFile(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST headerFileST, String extName) throws IOException
genRecognizerHeaderFile
in class Target
IOException
protected org.stringtemplate.v4.ST chooseWhereCyclicDFAsGo(Tool tool, CodeGenerator generator, Grammar grammar, org.stringtemplate.v4.ST recognizerST, org.stringtemplate.v4.ST cyclicDFAST)
public boolean isValidActionScope(int grammarType, String scope)
isValidActionScope
in class Target
public String getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, String literal)
Target
getTargetCharLiteralFromANTLRCharLiteral
in class Target
public String getTargetStringLiteralFromANTLRStringLiteral(CodeGenerator generator, String literal)
getTargetStringLiteralFromANTLRStringLiteral
in class Target
protected void performGrammarAnalysis(CodeGenerator generator, Grammar grammar)
performGrammarAnalysis
in class Target
generator
- An instance of the generic code generator class.grammar
- The grammar that we are currently analyzingCopyright © 1992–2015 ANTLR. All rights reserved.