Top Fields Constructors Methods
org.antlr.codegen

public Class ActionScriptTarget

extends Target
Class Inheritance
Imports
org.antlr.Tool, org.stringtemplate.v4.ST, org.antlr.tool.Grammar

Field Summary

Inherited from org.antlr.codegen.Target:
targetCharValueEscape

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ST
chooseWhereCyclicDFAsGo(Tool tool, CodeGenerator generator, Grammar grammar, ST recognizerST, ST cyclicDFAST)

public String
encodeIntAsCharEscape(int v)

Overrides org.antlr.codegen.Target.encodeIntAsCharEscape.

ActionScript doesn't support Unicode String literals that are considered "illegal" or are in the surrogate pair ranges.
public String
getTarget64BitStringFromValue(long word)

Overrides org.antlr.codegen.Target.getTarget64BitStringFromValue.

Convert long to two 32-bit numbers separted by a comma.
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
private void
Inherited from org.antlr.codegen.Target:
genRecognizerFilegenRecognizerHeaderFilegetMaxCharValuegetTargetStringLiteralFromANTLRStringLiteralgetTargetStringLiteralFromStringgetTargetStringLiteralFromStringisValidActionScopeperformGrammarAnalysispostProcessActionuseBaseTemplatesForSynPredFragments

Constructor Detail

ActionScriptTargetback to summary
public ActionScriptTarget()

Method Detail

chooseWhereCyclicDFAsGoback to summary
protected ST chooseWhereCyclicDFAsGo(Tool tool, CodeGenerator generator, Grammar grammar, ST recognizerST, ST cyclicDFAST)
encodeIntAsCharEscapeback to summary
public String encodeIntAsCharEscape(int v)

Overrides org.antlr.codegen.Target.encodeIntAsCharEscape.

ActionScript doesn't support Unicode String literals that are considered "illegal" or are in the surrogate pair ranges. For example "/uffff" will not encode properly nor will "/ud800". To keep things as compact as possible we use the following encoding if the int is below 255, we encode as hex literal If the int is between 255 and 0x7fff we use a single unicode literal with the value If the int is above 0x7fff, we use a unicode literal of 0x80hh, where hh is the high-order bits followed by \xll where ll is the lower order bits of a 16-bit number. Ideally this should be improved at a future date. The most optimal way to encode this may be a compressed AMF encoding that is embedded using an Embed tag in ActionScript.

Annotations
@Override
getTarget64BitStringFromValueback to summary
public String getTarget64BitStringFromValue(long word)

Overrides org.antlr.codegen.Target.getTarget64BitStringFromValue.

Convert long to two 32-bit numbers separted by a comma. ActionScript does not support 64-bit numbers, so we need to break the number into two 32-bit literals to give to the Bit. A number like 0xHHHHHHHHLLLLLLLL is broken into the following string: "0xLLLLLLLL, 0xHHHHHHHH" Note that the low order bits are first, followed by the high order bits. This is to match how the BitSet constructor works, where the bits are passed in in 32-bit chunks with low-order bits coming first.

Annotations
@Override
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.

Doc from org.antlr.codegen.Target.getTokenTypeAsTargetLabel.

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

Annotations
@Override
writeHexWithPaddingback to summary
private void writeHexWithPadding(StringBuffer buf, String digits)