This project has retired. For details please refer to its
Attic page.
Yytoken xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.commons.impl.json.parser;
2021/**22 * (Taken from JSON.simple <http://code.google.com/p/json-simple/> and modified23 * for OpenCMIS.)24 * 25 * @author FangYidong<fangyidong@yahoo.com.cn>26 */27publicclassYytoken {
28publicstaticfinalint TYPE_VALUE = 0;// JSON primitive value:29// string,number,boolean,null30publicstaticfinalint TYPE_LEFT_BRACE = 1;
31publicstaticfinalint TYPE_RIGHT_BRACE = 2;
32publicstaticfinalint TYPE_LEFT_SQUARE = 3;
33publicstaticfinalint TYPE_RIGHT_SQUARE = 4;
34publicstaticfinalint TYPE_COMMA = 5;
35publicstaticfinalint TYPE_COLON = 6;
36publicstaticfinalint TYPE_EOF = -1;// end of file3738publicint type = 0;
39public Object value = null;
4041publicYytoken(int type, Object value) {
42this.type = type;
43this.value = value;
44 }
4546public String toString() {
47 StringBuilder sb = new StringBuilder();
48switch (type) {
49case TYPE_VALUE:
50 sb.append("VALUE(").append(value).append(")");
51break;
52case TYPE_LEFT_BRACE:
53 sb.append("LEFT BRACE({)");
54break;
55case TYPE_RIGHT_BRACE:
56 sb.append("RIGHT BRACE(})");
57break;
58case TYPE_LEFT_SQUARE:
59 sb.append("LEFT SQUARE([)");
60break;
61case TYPE_RIGHT_SQUARE:
62 sb.append("RIGHT SQUARE(])");
63break;
64case TYPE_COMMA:
65 sb.append("COMMA(,)");
66break;
67case TYPE_COLON:
68 sb.append("COLON(:)");
69break;
70case TYPE_EOF:
71 sb.append("END OF FILE");
72break;
73 }
74return sb.toString();
75 }
76 }