|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.holub.text.WordToken
public class WordToken
Recognize a token that looks like a word. The match is case insensitive. To be recognized, the input must match the pattern passed to the constructor, and must be followed by a non-letter-or-digit. The returned lexeme is always all-lower-case letters, regardless of what the actual input looked like.
Token
This code may be used freely by yourself with the following restrictions:
|
Constructor Summary | |
---|---|
WordToken(String pattern)
Create a token. |
Method Summary | |
---|---|
String |
lexeme()
Returns the input string that matched the token specification. |
boolean |
match(String input,
int offset)
Returns true if the sequence at the indicated offset from the beginning of the indicated input string matches the current token. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WordToken(String pattern)
pattern
- a regular expression
(see) that describes
the set of lexemes associated with this token.Method Detail |
---|
public boolean match(String input, int offset)
Token
match
in interface Token
public String lexeme()
Token
lexeme
in interface Token
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |