Package org.antlr.codegen
Class Python3Target
- java.lang.Object
-
- org.antlr.codegen.Target
-
- org.antlr.codegen.Python3Target
-
public class Python3Target extends Target
-
-
Field Summary
-
Fields inherited from class org.antlr.codegen.Target
targetCharValueEscape
-
-
Constructor Summary
Constructors Constructor Description Python3Target()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, java.lang.String literal)
Convert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language.java.lang.String
getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype)
Target must be able to override the labels used for token typesjava.util.List<java.lang.Object>
postProcessAction(java.util.List<java.lang.Object> chunks, org.antlr.runtime.Token actionToken)
Give target a chance to do some postprocessing on actions.boolean
useBaseTemplatesForSynPredFragments()
-
Methods inherited from class org.antlr.codegen.Target
encodeIntAsCharEscape, genRecognizerFile, genRecognizerHeaderFile, getMaxCharValue, getTarget64BitStringFromValue, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromString, getTargetStringLiteralFromString, isValidActionScope, performGrammarAnalysis
-
-
-
-
Method Detail
-
useBaseTemplatesForSynPredFragments
public boolean useBaseTemplatesForSynPredFragments()
- Overrides:
useBaseTemplatesForSynPredFragments
in classTarget
-
getTokenTypeAsTargetLabel
public java.lang.String getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype)
Target must be able to override the labels used for token types- Overrides:
getTokenTypeAsTargetLabel
in classTarget
-
getTargetCharLiteralFromANTLRCharLiteral
public java.lang.String getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, java.lang.String literal)
Description copied from class:Target
Convert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language. For most languages, this means leaving 'x' as 'x'. Actually, we need to escape ' ' so that it doesn't get converted to \n by the compiler. Convert the literal to the char value and then to an appropriate target char literal. Expect single quotes around the incoming literal.- Overrides:
getTargetCharLiteralFromANTLRCharLiteral
in classTarget
-
postProcessAction
public java.util.List<java.lang.Object> postProcessAction(java.util.List<java.lang.Object> chunks, org.antlr.runtime.Token actionToken)
Description copied from class:Target
Give target a chance to do some postprocessing on actions. Python for example will have to fix the indention.- Overrides:
postProcessAction
in classTarget
-
-