parser_of_json 0.1.0

A parser for a JSON-type structure
Documentation
/// Structure of the JSON-like grammar
json = _{ SOI ~ WHITESPACE? ~ value ~ WHITESPACE? ~ EOI }

/// A value can be an object, array, string, number, boolean, or null
value = { object | array | string | number | boolean | null }

/// An object is a collection of key-value pairs enclosed in curly braces
object = { "{" ~ WHITESPACE? ~ pair_key_value? ~ WHITESPACE? ~ "}" }

/// An array is a collection of values enclosed in square brackets
array = {  "[" ~ WHITESPACE? ~ element_list? ~ WHITESPACE? ~ "]" }

/// A list of elements in an array
element_list = _{value ~ (WHITESPACE? ~ "," ~ WHITESPACE? ~ value)*}

/// A number can be an integer or a floating-point number
number = @{"-"? ~ int ~ double?}

/// An integer is a sequence of digits
int = { "0" | ASCII_NONZERO_DIGIT ~ ASCII_DIGIT* }

/// A floating-point number has a decimal point followed by digits
double = { "." ~ ASCII_DIGIT+ }

/// A boolean is either true or false
boolean = { "true" | "false" }

/// Represents a null value
null = { "null" }

/// A list of key-value pairs in an object
pair_key_value = _{key_value ~ (WHITESPACE? ~ "," ~ WHITESPACE? ~ key_value)*}

/// A key-value pair in an object
key_value = { string ~ WHITESPACE* ~ ":" ~ WHITESPACE* ~ value  }

/// A string is a sequence of characters enclosed in double quotes
string = { "\"" ~ (!"\"" ~ ANY)* ~ "\"" }

/// Whitespace characters (spaces, tabs, newlines)
WHITESPACE = _{ (" " | "\t" | "\r" | "\n")+ }