|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectec.util.Lexer
public class Lexer
A simple line-by-line String tokenizer. You provide Lexer with a String or other CharSequence as input, plus an array of regular expressions. Each time you call nextToken(...), the Lexer matches the next token against the regular expressions and returns it. The regular expressions are checked in order, and the first one that matches is the winner.
Field Summary | |
---|---|
static int |
FAILURE
An index which indicates that no further tokens were found. |
Constructor Summary | |
---|---|
Lexer(java.lang.CharSequence input,
java.lang.String[] regexps)
Builds a Lexer for the given input with the provided regular expressions. |
Method Summary | |
---|---|
int |
getMatchingIndex()
Returns the index of the regular expression which matched the most recent token. |
int |
getMatchingPosition()
Returns the position in the String just beyond the most recent token. |
java.lang.String |
getMatchingRule()
Returns the regular expression which matched the most recent token. |
java.lang.String |
nextToken()
Returns the next token as a string. |
java.lang.String |
nextToken(boolean trim)
Returns the next token as a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FAILURE
Constructor Detail |
---|
public Lexer(java.lang.CharSequence input, java.lang.String[] regexps)
Method Detail |
---|
public java.lang.String nextToken(boolean trim)
public java.lang.String nextToken()
public int getMatchingIndex()
public java.lang.String getMatchingRule()
public int getMatchingPosition()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |