C# Class Jurassic.Library.JSONParser

Converts a series of JSON tokens into a JSON object.
Exibir arquivo Open project: paulbartrum/jurassic Class Usage Examples

Public Methods

Method Description
JSONParser ( ScriptEngine engine, JSONLexer lexer ) : System

Creates a JSONParser instance with the given lexer supplying the tokens.

Parse ( ) : object

Parses the JSON text (optionally applying the reviver function) and returns the resulting value.

Private Methods

Method Description
Consume ( ) : void

Discards the current token and reads the next one.

Expect ( Jurassic.Compiler.Token token ) : void

Indicates that the next token is identical to the given one. Throws an exception if this is not the case. Consumes the token.

ExpectIdentifier ( ) : string

Indicates that the next token should be an identifier. Throws an exception if this is not the case. Consumes the token.

ParseArrayLiteral ( ) : ArrayInstance

Parses an array literal (e.g. "[1, 2]").

ParseObjectLiteral ( ) : ObjectInstance

Parses an object literal (e.g. "{a: 5}").

ParseValue ( ) : object

Parses a value.

Method Details

JSONParser() public method

Creates a JSONParser instance with the given lexer supplying the tokens.
public JSONParser ( ScriptEngine engine, JSONLexer lexer ) : System
engine ScriptEngine The associated script engine.
lexer JSONLexer The lexical analyser that provides the tokens.
return System

Parse() public method

Parses the JSON text (optionally applying the reviver function) and returns the resulting value.
public Parse ( ) : object
return object