aboutsummaryrefslogtreecommitdiff
path: root/src/org/json/simple/parser/Yytoken.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/json/simple/parser/Yytoken.java')
-rw-r--r--src/org/json/simple/parser/Yytoken.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/org/json/simple/parser/Yytoken.java b/src/org/json/simple/parser/Yytoken.java
new file mode 100644
index 0000000..d67dbae
--- /dev/null
+++ b/src/org/json/simple/parser/Yytoken.java
@@ -0,0 +1,60 @@
1/*
2 * $Id: Yytoken.java,v 1.1 2006/04/15 14:10:48 platform Exp $
3 * Created on 2006-4-15
4 */
5package org.json.simple.parser;
6
7/**
8 * @author FangYidong<fangyidong@yahoo.com.cn>
9 */
10public class Yytoken {
11 public static final int TYPE_VALUE = 0;// JSON primitive value:
12 // string,number,boolean,null
13 public static final int TYPE_LEFT_BRACE = 1;
14 public static final int TYPE_RIGHT_BRACE = 2;
15 public static final int TYPE_LEFT_SQUARE = 3;
16 public static final int TYPE_RIGHT_SQUARE = 4;
17 public static final int TYPE_COMMA = 5;
18 public static final int TYPE_COLON = 6;
19 public static final int TYPE_EOF = -1;// end of file
20
21 public int type = 0;
22 public Object value = null;
23
24 public Yytoken(final int type, final Object value) {
25 this.type = type;
26 this.value = value;
27 }
28
29 @Override
30 public String toString() {
31 final StringBuffer sb = new StringBuffer();
32 switch (this.type) {
33 case TYPE_VALUE:
34 sb.append("VALUE(").append(this.value).append(")");
35 break;
36 case TYPE_LEFT_BRACE:
37 sb.append("LEFT BRACE({)");
38 break;
39 case TYPE_RIGHT_BRACE:
40 sb.append("RIGHT BRACE(})");
41 break;
42 case TYPE_LEFT_SQUARE:
43 sb.append("LEFT SQUARE([)");
44 break;
45 case TYPE_RIGHT_SQUARE:
46 sb.append("RIGHT SQUARE(])");
47 break;
48 case TYPE_COMMA:
49 sb.append("COMMA(,)");
50 break;
51 case TYPE_COLON:
52 sb.append("COLON(:)");
53 break;
54 case TYPE_EOF:
55 sb.append("END OF FILE");
56 break;
57 }
58 return sb.toString();
59 }
60}