Class SNBTParserImplement

java.lang.Object
cn.nukkit.nbt.snbt.SNBTParserImplement
All Implemented Interfaces:
SNBTConstants

public class SNBTParserImplement extends Object implements SNBTConstants
  • Field Details

    • token_source

      public SNBTLexer token_source
      Generated Lexer.
  • Constructor Details

    • SNBTParserImplement

      public SNBTParserImplement(String inputSource, CharSequence content)
    • SNBTParserImplement

      public SNBTParserImplement(CharSequence content)
    • SNBTParserImplement

      public SNBTParserImplement(String inputSource, Path path) throws IOException
      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

      public SNBTParserImplement(String inputSource, Path path, Charset charset) throws IOException
      Throws:
      IOException
    • SNBTParserImplement

      public SNBTParserImplement(Path path) throws IOException
      Parameters:
      path - The location (typically the filename) from which to get the input to parse
      Throws:
      IOException
    • SNBTParserImplement

      public SNBTParserImplement(InputStream stream)
    • SNBTParserImplement

      public SNBTParserImplement(Reader reader)
    • SNBTParserImplement

      public SNBTParserImplement(SNBTLexer lexer)
      Constructor with user supplied Lexer.
  • Method Details

    • cancel

      public void cancel()
    • isCancelled

      public boolean isCancelled()
    • setInputSource

      public void setInputSource(String inputSource)
    • getNextToken

      public final Token getNextToken()
      Returns:
      the next Token off the stream. This is the same as #getToken(1)
    • getToken

      public final Token getToken(int index)
      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

      public Node rootNode()
      Returns:
      the root node of the AST. It only makes sense to call this after a successful parse.
    • pushNode

      public void pushNode(Node n)
      push a node onto the top of the node stack
      Parameters:
      n - the node to push
    • popNode

      public Node popNode()
      Returns:
      the node on the top of the stack, and remove it from the stack.
    • peekNode

      public Node peekNode()
      Returns:
      the node currently on the top of the tree-building stack.
    • pokeNode

      public void pokeNode(Node n)
      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)