|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.StreamTokenizer
A class to turn an input stream into a stream of tokens. There are a number of methods that define the lexical syntax of tokens.
Field Summary | |
double |
nval
The number value. |
String |
sval
The Stream value. |
static int |
TT_EOF
The End-of-file token. |
static int |
TT_EOL
The End-of-line token. |
static int |
TT_NUMBER
The number token. |
static int |
TT_WORD
The word token. |
int |
ttype
The type of the last token returned. |
Constructor Summary | |
StreamTokenizer(InputStream I)
Creates a stream tokenizer that parses the specified input stream. |
Method Summary | |
void |
commentChar(int ch)
Specifies that this character starts a single line comment. |
void |
eolIsSignificant(boolean flag)
If the flag is true, end-of-lines are significant (TT_EOL will be returned by nexttoken). |
int |
lineno()
Return the current line number. |
void |
lowerCaseMode(boolean fl)
Examines a boolean to decide whether TT_WORD tokens are forced to be lower case. |
int |
nextToken()
Parses a token from the input stream. |
void |
ordinaryChar(int ch)
Specifies that this character is 'ordinary': it removes any significance as a word, comment, string, whitespace or number character. |
void |
ordinaryChars(int low,
int hi)
Specifies that characters in this range are 'ordinary'. |
void |
parseNumbers()
Specifies that numbers should be parsed. |
void |
pushBack()
Pushes back a stream token. |
void |
quoteChar(int ch)
Specifies that matching pairs of this character delimit String constants. |
void |
resetSyntax()
Resets the syntax table so that all characters are special. |
void |
slashSlashComments(boolean flag)
If the flag is true, recognize C++ style( // ) comments. |
void |
slashStarComments(boolean flag)
If the flag is true, recognize C style( /* ) comments. |
String |
toString()
Returns the String representation of the stream token. |
void |
whitespaceChars(int low,
int hi)
Specifies that characters in this range are whitespace characters. |
void |
wordChars(int low,
int hi)
Specifies that characters in this range are word characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int ttype
public static final int TT_EOF
public static final int TT_EOL
public static final int TT_NUMBER
public static final int TT_WORD
public String sval
public double nval
Constructor Detail |
public StreamTokenizer(InputStream I)
I
- the input streamMethod Detail |
public void resetSyntax()
public void wordChars(int low, int hi)
low
- the low end of the rangehi
- the high end of the rangepublic void whitespaceChars(int low, int hi)
low
- the low end of the rangehi
- the high end of the rangepublic void ordinaryChars(int low, int hi)
low
- the low end of the rangehi
- the high end of the rangepublic void ordinaryChar(int ch)
ch
- the characterpublic void commentChar(int ch)
ch
- the characterpublic void quoteChar(int ch)
ch
- the characterpublic void parseNumbers()
public void eolIsSignificant(boolean flag)
public void slashStarComments(boolean flag)
public void slashSlashComments(boolean flag)
public void lowerCaseMode(boolean fl)
fl
- the boolean flagpublic int nextToken() throws IOException
IOException
public void pushBack()
public int lineno()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |