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.


Variable Index

 o eof
 o lval
 o TT_LONG

Constructor Index

 o Tokenizer(InputStream)
construct tokenizer from input stream

Method Index

 o exceptionHandler(Exception)
exceptionHandler can be over-ridden to handle IO exceptions
 o main(String[])
Test method: loops through input, printing out each type of token.
 o nextAtom()
get next token and try to interpret as an atom
 o nextDouble()
get next token and try to interpret as double
 o nextFullToken()
nextFullToken is like nextToken but ignores ends of line
 o nextLong()
get next token and try to interpret as long
 o nextRexp()
get next R expression from input stream
 o nextSexp()
get next S expression from input stream returns an object of class EOF on end-of-file
 o nextString()
get next token and interpret as string
 o nextToken()
get token, indicating TT_LONG, TT_NUMBER, TT_WORD, TT_EOL, or TT_EOF

Variables

 o eof
  public final static EOF eof
 o lval
  public long lval
 o TT_LONG
  public final static int TT_LONG

Constructors

 o Tokenizer
  public Tokenizer(InputStream I)
construct tokenizer from input stream

Methods

 o exceptionHandler
  public void exceptionHandler(Exception e)
exceptionHandler can be over-ridden to handle IO exceptions
 o nextToken
  public int nextToken()
get token, indicating TT_LONG, TT_NUMBER, TT_WORD, TT_EOL, or TT_EOF
Overrides:
nextToken in class StreamTokenizer
 o nextFullToken
  public int nextFullToken()
nextFullToken is like nextToken but ignores ends of line
 o nextDouble
  public double nextDouble()
get next token and try to interpret as double
 o nextLong
  public long nextLong()
get next token and try to interpret as long
 o nextString
  public String nextString()
get next token and interpret as string
 o nextAtom
  public Object nextAtom()
get next token and try to interpret as an atom
 o nextSexp
  public Object nextSexp()
get next S expression from input stream returns an object of class EOF on end-of-file
 o nextRexp
  public Object nextRexp()
get next R expression from input stream
 o 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