Class PythonTarget

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

public class PythonTarget extends Target
  • Constructor Details

    • PythonTarget

      public PythonTarget()
  • Method Details

    • useBaseTemplatesForSynPredFragments

      public boolean useBaseTemplatesForSynPredFragments()
      Overrides:
      useBaseTemplatesForSynPredFragments in class Target
    • getTokenTypeAsTargetLabel

      public 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 String getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, 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
    • splitLines

      private List<String> splitLines(String text)
    • postProcessAction

      public List<Object> postProcessAction(List<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 class Target