Module syntaxnbt

Class SNBTParser

java.lang.Object
at.syntaxerror.syntaxnbt.internal.SNBTParser
Direct Known Subclasses:
PathParser

public class SNBTParser extends Object
A utility class for parsing SNBT tags
Author:
SyntaxError404
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static final record 
    Range for an integer type
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Map<String,SNBTParser.Range>
    Ranges for integer types
    protected static final Pattern
    RegEx pattern for matching integers
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Force to re-read the last character
    protected static boolean
    isValuePart(char c)
    Checks whether a character is valid for string-like objects
    protected boolean
    Checks whether a character is valid for string-like objects
    protected boolean
    Whether there are still characters left
    protected char
    Returns the next character
    protected char
    Returns the next non-whitespace character
    protected TagCompound
    Parses and returns the next TAG_Compound
    protected String
    nextString(boolean alt)
    Returns the next string-like object
    parse(String input)
    Read a compound tag from a string
    protected char
    Returns the next character is without actually incrementing the position
    protected NBTException
    Constructs a new NBT exception
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • PATTERN_INTEGER

      protected static final Pattern PATTERN_INTEGER
      RegEx pattern for matching integers
    • INTEGER_BOUNDS

      protected static final Map<String,SNBTParser.Range> INTEGER_BOUNDS
      Ranges for integer types
  • Method Details

    • more

      protected boolean more()
      Whether there are still characters left
      Returns:
      whether there are still characters left
    • back

      protected void back()
      Force to re-read the last character
    • peek

      protected char peek()
      Returns the next character is without actually incrementing the position
      Returns:
      the next character
    • next

      protected char next()
      Returns the next character
      Returns:
      the next character
    • nextClean

      protected char nextClean()
      Returns the next non-whitespace character
      Returns:
      the next character
    • nextString

      protected String nextString(boolean alt)
      Returns the next string-like object
      Parameters:
      alt - use alternative validation check
      Returns:
      the next string
    • nextCompound

      protected TagCompound nextCompound()
      Parses and returns the next TAG_Compound
      Returns:
      the next TAG_Compound
    • isValuePartAlt

      protected boolean isValuePartAlt(char c)
      Checks whether a character is valid for string-like objects
      Parameters:
      c - a character
      Returns:
      whether the character is valid
    • isValuePart

      protected static boolean isValuePart(char c)
      Checks whether a character is valid for string-like objects
      Parameters:
      c - a character
      Returns:
      whether the character is valid
    • parse

      public static TagCompound parse(String input)
      Read a compound tag from a string
      Parameters:
      input - an input string
      Returns:
      the parsed compound tag
    • syntaxError

      protected NBTException syntaxError(String message)
      Constructs a new NBT exception
      Parameters:
      message - the exception message
      Returns:
      an exception
    • toString

      public String toString()
      Overrides:
      toString in class Object