Package org.basex.util
Class TokenParser
- java.lang.Object
-
- org.basex.util.TokenParser
-
public class TokenParser extends Object
This class can be used to iterate through all codepoints of a token.
- Author:
- BaseX Team 2005-23, BSD License, Christian Gruen
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
token
Token to be parsed.
-
Constructor Summary
Constructors Constructor Description TokenParser(byte[] token)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
consume(int cp)
Tries to consume the specified codepoint.boolean
more()
Checks if the parser will return more codepoints.int
next()
Returns the current codepoint and advances the cursor.void
reset()
Resets the cursor position.int[]
toArray()
Returns an array with all codepoints.String
toString()
-
-
-
Method Detail
-
reset
public final void reset()
Resets the cursor position.
-
more
public final boolean more()
Checks if the parser will return more codepoints.- Returns:
- result of check
-
next
public final int next()
Returns the current codepoint and advances the cursor.- Returns:
- current codepoint, or
-1
-
consume
public final boolean consume(int cp)
Tries to consume the specified codepoint.- Parameters:
cp
- codepoint to be consumed- Returns:
- indicates if the codepoint was consumed
-
toArray
public final int[] toArray()
Returns an array with all codepoints.- Returns:
- array
-
-