public class ExpressionTokenizer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
allseps
All separators.
|
protected java.lang.String |
close
The nesting level delimiters.
|
static java.lang.String |
ESCAPE_CHARACTERS
The escape characters allow to include separators in the tokens.
|
protected java.lang.String |
open
The nesting level delimiters.
|
protected int |
pos
The current tokenization position.
|
protected boolean |
retsep
Return the separators.
|
protected java.lang.String |
separators
The top level separators.
|
protected java.lang.String |
source
The source string.
|
Constructor and Description |
---|
ExpressionTokenizer(java.lang.String string,
java.lang.String separators,
java.lang.String[] metas)
Create a new tokenizer.
|
ExpressionTokenizer(java.lang.String string,
java.lang.String separators,
java.lang.String[] metas,
boolean retsep)
Create a new tokenizer.
|
Modifier and Type | Method and Description |
---|---|
int |
countTokens()
Count the number of tokens.
|
boolean |
hasMoreTokens()
Test if there are more tokens available.
|
static void |
main(java.lang.String[] args)
Main for testing.
|
protected boolean |
nestingSeparatorAt(int pos)
Check if there is a nesting level separator character
at the specified position.
|
java.lang.String |
nextToken()
Get the next token from the string.
|
java.lang.String |
remainingTokens()
Get the remaining tokens as single string.
|
protected boolean |
separatorAt(int pos)
Check if there is a separator character at the specified position.
|
void |
setPosition(int pos)
Set the parse position manually.
|
public static final java.lang.String ESCAPE_CHARACTERS
protected java.lang.String source
protected java.lang.String separators
protected java.lang.String open
protected java.lang.String close
protected boolean retsep
protected java.lang.String allseps
protected int pos
public ExpressionTokenizer(java.lang.String string, java.lang.String separators, java.lang.String[] metas)
string
- The string.separators
- The separator chars.metas
- The nesting level delimiters.public ExpressionTokenizer(java.lang.String string, java.lang.String separators, java.lang.String[] metas, boolean retsep)
string
- The string.separators
- The separator chars.metas
- The nesting level delimiters.retsep
- Return the separator chars.public java.lang.String nextToken()
public java.lang.String remainingTokens()
public boolean hasMoreTokens()
public int countTokens()
public void setPosition(int pos)
pos
- The new position.protected boolean separatorAt(int pos)
pos
- The position to check.protected boolean nestingSeparatorAt(int pos)
pos
- The position to check.public static void main(java.lang.String[] args)