⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsonparser.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   JSONParser.java

package org.json.simple.parser;

import java.io.Reader;
import java.util.Stack;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

// Referenced classes of package org.json.simple.parser:
//			Yylex, Yytoken

public class JSONParser
{

	public static final int S_INIT = 0;
	public static final int S_IN_FINISHED_VALUE = 1;
	public static final int S_IN_OBJECT = 2;
	public static final int S_IN_ARRAY = 3;
	public static final int S_PASSED_PAIR_KEY = 4;
	public static final int S_IN_ERROR = -1;

	public JSONParser()
	{
	}

	private int peekStatus(Stack statusStack)
	{
		if (statusStack.size() == 0)
		{
			return -1;
		} else
		{
			Integer status = (Integer)statusStack.peek();
			return status.intValue();
		}
	}

	public Object parse(Reader in)
		throws Exception
	{
		Stack statusStack;
		Stack valueStack;
		Yylex lexer;
		Yytoken token;
		int status;
		statusStack = new Stack();
		valueStack = new Stack();
		lexer = new Yylex(in);
		token = null;
		status = 0;
_L9:
		token = lexer.yylex();
		if (token == null)
			token = new Yytoken(-1, null);
		status;
		JVM INSTR tableswitch -1 4: default 854
	//	               -1 852
	//	               0 96
	//	               1 232
	//	               2 248
	//	               3 637
	//	               4 396;
		   goto _L1 _L2 _L3 _L4 _L5 _L6 _L7
_L1:
		break; /* Loop/switch isn't completed */
_L3:
		switch (token.type)
		{
		case 0: // '\0'
			status = 1;
			statusStack.push(new Integer(status));
			valueStack.push(token.value);
			break;

		case 1: // '\001'
			status = 2;
			statusStack.push(new Integer(status));
			valueStack.push(new JSONObject());
			break;

		case 3: // '\003'
			status = 3;
			statusStack.push(new Integer(status));
			valueStack.push(new JSONArray());
			break;

		case 2: // '\002'
		default:
			status = -1;
			break;
		}
		break; /* Loop/switch isn't completed */
_L4:
		if (token.type == -1)
			return valueStack.pop();
		return null;
_L5:
		switch (token.type)
		{
		case 0: // '\0'
			if (token.value instanceof String)
			{
				String key = (String)token.value;
				valueStack.push(key);
				status = 4;
				statusStack.push(new Integer(status));
			} else
			{
				status = -1;
			}
			break;

		case 2: // '\002'
			if (valueStack.size() > 1)
			{
				statusStack.pop();
				JSONObject map = (JSONObject)valueStack.pop();
				map.compactify(-0.9F);
				status = peekStatus(statusStack);
			} else
			{
				status = 1;
			}
			break;

		default:
			status = -1;
			break;

		case 5: // '\005'
			break;
		}
		break; /* Loop/switch isn't completed */
_L7:
		switch (token.type)
		{
		case 0: // '\0'
		{
			statusStack.pop();
			String key = (String)valueStack.pop();
			JSONObject parent = (JSONObject)valueStack.peek();
			parent.put(key, token.value);
			status = peekStatus(statusStack);
			break;
		}

		case 3: // '\003'
		{
			statusStack.pop();
			String key = (String)valueStack.pop();
			JSONObject parent = (JSONObject)valueStack.peek();
			JSONArray newArray = new JSONArray();
			parent.put(key, newArray);
			status = 3;
			statusStack.push(new Integer(status));
			valueStack.push(newArray);
			break;
		}

		case 1: // '\001'
		{
			statusStack.pop();
			String key = (String)valueStack.pop();
			JSONObject parent = (JSONObject)valueStack.peek();
			JSONObject newObject = new JSONObject();
			parent.put(key, newObject);
			status = 2;
			statusStack.push(new Integer(status));
			valueStack.push(newObject);
			break;
		}

		case 2: // '\002'
		case 4: // '\004'
		case 5: // '\005'
		default:
		{
			status = -1;
			break;
		}

		case 6: // '\006'
			break;
		}
		break; /* Loop/switch isn't completed */
_L6:
		switch (token.type)
		{
		case 0: // '\0'
		{
			JSONArray val = (JSONArray)valueStack.peek();
			val.add(token.value);
			break;
		}

		case 4: // '\004'
		{
			if (valueStack.size() > 1)
			{
				statusStack.pop();
				valueStack.pop();
				status = peekStatus(statusStack);
			} else
			{
				status = 1;
			}
			break;
		}

		case 1: // '\001'
		{
			JSONArray val = (JSONArray)valueStack.peek();
			JSONObject newObject = new JSONObject();
			val.add(newObject);
			status = 2;
			statusStack.push(new Integer(status));
			valueStack.push(newObject);
			break;
		}

		case 3: // '\003'
		{
			JSONArray val = (JSONArray)valueStack.peek();
			JSONArray newArray = new JSONArray();
			val.add(newArray);
			status = 3;
			statusStack.push(new Integer(status));
			valueStack.push(newArray);
			break;
		}

		case 2: // '\002'
		default:
		{
			status = -1;
			break;
		}

		case 5: // '\005'
			break;
		}
		break; /* Loop/switch isn't completed */
_L2:
		return null;
		if (status == -1)
			return null;
		if (token.type != -1) goto _L9; else goto _L8
_L8:
		break MISSING_BLOCK_LABEL_879;
		Exception e;
		e;
		throw e;
		return null;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -