KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > tokens > TokenWord


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solutions Corp. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on 2004-11-7
10  *
11  * Author Ben Yu
12  */

13 package jfun.parsec.tokens;
14
15 import jfun.parsec.Tokenizer;
16
17 /**
18  * Represents a word.
19  * @author Ben Yu
20  *
21  * 2004-11-7
22  */

23 @Deprecated JavaDoc
24 public class TokenWord extends TypedToken<TokenType>
25 implements java.io.Serializable JavaDoc{
26
27   /**
28    * gets the word value.
29    * @return the word value.
30    */

31   public final String JavaDoc getWord(){return getText();}
32   TokenWord(final String JavaDoc n){
33     super(n, TokenType.Word);
34   }
35   private static final Tokenizer nTokenizer = new Tokenizer(){
36     public Object JavaDoc toToken(final CharSequence JavaDoc cs, final int from, final int len){
37       return new TokenWord(cs.subSequence(from, from+len).toString());
38     }
39   };
40   /**
41    * gets an instance of TokenWord that parses a input range to a TokenWord.
42    * @return the tokenizer instance.
43    */

44   public static Tokenizer getTokenizer(){return nTokenizer;}
45 }
46
Popular Tags