Top Fields Constructors Methods
org.antlr.v4.codegen.target

public Class JavaTarget

extends Target
Class Inheritance
Imports
org.antlr.v4.codegen.CodeGenerator, .Target, org.stringtemplate.v4.STGroup, .StringRenderer, java.util.*

Field Summary

Modifier and TypeField and Description
protected static final HashSet<String>
private static final ThreadLocal<STGroup>
targetTemplates

The Java target can cache the code generation templates.

Inherited from org.antlr.v4.codegen.Target:
defaultCharValueEscapegen

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Set<String>
public int
getSerializedATNSegmentLimit()

Overrides org.antlr.v4.codegen.Target.getSerializedATNSegmentLimit.

Gets the maximum number of 16-bit unsigned integers that can be encoded in a single segment (a declaration in target language) of the serialized ATN.
public boolean
Inherited from org.antlr.v4.codegen.Target:
addEscapedCharaddEscapedCharappendUnicodeEscapedCodePointencodeInt16AsCharEscapeescapeCharescapeIfNeededescapeWordgenFilegetAltLabelContextStructNamegetBaseListenerFileNamegetBaseVisitorFileNamegetCodeGeneratorgetElementListNamegetElementNamegetImplicitRuleLabelgetImplicitSetLabelgetImplicitTokenLabelgetInlineTestSetWordSizegetLanguagegetListenerFileNamegetListLabelgetLoopCountergetLoopLabelgetRecognizerFileNamegetRuleFunctionContextStructNamegetRuleFunctionContextStructNamegetTargetCharValueEscapegetTargetStringLiteralFromANTLRStringLiteralgetTargetStringLiteralFromANTLRStringLiteralgetTargetStringLiteralFromStringgetTargetStringLiteralFromStringgetTemplatesgetTokenTypeAsTargetLabelgetTokenTypesAsTargetLabelsgetVersiongetVisitorFileNamegrammarSymbolCausesIssueInGeneratedCodeloadTemplatesneedsHeadershouldUseUnicodeEscapeForCodePointInDoubleQuotedStringsupportsOverloadedMethodstemplatesExistvisibleGrammarSymbolCausesIssueInGeneratedCodewantsBaseListenerwantsBaseVisitor

Field Detail

reservedWordsback to summary
protected static final HashSet<String> reservedWords
targetTemplatesback to summary
private static final ThreadLocal<STGroup> targetTemplates

The Java target can cache the code generation templates.

Constructor Detail

JavaTargetback to summary
public JavaTarget(CodeGenerator gen)

Method Detail

getReservedWordsback to summary
public Set<String> getReservedWords()

Implements abstract org.antlr.v4.codegen.Target.getReservedWords.

Annotations
@Override
getSerializedATNSegmentLimitback to summary
public int getSerializedATNSegmentLimit()

Overrides org.antlr.v4.codegen.Target.getSerializedATNSegmentLimit.

Doc from org.antlr.v4.codegen.Target.getSerializedATNSegmentLimit.

Gets the maximum number of 16-bit unsigned integers that can be encoded in a single segment (a declaration in target language) of the serialized ATN. E.g., in C++, a small segment length results in multiple decls like: static const int32_t serializedATNSegment1[] = { 0x7, 0x12, 0x2, 0x13, 0x7, 0x13, 0x2, 0x14, 0x7, 0x14, 0x2, 0x15, 0x7, 0x15, 0x2, 0x16, 0x7, 0x16, 0x2, 0x17, 0x7, 0x17, 0x2, 0x18, 0x7, 0x18, 0x2, 0x19, 0x7, 0x19, 0x2, 0x1a, 0x7, 0x1a, 0x2, 0x1b, 0x7, 0x1b, 0x2, 0x1c, 0x7, 0x1c, 0x2, 0x1d, 0x7, 0x1d, 0x2, 0x1e, 0x7, 0x1e, 0x2, 0x1f, 0x7, 0x1f, 0x2, 0x20, 0x7, 0x20, 0x2, 0x21, 0x7, 0x21, 0x2, 0x22, 0x7, 0x22, 0x2, 0x23, 0x7, 0x23, 0x2, 0x24, 0x7, 0x24, 0x2, 0x25, 0x7, 0x25, 0x2, 0x26, }; instead of one big one. Targets are free to ignore this like JavaScript does. This is primarily needed by Java target to limit size of any single ATN string to 65k length.

Returns:int

the serialized ATN segment limit

Annotations
@Override
isATNSerializedAsIntsback to summary
public boolean isATNSerializedAsInts()

Overrides org.antlr.v4.codegen.Target.isATNSerializedAsInts.

Annotations
@Override