org.apache.tomcat.util.json.JSONParser.jjt Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
options {
CHOICE_AMBIGUITY_CHECK=3;
OTHER_AMBIGUITY_CHECK=2;
ERROR_REPORTING=true;
JAVA_UNICODE_ESCAPE=true;
UNICODE_INPUT=true;
IGNORE_CASE=true;
SUPPORT_CLASS_VISIBILITY_PUBLIC=true;
FORCE_LA_CHECK=true;
CACHE_TOKENS=true;
SANITY_CHECK=true;
STATIC=false;
}
PARSER_BEGIN(JSONParser)
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.json;
/**
* Basic JSON parser generated by JavaCC. It consumes the input provided through the constructor when
* {@code parseObject()}, {@code parseList()}, or {@code parse()} are called, and there is no way to directly
* reset the state.
*/
@SuppressWarnings("all") // Ignore warnings in generated code
public class JSONParser {
protected static final org.apache.tomcat.util.res.StringManager sm = org.apache.tomcat.util.res.StringManager.getManager(JSONParser.class);
private boolean nativeNumbers = false;
public JSONParser(String input) {
this(new java.io.StringReader(input));
}
/**
* Parses a JSON object into a Java {@code Map}.
*/
public java.util.LinkedHashMap parseObject() throws ParseException {
java.util.LinkedHashMap toReturn = object();
if (!ensureEOF()) {
throw new IllegalStateException(sm.getString("parser.expectedEOF"));
}
return toReturn;
}
/**
* Parses a JSON array into a Java {@code List}.
*/
public java.util.ArrayList
© 2015 - 2024 Weber Informatics LLC | Privacy Policy