Package org.antlr.codegen
Class PythonTarget
java.lang.Object
org.antlr.codegen.Target
org.antlr.codegen.PythonTarget
-
Field Summary
Fields inherited from class org.antlr.codegen.Target
targetCharValueEscape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, String literal) Convert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language.getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype) Target must be able to override the labels used for token typespostProcessAction(List<Object> chunks, org.antlr.runtime.Token actionToken) Give target a chance to do some postprocessing on actions.splitLines(String text) booleanMethods inherited from class org.antlr.codegen.Target
encodeIntAsCharEscape, genRecognizerFile, genRecognizerHeaderFile, getMaxCharValue, getTarget64BitStringFromValue, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromString, getTargetStringLiteralFromString, isValidActionScope, performGrammarAnalysis
-
Constructor Details
-
PythonTarget
public PythonTarget()
-
-
Method Details
-
useBaseTemplatesForSynPredFragments
public boolean useBaseTemplatesForSynPredFragments()- Overrides:
useBaseTemplatesForSynPredFragmentsin classTarget
-
getTokenTypeAsTargetLabel
Target must be able to override the labels used for token types- Overrides:
getTokenTypeAsTargetLabelin classTarget
-
getTargetCharLiteralFromANTLRCharLiteral
Description copied from class:TargetConvert 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:
getTargetCharLiteralFromANTLRCharLiteralin classTarget
-
splitLines
-
postProcessAction
Description copied from class:TargetGive target a chance to do some postprocessing on actions. Python for example will have to fix the indention.- Overrides:
postProcessActionin classTarget
-