polya
Class Tokenizer
java.lang.Object
|
+--java.io.StreamTokenizer
|
+--polya.Tokenizer
- public class Tokenizer
- extends java.io.StreamTokenizer
Tokenizer provides a tokenizer of the package polya.
In addition to tokenizing for values of specific types, an entire
Poly can be read by one method call, assuming the input is in the
for of an S expression or an R expression.
In an S expression, the elements of a Polylist are shown in parentheses
with a space between each element. (The elements can themselves be
Polylists.)
In an R expression, the elements are shown in square brackets, with
an optional comma separator between them.
Fields inherited from class java.io.StreamTokenizer |
nval,
sval,
TT_EOF,
TT_EOL,
TT_NUMBER,
TT_WORD,
ttype |
Constructor Summary |
Tokenizer(java.io.InputStream I)
construct tokenizer from input stream |
Tokenizer(java.io.Reader R)
|
Method Summary |
void |
exceptionHandler(java.lang.Exception e)
exceptionHandler can be over-ridden to handle IO exceptions |
void |
getSkippingWhiteSpace()
|
static void |
main(java.lang.String[] args)
Test method:
loops through input, printing out each type of token. |
java.lang.Object |
nextSexp()
get next S expression from input stream
returns an object of class EOF on end-of-file |
int |
nextToken()
get token, indicating TT_LONG, TT_NUMBER, TT_WORD, or TT_EOF |
Methods inherited from class java.io.StreamTokenizer |
commentChar,
eolIsSignificant,
lineno,
lowerCaseMode,
ordinaryChar,
ordinaryChars,
parseNumbers,
pushBack,
quoteChar,
resetSyntax,
slashSlashComments,
slashStarComments,
toString,
whitespaceChars,
wordChars |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
eof
public static final EOF eof
lval
public long lval
TT_LONG
public static final int TT_LONG
Tokenizer
public Tokenizer(java.io.InputStream I)
- construct tokenizer from input stream
Tokenizer
public Tokenizer(java.io.Reader R)
exceptionHandler
public void exceptionHandler(java.lang.Exception e)
- exceptionHandler can be over-ridden to handle IO exceptions
getSkippingWhiteSpace
public void getSkippingWhiteSpace()
nextToken
public int nextToken()
- get token, indicating TT_LONG, TT_NUMBER, TT_WORD, or TT_EOF
- Overrides:
- nextToken in class java.io.StreamTokenizer
nextSexp
public java.lang.Object nextSexp()
- get next S expression from input stream
returns an object of class EOF on end-of-file
main
public static void main(java.lang.String[] args)
- Test method:
loops through input, printing out each type of token.
Terminates on end-of-file.
Note: This does not test S- or R-expressions. There
is another file for that: testPolylist.java.