Package org.antlr.v4.runtime.atn
Class ATNDeserializer
- java.lang.Object
-
- org.antlr.v4.runtime.atn.ATNDeserializer
-
public class ATNDeserializer extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceATNDeserializer.UnicodeDeserializer(package private) static classATNDeserializer.UnicodeDeserializingMode
-
Field Summary
Fields Modifier and Type Field Description private static java.util.UUIDADDED_LEXER_ACTIONSThis UUID indicates an extension ofADDED_PRECEDENCE_TRANSITIONSfor the addition of lexer actions encoded as a sequence ofLexerActioninstances.private static java.util.UUIDADDED_PRECEDENCE_TRANSITIONSThis UUID indicates an extension ofBASE_SERIALIZED_UUIDfor the addition of precedence predicates.private static java.util.UUIDADDED_UNICODE_SMPThis UUID indicates the serialized ATN contains two sets of IntervalSets, where the second set's values are encoded as 32-bit integers to support the full Unicode SMP range up to U+10FFFF.private static java.util.UUIDBASE_SERIALIZED_UUIDThis is the earliest supported serialized UUID.private ATNDeserializationOptionsdeserializationOptionsstatic java.util.UUIDSERIALIZED_UUIDThis is the current serialized UUID.static intSERIALIZED_VERSIONprivate static java.util.List<java.util.UUID>SUPPORTED_UUIDSThis list contains all of the currently supported UUIDs, ordered by when the feature first appeared in this branch.
-
Constructor Summary
Constructors Constructor Description ATNDeserializer()ATNDeserializer(ATNDeserializationOptions deserializationOptions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckCondition(boolean condition)protected voidcheckCondition(boolean condition, java.lang.String message)ATNdeserialize(char[] data)private intdeserializeSets(char[] data, int p, java.util.List<IntervalSet> sets, ATNDeserializer.UnicodeDeserializer unicodeDeserializer)protected TransitionedgeFactory(ATN atn, int type, int src, int trg, int arg1, int arg2, int arg3, java.util.List<IntervalSet> sets)(package private) static ATNDeserializer.UnicodeDeserializergetUnicodeDeserializer(ATNDeserializer.UnicodeDeserializingMode mode)protected static booleanisFeatureSupported(java.util.UUID feature, java.util.UUID actualUuid)Determines if a particular serialized representation of an ATN supports a particular feature, identified by theUUIDused for serializing the ATN at the time the feature was first introduced.protected LexerActionlexerActionFactory(LexerActionType type, int data1, int data2)protected voidmarkPrecedenceDecisions(ATN atn)Analyze theStarLoopEntryStatestates in the specified ATN to set theStarLoopEntryState.isPrecedenceDecisionfield to the correct value.protected ATNStatestateFactory(int type, int ruleIndex)protected static inttoInt(char c)protected static inttoInt32(char[] data, int offset)protected static longtoLong(char[] data, int offset)protected static java.util.UUIDtoUUID(char[] data, int offset)protected voidverifyATN(ATN atn)
-
-
-
Field Detail
-
SERIALIZED_VERSION
public static final int SERIALIZED_VERSION
-
BASE_SERIALIZED_UUID
private static final java.util.UUID BASE_SERIALIZED_UUID
This is the earliest supported serialized UUID.
-
ADDED_PRECEDENCE_TRANSITIONS
private static final java.util.UUID ADDED_PRECEDENCE_TRANSITIONS
This UUID indicates an extension ofBASE_SERIALIZED_UUIDfor the addition of precedence predicates.
-
ADDED_LEXER_ACTIONS
private static final java.util.UUID ADDED_LEXER_ACTIONS
This UUID indicates an extension ofADDED_PRECEDENCE_TRANSITIONSfor the addition of lexer actions encoded as a sequence ofLexerActioninstances.
-
ADDED_UNICODE_SMP
private static final java.util.UUID ADDED_UNICODE_SMP
This UUID indicates the serialized ATN contains two sets of IntervalSets, where the second set's values are encoded as 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
-
SUPPORTED_UUIDS
private static final java.util.List<java.util.UUID> SUPPORTED_UUIDS
This list contains all of the currently supported UUIDs, ordered by when the feature first appeared in this branch.
-
SERIALIZED_UUID
public static final java.util.UUID SERIALIZED_UUID
This is the current serialized UUID.
-
deserializationOptions
private final ATNDeserializationOptions deserializationOptions
-
-
Constructor Detail
-
ATNDeserializer
public ATNDeserializer()
-
ATNDeserializer
public ATNDeserializer(ATNDeserializationOptions deserializationOptions)
-
-
Method Detail
-
getUnicodeDeserializer
static ATNDeserializer.UnicodeDeserializer getUnicodeDeserializer(ATNDeserializer.UnicodeDeserializingMode mode)
-
isFeatureSupported
protected static boolean isFeatureSupported(java.util.UUID feature, java.util.UUID actualUuid)Determines if a particular serialized representation of an ATN supports a particular feature, identified by theUUIDused for serializing the ATN at the time the feature was first introduced.- Parameters:
feature- TheUUIDmarking the first time the feature was supported in the serialized ATN.actualUuid- TheUUIDof the actual serialized ATN which is currently being deserialized.- Returns:
trueif theactualUuidvalue represents a serialized ATN at or after the feature identified byfeaturewas introduced; otherwise,false.
-
deserialize
public ATN deserialize(char[] data)
-
deserializeSets
private int deserializeSets(char[] data, int p, java.util.List<IntervalSet> sets, ATNDeserializer.UnicodeDeserializer unicodeDeserializer)
-
markPrecedenceDecisions
protected void markPrecedenceDecisions(ATN atn)
Analyze theStarLoopEntryStatestates in the specified ATN to set theStarLoopEntryState.isPrecedenceDecisionfield to the correct value.- Parameters:
atn- The ATN.
-
verifyATN
protected void verifyATN(ATN atn)
-
checkCondition
protected void checkCondition(boolean condition)
-
checkCondition
protected void checkCondition(boolean condition, java.lang.String message)
-
toInt
protected static int toInt(char c)
-
toInt32
protected static int toInt32(char[] data, int offset)
-
toLong
protected static long toLong(char[] data, int offset)
-
toUUID
protected static java.util.UUID toUUID(char[] data, int offset)
-
edgeFactory
protected Transition edgeFactory(ATN atn, int type, int src, int trg, int arg1, int arg2, int arg3, java.util.List<IntervalSet> sets)
-
stateFactory
protected ATNState stateFactory(int type, int ruleIndex)
-
lexerActionFactory
protected LexerAction lexerActionFactory(LexerActionType type, int data1, int data2)
-
-