org.antlr.codegen
Class PythonTarget

java.lang.Object
  extended by org.antlr.codegen.Target
      extended by org.antlr.codegen.PythonTarget

public class PythonTarget
extends Target


Field Summary
 
Fields inherited from class org.antlr.codegen.Target
targetCharValueEscape
 
Constructor Summary
PythonTarget()
           
 
Method Summary
 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 types
 java.util.List postProcessAction(java.util.List chunks, antlr.Token actionToken)
          Give target a chance to do some postprocessing on actions.
 
Methods inherited from class org.antlr.codegen.Target
genRecognizerFile, genRecognizerHeaderFile, getMaxCharValue, getTarget64BitStringFromValue, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromString, getTargetStringLiteralFromString, isValidActionScope, performGrammarAnalysis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PythonTarget

public PythonTarget()
Method Detail

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 class Target

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 class Target

postProcessAction

public java.util.List postProcessAction(java.util.List chunks,
                                        antlr.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 class Target