jfun.parsec
Class ConstTokenizer

java.lang.Object
  extended by jfun.parsec.ConstTokenizer
All Implemented Interfaces:
java.io.Serializable, Tokenizer

public final class ConstTokenizer
extends java.lang.Object
implements Tokenizer, java.io.Serializable

This tokenizer will always return the same token regardless of the input range.

Author:
Ben Yu 2004-11-15
See Also:
Serialized Form

Method Summary
static Tokenizer instance(java.lang.Object t)
          Creates the Tokenizer instance.
 java.lang.Object toToken(java.lang.CharSequence cs, int from, int len)
          interprets the matched input range to a token object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toToken

public java.lang.Object toToken(java.lang.CharSequence cs,
                                int from,
                                int len)
Description copied from interface: Tokenizer
interprets the matched input range to a token object.

Specified by:
toToken in interface Tokenizer
Parameters:
cs - - the input
from - - the starting point
len - - the length of the range
Returns:
- the token object.

instance

public static Tokenizer instance(java.lang.Object t)
Creates the Tokenizer instance.

Parameters:
t - the token to be returned by the tokenizer.
Returns:
the tokenizer instance.