A Rust library to declaratively implement parsers that are based on Packrat Parsing.
The following code implements a parser for a JSON subset format: ```rust use textparse::{ components::{AnyChar, Char, Digit, Eos, Items, NonEmpty, Not, Str, While, Whitespace}, Parse, Parser, Position, Span, };
struct JsonValue(WithoutWhitespaces
enum JsonValueInner { Null(JsonNull), String(JsonString), Number(JsonNumber), Array(JsonArray), Object(JsonObject), }
struct JsonNull(Str<'n', 'u', 'l', 'l'>);
struct JsonString(Char<'"'>, While<(Not
struct JsonNumber(NonEmpty
struct JsonArray(Char<'['>, Csv
struct JsonObject(Char<'{'>, Csv
struct JsonObjectItem(WithoutWhitespaces
struct Csv
struct WithoutWhitespaces
You can run the above parser via examples/checkjson.rs as follows: ```console $ echo '["foo",null,{"key": "value"}, 123]' | cargo run --example checkjson OK: the input string is a JSON text.
$ echo '["foo" null]' | cargo run --example check_json
Error: expected one of ',', or ']'
-->