|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjwo.utils.expression.Tokenizer
public class 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
Default separator used to distiguish tokens. |
| 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)
expressionText - Expression to process.
public void setSeparator(String separatorText)
throws PatternSyntaxException
separatorText - Regular expression identifying token separators.
PatternSyntaxException - If problem compiling the regular expression.
public void addToken(String lexeme,
Object token)
throws PatternSyntaxException
lexeme - The expression lexeme to add.token - The type of token to add.
PatternSyntaxException - If problem compiling the lexeme as a regular expression.public void reset()
public Token nextToken()
throws TokenNotFoundException
TokenNotFoundException - If unknown token is found.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||