Package cn.nukkit.nbt.snbt
Class SNBTParserImplement
java.lang.Object
cn.nukkit.nbt.snbt.SNBTParserImplement
- All Implemented Interfaces:
SNBTConstants
-
Nested Class Summary
Nested classes/interfaces inherited from interface cn.nukkit.nbt.snbt.SNBTConstants
SNBTConstants.LexicalState, SNBTConstants.TokenType
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSNBTParserImplement
(SNBTLexer lexer) Constructor with user supplied Lexer.SNBTParserImplement
(InputStream stream) SNBTParserImplement
(Reader reader) SNBTParserImplement
(CharSequence content) SNBTParserImplement
(String inputSource, CharSequence content) SNBTParserImplement
(String inputSource, Path path) SNBTParserImplement
(String inputSource, Path path, Charset charset) SNBTParserImplement
(Path path) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
void
cancel()
final void
boolean
final Token
final Token
getToken
(int index) final void
boolean
boolean
boolean
final void
final void
ListNBT()
int
peekNode()
void
Puts the node on the top of the stack.popNode()
void
push a node onto the top of the node stackfinal void
Root()
rootNode()
void
setBuildTree
(boolean buildTree) void
setInputSource
(String inputSource) void
setParserTolerant
(boolean tolerantParsing) void
setTokensAreNodes
(boolean tokensAreNodes) void
setUnparsedTokensAreNodes
(boolean unparsedTokensAreNodes) final void
Value()
-
Field Details
-
token_source
Generated Lexer.
-
-
Constructor Details
-
SNBTParserImplement
-
SNBTParserImplement
-
SNBTParserImplement
- Parameters:
inputSource
- just the name of the input source (typically the filename) that will be used in error messages and so on.path
- The location (typically the filename) from which to get the input to parse- Throws:
IOException
-
SNBTParserImplement
- Throws:
IOException
-
SNBTParserImplement
- Parameters:
path
- The location (typically the filename) from which to get the input to parse- Throws:
IOException
-
SNBTParserImplement
-
SNBTParserImplement
-
SNBTParserImplement
Constructor with user supplied Lexer.
-
-
Method Details
-
cancel
public void cancel() -
isCancelled
public boolean isCancelled() -
setInputSource
-
getNextToken
- Returns:
- the next Token off the stream. This is the same as #getToken(1)
-
getToken
- Parameters:
index
- how many tokens to look ahead- Returns:
- the specific regular (i.e. parsed) Token index ahead/behind in the stream. If we are in a lookahead, it looks ahead from the currentLookaheadToken Otherwise, it is the lastConsumedToken. If you pass in a negative number it goes backward.
-
Value
public final void Value() -
KeyValuePair
public final void KeyValuePair() -
ByteArrayNBT
public final void ByteArrayNBT() -
IntArrayNBT
public final void IntArrayNBT() -
ListNBT
public final void ListNBT() -
CompoundNBT
public final void CompoundNBT() -
Root
public final void Root() -
isParserTolerant
public boolean isParserTolerant() -
setParserTolerant
public void setParserTolerant(boolean tolerantParsing) -
isTreeBuildingEnabled
public boolean isTreeBuildingEnabled() -
setUnparsedTokensAreNodes
public void setUnparsedTokensAreNodes(boolean unparsedTokensAreNodes) -
setTokensAreNodes
public void setTokensAreNodes(boolean tokensAreNodes) -
rootNode
- Returns:
- the root node of the AST. It only makes sense to call this after a successful parse.
-
pushNode
push a node onto the top of the node stack- Parameters:
n
- the node to push
-
popNode
- Returns:
- the node on the top of the stack, and remove it from the stack.
-
peekNode
- Returns:
- the node currently on the top of the tree-building stack.
-
pokeNode
Puts the node on the top of the stack. However, unlike pushNode() it replaces the node that is currently on the top of the stack. This is effectively equivalent to popNode() followed by pushNode(n)- Parameters:
n
- the node to poke
-
nodeArity
public int nodeArity()- Returns:
- the number of Nodes on the tree-building stack in the current node scope.
-
getBuildTree
public boolean getBuildTree() -
setBuildTree
public void setBuildTree(boolean buildTree)
-