Top Fields Constructors Methods
org.antlr.codegen

public Class Python3Target

extends Target
Class Inheritance
Imports
org.antlr.runtime.Token, org.antlr.tool.Grammar, java.util.ArrayList, .List

Field Summary

Inherited from org.antlr.codegen.Target:
targetCharValueEscape

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, String literal)

Overrides org.antlr.codegen.Target.getTargetCharLiteralFromANTLRCharLiteral.

Convert from an ANTLR char literal found in a grammar file to an equivalent char literal in the target language.
public String
getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype)

Overrides org.antlr.codegen.Target.getTokenTypeAsTargetLabel.

Target must be able to override the labels used for token types
public List<Object>
postProcessAction(List<Object> chunks, Token actionToken)

Overrides org.antlr.codegen.Target.postProcessAction.

Give target a chance to do some postprocessing on actions.
private List<String>
public boolean
Inherited from org.antlr.codegen.Target:
encodeIntAsCharEscapegenRecognizerFilegenRecognizerHeaderFilegetMaxCharValuegetTarget64BitStringFromValuegetTargetStringLiteralFromANTLRStringLiteralgetTargetStringLiteralFromStringgetTargetStringLiteralFromStringisValidActionScopeperformGrammarAnalysis

Constructor Detail

Python3Targetback to summary
public Python3Target()

Method Detail

getTargetCharLiteralFromANTLRCharLiteralback to summary
public String getTargetCharLiteralFromANTLRCharLiteral(CodeGenerator generator, String literal)

Overrides org.antlr.codegen.Target.getTargetCharLiteralFromANTLRCharLiteral.

Doc from org.antlr.codegen.Target.getTargetCharLiteralFromANTLRCharLiteral.

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.

Annotations
@Override
getTokenTypeAsTargetLabelback to summary
public String getTokenTypeAsTargetLabel(CodeGenerator generator, int ttype)

Overrides org.antlr.codegen.Target.getTokenTypeAsTargetLabel.

Target must be able to override the labels used for token types

Annotations
@Override
postProcessActionback to summary
public List<Object> postProcessAction(List<Object> chunks, Token actionToken)

Overrides org.antlr.codegen.Target.postProcessAction.

Doc from org.antlr.codegen.Target.postProcessAction.

Give target a chance to do some postprocessing on actions. Python for example will have to fix the indention.

Annotations
@Override
splitLinesback to summary
private List<String> splitLines(String text)
useBaseTemplatesForSynPredFragmentsback to summary
public boolean useBaseTemplatesForSynPredFragments()

Overrides org.antlr.codegen.Target.useBaseTemplatesForSynPredFragments.

Annotations
@Override