jess
Class ReaderTokenizer

java.lang.Object
  extended byjess.ReaderTokenizer
All Implemented Interfaces:
Tokenizer

public class ReaderTokenizer
extends java.lang.Object
implements Tokenizer

A simple Tokenizer implementation for the Jess language that takes its input from a Reader. Not serializable, as it contains a reference to a java.io.Reader.

(C) 2006 Sandia National Laboratories


Field Summary
 
Fields inherited from interface jess.Tokenizer
BLANK_MULTI, BLANK_PREFIX
 
Constructor Summary
ReaderTokenizer(java.io.Reader ios, boolean parseComments)
          Constructor - use large buffer for FileReader, no buffering for everything else
 
Method Summary
 java.lang.String discardToEOL()
          Discard characters from the current stream position to the end of the current line.
 void eatWhitespace()
          Consume all characters up to, but not including, the next non-whitespace character
 int getStreamPos()
          Return the current character offset.
static boolean isALong(java.lang.String sval)
           
static boolean isAnInteger(java.lang.String sval)
           
 JessToken nextToken()
          Return the next parsed token, skipping over all whitespace.
 java.lang.String readLine()
          Return characters from the current location to the end of the current line, as a String
 void reportNewlines(boolean b)
          Specify whether newlines should be reported as tokens
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderTokenizer

public ReaderTokenizer(java.io.Reader ios,
                       boolean parseComments)
Constructor - use large buffer for FileReader, no buffering for everything else

Parameters:
ios -
Method Detail

reportNewlines

public void reportNewlines(boolean b)
Description copied from interface: Tokenizer
Specify whether newlines should be reported as tokens

Specified by:
reportNewlines in interface Tokenizer
Parameters:
b - true if newlines should be reported

readLine

public java.lang.String readLine()
                          throws JessException
Description copied from interface: Tokenizer
Return characters from the current location to the end of the current line, as a String

Specified by:
readLine in interface Tokenizer
Returns:
the rest of the current line
Throws:
JessException - if anything goes wrong

nextToken

public JessToken nextToken()
                    throws JessException
Description copied from interface: Tokenizer
Return the next parsed token, skipping over all whitespace.

Specified by:
nextToken in interface Tokenizer
Returns:
the token
Throws:
JessException - if anything goes wrong

eatWhitespace

public void eatWhitespace()
                   throws JessException
Description copied from interface: Tokenizer
Consume all characters up to, but not including, the next non-whitespace character

Specified by:
eatWhitespace in interface Tokenizer
Throws:
JessException

isAnInteger

public static boolean isAnInteger(java.lang.String sval)

isALong

public static boolean isALong(java.lang.String sval)

discardToEOL

public java.lang.String discardToEOL()
                              throws JessException
Description copied from interface: Tokenizer
Discard characters from the current stream position to the end of the current line.

Specified by:
discardToEOL in interface Tokenizer
Returns:
the parsed characters
Throws:
JessException - if anything goes wrong

getStreamPos

public int getStreamPos()
Description copied from interface: Tokenizer
Return the current character offset. The meaning depends on the underlying data source.

Specified by:
getStreamPos in interface Tokenizer
Returns:
the character position

© 2007 Sandia Corporation