Class JsonParser
- java.lang.Object
-
- org.htmlunit.corejs.javascript.json.JsonParser
-
public class JsonParser extends java.lang.Object
This 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 class
JsonParser.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 void
consume(char token)
private void
consumeWhitespace()
private static int
fromHex(char c)
private char
nextOrNumberError(int numberStart)
private JsonParser.ParseException
numberError(int start, int end)
java.lang.Object
parseValue(java.lang.String json)
private java.lang.Object
readArray()
private void
readDigits()
private java.lang.Boolean
readFalse()
private java.lang.Object
readNull()
private java.lang.Number
readNumber(char c)
private java.lang.Object
readObject()
private java.lang.String
readString()
private java.lang.Boolean
readTrue()
private java.lang.Object
readValue()
-
-
-
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
-
-