|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Tokenizer
Nested Class Summary | |
---|---|
static class |
Tokenizer.TokenType
Represents the type of a tokenizer token |
Method Summary | |
---|---|
boolean |
canPushBack()
Checks if the stream can be pushed back |
boolean |
check(char c)
Removes the next token if it is an operator, and matches the character c. |
boolean |
check(java.lang.String s)
Removes the next token if it is a word, and matches the string s. |
void |
close()
Closes the input stream |
char |
getCharacter()
Returns the next token (unless it is not a character) |
java.lang.String |
getComment()
Returns the next token (unless it is not a comment) |
float |
getFloat()
Returns the next token (unless it is not a float) |
int |
getInt()
Returns the next token (unless it is not an integer) |
char |
getOp()
Returns the next token (unless it is not an operator) |
java.lang.String |
getString()
Returns the next token (unless it is not a string) |
java.lang.String |
getWhitespaceBeforeToken()
Returns the whitespace in the file before the current token. |
java.lang.String |
getWord()
Returns the next token (unless it is not a word) |
int |
lineNo()
Returns the line number of the last token requested |
void |
match(char c)
Removes the next token if it is an operator, and matches the given character. |
void |
match(java.lang.String s)
Removes the next token if it is a word, and matches the given string. |
int |
nextLineNo()
Returns the line number of the next token to be read |
Tokenizer.TokenType |
peekAtKind()
Returns the type of the next token |
void |
pushBack()
Pushes the last token requested back. |
void |
skipToken()
Skips the next token |
boolean |
test(char c)
Checks if the next token is an operator and matches the character c. |
boolean |
test(java.lang.String s)
Checks if the next token is a word and matches the string s. |
Method Detail |
---|
Tokenizer.TokenType peekAtKind()
int getInt() throws TokenizerException
TokenizerException
- if the next token is not an integerfloat getFloat() throws TokenizerException
TokenizerException
- if the next token is not a floatjava.lang.String getWord() throws TokenizerException
TokenizerException
- if the next token is not a wordjava.lang.String getString() throws TokenizerException
TokenizerException
- if the next token is not a stringchar getCharacter() throws TokenizerException
TokenizerException
- if the next token is not a characterchar getOp() throws TokenizerException
TokenizerException
- if the next token is not an operatorjava.lang.String getComment() throws TokenizerException
TokenizerException
- if the next token is not a commentvoid match(char c) throws TokenizerException
c
- the character to match
TokenizerException
- if the next token is not c, or is not an operator token.void match(java.lang.String s) throws TokenizerException
s
- the string to match
TokenizerException
- if the next token is not s, or is not a word tokenboolean check(char c)
c
- the character to match
boolean check(java.lang.String s)
s
- the string to match
boolean test(char c)
c
- the character to match
boolean test(java.lang.String s)
s
- the string to match
void pushBack()
boolean canPushBack()
void skipToken()
java.lang.String getWhitespaceBeforeToken()
int lineNo()
int nextLineNo()
void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |