java.lang.ObjectTokenScanner
public class TokenScanner
A "scanner" for Tokens that doesn't need to have whitespace separated Tokens. There are no delimiters. Recognizes the operators from Token.OperatorList. These are all operators from Token including parentheses. Recognizes simple non-negative real numbers with or without a decimal point. Must have digits on both sides of the decimal point if there is one. Does not recognize negative numbers. Will tokenize them as minus and a number. Throws NoSuchElementException if Token is requested but doesn't exist at current location in source. There is no error recovery or peek.
Constructor Summary | |
---|---|
TokenScanner(java.lang.String s)
Constructs a TokenScanner from a non-empty String |
Method Summary | |
---|---|
boolean |
hasNextToken()
Whether or not there is a Token available. |
Token |
nextToken()
Provides the next Token from source. |
boolean |
reachedEnd()
Returns whether or not entire source was tokenized. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TokenScanner(java.lang.String s)
Method Detail |
---|
public boolean hasNextToken()
public Token nextToken()
public boolean reachedEnd()