1 8 13 package jfun.parsec.tokens; 14 15 import jfun.parsec.Tokenizer; 16 17 23 @Deprecated 24 public class TokenCharLiteral implements java.io.Serializable { 25 33 public static char tokenize(final CharSequence cs, 34 final int from, final int len){ 35 if(len == 3){ 36 return cs.charAt(from+1); 37 } 38 else if(len == 4){ 39 return cs.charAt(from+2); 40 } 41 else throw new IllegalStateException ("illegal char"); 42 } 43 private TokenCharLiteral(){} 44 private static final Tokenizer cTokenizer = new Tokenizer(){ 45 public Object toToken(final CharSequence cs, 46 final int from, final int len){ 47 return new Character (tokenize(cs, from, len)); 48 }; 49 }; 50 54 public static Tokenizer getTokenizer(){return cTokenizer;} 55 } 56 | Popular Tags |