001/* Copyright 2006 FangYidong 002 003 Licensed under the Apache License, Version 2.0 (the "License"); 004 you may not use this file except in compliance with the License. 005 You may obtain a copy of the License at 006 007 http://www.apache.org/licenses/LICENSE-2.0 008 009 Unless required by applicable law or agreed to in writing, software 010 distributed under the License is distributed on an "AS IS" BASIS, 011 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 See the License for the specific language governing permissions and 013 limitations under the License. */ 014package org.json.simple.parser; 015 016/** 017 * @author FangYidong<fangyidong@yahoo.com.cn> 018 * @deprecated since 2.0.0, copied to a new package. 019 */ 020@Deprecated 021public class Yytoken { 022 /** 023 * description omitted. 024 */ 025 public static final int TYPE_VALUE=0;//JSON primitive value: string,number,boolean,null 026 /** 027 * description omitted. 028 */ 029 public static final int TYPE_LEFT_BRACE=1; 030 /** 031 * description omitted. 032 */ 033 public static final int TYPE_RIGHT_BRACE=2; 034 /** 035 * description omitted. 036 */ 037 public static final int TYPE_LEFT_SQUARE=3; 038 /** 039 * description omitted. 040 */ 041 public static final int TYPE_RIGHT_SQUARE=4; 042 /** 043 * description omitted. 044 */ 045 public static final int TYPE_COMMA=5; 046 /** 047 * description omitted. 048 */ 049 public static final int TYPE_COLON=6; 050 /** 051 * description omitted. 052 */ 053 public static final int TYPE_EOF=-1;//end of file 054 055 /** 056 * description omitted. 057 */ 058 public int type=0; 059 /** 060 * description omitted. 061 */ 062 public Object value=null; 063 064 /** 065 * @param type description omitted. 066 * @param value description omitted. 067 */ 068 public Yytoken(int type,Object value){ 069 this.type=type; 070 this.value=value; 071 } 072 073 public String toString(){ 074 StringBuffer sb = new StringBuffer(); 075 switch(type){ 076 case TYPE_VALUE: 077 sb.append("VALUE(").append(value).append(")"); 078 break; 079 case TYPE_LEFT_BRACE: 080 sb.append("LEFT BRACE({)"); 081 break; 082 case TYPE_RIGHT_BRACE: 083 sb.append("RIGHT BRACE(})"); 084 break; 085 case TYPE_LEFT_SQUARE: 086 sb.append("LEFT SQUARE([)"); 087 break; 088 case TYPE_RIGHT_SQUARE: 089 sb.append("RIGHT SQUARE(])"); 090 break; 091 case TYPE_COMMA: 092 sb.append("COMMA(,)"); 093 break; 094 case TYPE_COLON: 095 sb.append("COLON(:)"); 096 break; 097 case TYPE_EOF: 098 sb.append("END OF FILE"); 099 break; 100 } 101 return sb.toString(); 102 } 103}