Class Poly.Tokenizer
All Packages Class Hierarchy This Package Previous Next Index
Class Poly.Tokenizer
java.lang.Object
|
+----java.io.StreamTokenizer
|
+----Poly.Tokenizer
- public class Tokenizer
- extends StreamTokenizer
Tokenizer provides a tokenizer of the class Poly.
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 List are shown in parentheses
with a space between each element. (The elements can themselves be
Lists.)
In an R expression, the elements are shown in square brackets, with
an optional comma separator between them.
-
eof
-
-
lval
-
-
TT_LONG
-
-
Tokenizer(InputStream)
- construct tokenizer from input stream
-
exceptionHandler(Exception)
-
exceptionHandler can be over-ridden to handle IO exceptions
-
main(String[])
- Test method:
loops through input, printing out each type of token.
-
nextAtom()
-
get next token and try to interpret as an atom
-
nextDouble()
- get next token and try to interpret as double
-
nextFullToken()
-
nextFullToken is like nextToken but ignores ends of line
-
nextLong()
-
get next token and try to interpret as long
-
nextRexp()
-
get next R expression from input stream
-
nextSexp()
-
get next S expression from input stream
returns an object of class EOF on end-of-file
-
nextString()
-
get next token and interpret as string
-
nextToken()
-
get token, indicating TT_LONG, TT_NUMBER, TT_WORD, TT_EOL, or TT_EOF
eof
public final static EOF eof
lval
public long lval
TT_LONG
public final static int TT_LONG
Tokenizer
public Tokenizer(InputStream I)
- construct tokenizer from input stream
exceptionHandler
public void exceptionHandler(Exception e)
- exceptionHandler can be over-ridden to handle IO exceptions
nextToken
public int nextToken()
- get token, indicating TT_LONG, TT_NUMBER, TT_WORD, TT_EOL, or TT_EOF
- Overrides:
- nextToken in class StreamTokenizer
nextFullToken
public int nextFullToken()
- nextFullToken is like nextToken but ignores ends of line
nextDouble
public double nextDouble()
- get next token and try to interpret as double
nextLong
public long nextLong()
- get next token and try to interpret as long
nextString
public String nextString()
- get next token and interpret as string
nextAtom
public Object nextAtom()
- get next token and try to interpret as an atom
nextSexp
public Object nextSexp()
- get next S expression from input stream
returns an object of class EOF on end-of-file
nextRexp
public Object nextRexp()
- get next R expression from input stream
main
public static void main(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: testList.java.
All Packages Class Hierarchy This Package Previous Next Index