JSON
in package
JSON parser and utility parsers
Tags
Table of Contents
Methods
- array() : Parser
- element() : Parser
- false() : Parser
- json() : Parser
- Fully compliant JSON parser, built entirely in Parsica. The output is compatible with PHP's native json_decode().
- member() : Parser<string|int, array{string: mixed}>
- null() : Parser
- number() : Parser
- object() : Parser
- stringLiteral() : Parser
- token() : Parser
- Apply $parser and consume all the following whitespace.
- true() : Parser
- ws() : Parser
- Whitespace
- __construct() : mixed
Methods
array()
public
static array() : Parser
Tags
Return values
Parserelement()
public
static element() : Parser
Tags
Return values
Parserfalse()
public
static false() : Parser
Tags
Return values
Parserjson()
Fully compliant JSON parser, built entirely in Parsica. The output is compatible with PHP's native json_decode().
public
static json() : Parser
It was built to illustrate the usage of Parsica on a real world format, and to benchmark Parsica against json_decode(). It will probably never reach the same performance as a C extension, so it shouldn't be used for typical production JSON parsing.
It could however be useful as a basis to expand into a custom JSON parser, for example to expand JSON with custom notations or comments, or to return a custom AST instead of json_decode()'s plain PHP objects & arrays.
To understand the terminology and the structure, have a peak at https://www.json.org/json-en.html
Tags
Return values
Parsermember()
public
static member() : Parser<string|int, array{string: mixed}>
Return values
Parser<string|int, array{string: mixed}>null()
public
static null() : Parser
Tags
Return values
Parsernumber()
public
static number() : Parser
Return values
Parserobject()
public
static object() : Parser
Tags
Return values
ParserstringLiteral()
public
static stringLiteral() : Parser
Tags
Return values
Parsertoken()
Apply $parser and consume all the following whitespace.
public
static token(Parser $parser) : Parser
Parameters
- $parser : Parser
Tags
Return values
Parsertrue()
public
static true() : Parser
Tags
Return values
Parserws()
Whitespace
public
static ws() : Parser
Tags
Return values
Parser__construct()
private
__construct() : mixed