Class JsonParser
- java.lang.Object
-
- org.htmlunit.corejs.javascript.json.JsonParser
-
public class JsonParser extends java.lang.ObjectThis class converts a stream of JSON tokens into a JSON value.See ECMA 15.12.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsonParser.ParseException
-
Constructor Summary
Constructors Constructor Description JsonParser(Context cx, Scriptable scope)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidconsume(char token)private voidconsumeWhitespace()private static intfromHex(char c)private charnextOrNumberError(int numberStart)private JsonParser.ParseExceptionnumberError(int start, int end)java.lang.ObjectparseValue(java.lang.String json)private java.lang.ObjectreadArray()private voidreadDigits()private java.lang.BooleanreadFalse()private java.lang.ObjectreadNull()private java.lang.NumberreadNumber(char c)private java.lang.ObjectreadObject()private java.lang.StringreadString()private java.lang.BooleanreadTrue()private java.lang.ObjectreadValue()
-
-
-
Field Detail
-
cx
private Context cx
-
scope
private Scriptable scope
-
pos
private int pos
-
length
private int length
-
src
private java.lang.String src
-
-
Constructor Detail
-
JsonParser
public JsonParser(Context cx, Scriptable scope)
-
-
Method Detail
-
parseValue
public java.lang.Object parseValue(java.lang.String json) throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readValue
private java.lang.Object readValue() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readObject
private java.lang.Object readObject() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readArray
private java.lang.Object readArray() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readString
private java.lang.String readString() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
fromHex
private static int fromHex(char c)
-
readNumber
private java.lang.Number readNumber(char c) throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
numberError
private JsonParser.ParseException numberError(int start, int end)
-
nextOrNumberError
private char nextOrNumberError(int numberStart) throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readDigits
private void readDigits()
-
readTrue
private java.lang.Boolean readTrue() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readFalse
private java.lang.Boolean readFalse() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
readNull
private java.lang.Object readNull() throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
consumeWhitespace
private void consumeWhitespace()
-
consume
private void consume(char token) throws JsonParser.ParseException- Throws:
JsonParser.ParseException
-
-