Package org.basex.util
Class InputParser
java.lang.Object
org.basex.util.InputParser
- Direct Known Subclasses:
JsonParser,QueryParser
Abstract class for parsing various inputs, such as database commands or queries.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal charconsume()Consumes the next character.final booleanconsume(int ch) Peeks forward and consumes the character if it equals the specified one.final booleanPeeks forward and consumes the string if it equals the specified one.final charcurr()Returns the current character.final booleancurr(int ch) Checks if the current character equals the specified one.protected final byte[]found()Returns a "found" string, containing the current character.final InputInfoinfo()Creates input information.protected final voidmark()Remembers the current position.final booleanmore()Checks if more characters are found.protected final charnext()Returns the next character.protected static booleanquote(int ch) Checks if the specified character is a quote.protected final StringReturns a maximum of 15 remaining characters that have not yet been parsed.
-
Field Details
-
input
Input to be parsed. -
length
public final int lengthQuery length. -
file
File reference. -
pos
public int posCurrent input position. -
mark
public int markMarked input position.
-
-
Constructor Details
-
InputParser
Constructor.- Parameters:
input- input
-
-
Method Details
-
more
public final boolean more()Checks if more characters are found.- Returns:
- current character
-
curr
public final char curr()Returns the current character.- Returns:
- current character
-
curr
public final boolean curr(int ch) Checks if the current character equals the specified one.- Parameters:
ch- character to be checked- Returns:
- result of check
-
mark
protected final void mark()Remembers the current position. -
next
protected final char next()Returns the next character.- Returns:
- next character, or
0if string is exhausted
-
consume
public final char consume()Consumes the next character.- Returns:
- next character, or
0if string is exhausted
-
consume
public final boolean consume(int ch) Peeks forward and consumes the character if it equals the specified one.- Parameters:
ch- character to consume- Returns:
- true if character was found
-
quote
protected static boolean quote(int ch) Checks if the specified character is a quote.- Parameters:
ch- character to be checked- Returns:
- result
-
consume
Peeks forward and consumes the string if it equals the specified one.- Parameters:
string- string to consume- Returns:
- true if string was found
-
found
protected final byte[] found()Returns a "found" string, containing the current character.- Returns:
- completion
-
remaining
Returns a maximum of 15 remaining characters that have not yet been parsed.- Returns:
- query substring
-
info
Creates input information.- Returns:
- input information
-