Package org.antlr.v4.codegen.target
Class JavaTarget
- java.lang.Object
-
- org.antlr.v4.codegen.Target
-
- org.antlr.v4.codegen.target.JavaTarget
-
public class JavaTarget extends Target
-
-
Field Summary
Fields Modifier and Type Field Description protected static HashSet<String>
reservedWords
-
Fields inherited from class org.antlr.v4.codegen.Target
defaultCharValueEscape, gen
-
-
Constructor Summary
Constructors Constructor Description JavaTarget(CodeGenerator gen)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getReservedWords()
int
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.boolean
isATNSerializedAsInts()
-
Methods inherited from class org.antlr.v4.codegen.Target
addEscapedChar, addEscapedChar, appendUnicodeEscapedCodePoint, encodeInt16AsCharEscape, escapeChar, escapeIfNeeded, escapeWord, genFile, getAltLabelContextStructName, getBaseListenerFileName, getBaseVisitorFileName, getCodeGenerator, getElementListName, getElementName, getImplicitRuleLabel, getImplicitSetLabel, getImplicitTokenLabel, getInlineTestSetWordSize, getLanguage, getListenerFileName, getListLabel, getLoopCounter, getLoopLabel, getRecognizerFileName, getRuleFunctionContextStructName, getRuleFunctionContextStructName, getTargetCharValueEscape, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromANTLRStringLiteral, getTargetStringLiteralFromString, getTargetStringLiteralFromString, getTemplates, getTokenTypeAsTargetLabel, getTokenTypesAsTargetLabels, getVersion, getVisitorFileName, grammarSymbolCausesIssueInGeneratedCode, loadTemplates, needsHeader, shouldUseUnicodeEscapeForCodePointInDoubleQuotedString, supportsOverloadedMethods, templatesExist, visibleGrammarSymbolCausesIssueInGeneratedCode, wantsBaseListener, wantsBaseVisitor
-
-
-
-
Constructor Detail
-
JavaTarget
public JavaTarget(CodeGenerator gen)
-
-
Method Detail
-
getReservedWords
public Set<String> getReservedWords()
- Specified by:
getReservedWords
in classTarget
-
getSerializedATNSegmentLimit
public int getSerializedATNSegmentLimit()
Description copied from class:Target
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.- Overrides:
getSerializedATNSegmentLimit
in classTarget
- Returns:
- the serialized ATN segment limit
- See Also:
SerializedATN#getSegments
-
isATNSerializedAsInts
public boolean isATNSerializedAsInts()
- Overrides:
isATNSerializedAsInts
in classTarget
-
-