Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | * $Id: Yytoken.java,v 1.1 2006/04/15 14:10:48 platform Exp $ |
michael@0 | 3 | * Created on 2006-4-15 |
michael@0 | 4 | */ |
michael@0 | 5 | package org.json.simple.parser; |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * @author FangYidong<fangyidong@yahoo.com.cn> |
michael@0 | 9 | */ |
michael@0 | 10 | public class Yytoken { |
michael@0 | 11 | public static final int TYPE_VALUE=0;//JSON primitive value: string,number,boolean,null |
michael@0 | 12 | public static final int TYPE_LEFT_BRACE=1; |
michael@0 | 13 | public static final int TYPE_RIGHT_BRACE=2; |
michael@0 | 14 | public static final int TYPE_LEFT_SQUARE=3; |
michael@0 | 15 | public static final int TYPE_RIGHT_SQUARE=4; |
michael@0 | 16 | public static final int TYPE_COMMA=5; |
michael@0 | 17 | public static final int TYPE_COLON=6; |
michael@0 | 18 | public static final int TYPE_EOF=-1;//end of file |
michael@0 | 19 | |
michael@0 | 20 | public int type=0; |
michael@0 | 21 | public Object value=null; |
michael@0 | 22 | |
michael@0 | 23 | public Yytoken(int type,Object value){ |
michael@0 | 24 | this.type=type; |
michael@0 | 25 | this.value=value; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | public String toString(){ |
michael@0 | 29 | StringBuffer sb = new StringBuffer(); |
michael@0 | 30 | switch(type){ |
michael@0 | 31 | case TYPE_VALUE: |
michael@0 | 32 | sb.append("VALUE(").append(value).append(")"); |
michael@0 | 33 | break; |
michael@0 | 34 | case TYPE_LEFT_BRACE: |
michael@0 | 35 | sb.append("LEFT BRACE({)"); |
michael@0 | 36 | break; |
michael@0 | 37 | case TYPE_RIGHT_BRACE: |
michael@0 | 38 | sb.append("RIGHT BRACE(})"); |
michael@0 | 39 | break; |
michael@0 | 40 | case TYPE_LEFT_SQUARE: |
michael@0 | 41 | sb.append("LEFT SQUARE([)"); |
michael@0 | 42 | break; |
michael@0 | 43 | case TYPE_RIGHT_SQUARE: |
michael@0 | 44 | sb.append("RIGHT SQUARE(])"); |
michael@0 | 45 | break; |
michael@0 | 46 | case TYPE_COMMA: |
michael@0 | 47 | sb.append("COMMA(,)"); |
michael@0 | 48 | break; |
michael@0 | 49 | case TYPE_COLON: |
michael@0 | 50 | sb.append("COLON(:)"); |
michael@0 | 51 | break; |
michael@0 | 52 | case TYPE_EOF: |
michael@0 | 53 | sb.append("END OF FILE"); |
michael@0 | 54 | break; |
michael@0 | 55 | } |
michael@0 | 56 | return sb.toString(); |
michael@0 | 57 | } |
michael@0 | 58 | } |