sjm.parse.tokens
Class WhitespaceState

java.lang.Object
  |
  +--sjm.parse.tokens.TokenizerState
        |
        +--sjm.parse.tokens.WhitespaceState

public class WhitespaceState
extends TokenizerState

A whitespace state ignores whitespace (such as blanks and tabs), and returns the tokenizer's next token. By default, all characters from 0 to 32 are whitespace.

Version:
1.0
Author:
Steven J. Metsker

Field Summary
protected  boolean[] whitespaceChar
           
 
Constructor Summary
WhitespaceState()
          Constructs a whitespace state with a default idea of what characters are, in fact, whitespace.
 
Method Summary
 Token nextToken(java.io.PushbackReader r, int aWhitespaceChar, Tokenizer t)
          Ignore whitespace (such as blanks and tabs), and return the tokenizer's next token.
 void setWhitespaceChars(int from, int to, boolean b)
          Establish the given characters as whitespace to ignore.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

whitespaceChar

protected boolean[] whitespaceChar
Constructor Detail

WhitespaceState

public WhitespaceState()
Constructs a whitespace state with a default idea of what characters are, in fact, whitespace.
Method Detail

nextToken

public Token nextToken(java.io.PushbackReader r,
                       int aWhitespaceChar,
                       Tokenizer t)
                throws java.io.IOException
Ignore whitespace (such as blanks and tabs), and return the tokenizer's next token.
Overrides:
nextToken in class TokenizerState
Returns:
the tokenizer's next token

setWhitespaceChars

public void setWhitespaceChars(int from,
                               int to,
                               boolean b)
Establish the given characters as whitespace to ignore.
Parameters:
first - char
second - char
boolean - true, if this state should ignore characters in the given range