|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.utils.expression.Tokenizer
A tokenizer that uses regular expressions to parse text. Modified from original code described at www.devx.com/premier/mgznarch/javapro/2001/05may01/ps0105/ps0105.asp.
Field Summary | |
static String |
DEFAULT_SEPARATOR
|
Constructor Summary | |
Tokenizer()
Creates a default tokenizer with no initial expression to process. |
|
Tokenizer(String expressionText)
Creates a tokenizer using the given initial expression. |
Method Summary | |
void |
addToken(String lexeme,
Object token)
Adds a token to the currently stored regular expression to use for processing. |
Token |
nextToken()
Returns the next token in the input. |
void |
reset()
Resets the list of tokens to process. |
void |
setInput(String expressionText)
Sets the input sequence of characters to process. |
void |
setSeparator(String separatorText)
Sets the separator used to distinguish between tokens. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DEFAULT_SEPARATOR
Constructor Detail |
public Tokenizer()
public Tokenizer(String expressionText)
expressionText
- Expression to process.Method Detail |
public void setInput(String expressionText) throws PatternSyntaxException
expressionText
- Expression to process.
PatternSyntaxException
public void setSeparator(String separatorText) throws PatternSyntaxException
separatorText
- Regular expression identifying token separators.
PatternSyntaxException
public void addToken(String lexeme, Object token) throws PatternSyntaxException
lexeme
- The expression lexeme to add.token
- The type of token to add.
PatternSyntaxException
public void reset()
public Token nextToken() throws TokenNotFoundException
TokenNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |