libdonut
2.3.2
Application framework for cross-platform game development in C++20
|
Syntactic analyzer for parsing input in the JSON5 format obtained from a json::Lexer. More...
#include <donut/json.hpp>
Classes | |
struct | ConcretePropertyVisitor |
Implementation of PropertyVisitor for freestanding classes that implement all or parts of its interface without directly inheriting from it. More... | |
struct | ConcreteValueVisitor |
Implementation of ValueVisitor for freestanding classes that implement all or parts of its interface without directly inheriting from it. More... | |
class | PropertyVisitor |
Polymorphic interface for visitation-based parsing of JSON object properties. More... | |
struct | SkipPropertyVisitor |
Implementation of PropertyVisitor that skips over the parsed property and discards the result. More... | |
struct | SkipValueVisitor |
Implementation of ValueVisitor that skips over the parsed value and discards the result. More... | |
class | ValueVisitor |
Polymorphic interface for visitation-based parsing of JSON values. More... | |
Public Member Functions | |
Parser (Lexer< It > lexer) | |
Construct a parser with an existing lexer as input. More... | |
Parser (unicode::UTF8View codePoints) requires(std | |
Construct a parser with a contiguous UTF-8 view as input. More... | |
Parser (std::u8string_view jsonString) requires(std | |
Construct a parser with a contiguous UTF-8 string as input. More... | |
Parser (std::string_view jsonString) requires(std | |
Construct a parser with a contiguous string of bytes, interpreted as UTF-8, as input. More... | |
Parser (std::istream &stream) requires(std | |
Construct a parser with an input stream as input. More... | |
Parser (std::streambuf *streambuf) requires(std | |
Construct a parser with an input stream buffer as input. More... | |
void | parseFile (ValueVisitor &visitor) |
Read a single JSON value from the input and visit it, then make sure the rest of the input only consists of whitespace. More... | |
void | parseValue (ValueVisitor &visitor) |
Read a single JSON value from the input and visit it. More... | |
void | parseObject (PropertyVisitor &visitor) |
Read a single JSON object from the input and visit each of its properties. More... | |
void | parseArray (ValueVisitor &visitor) |
Read a single JSON array from the input and visit each of its values. More... | |
void | parseFile (ValueVisitor &&visitor) |
void | parseValue (ValueVisitor &&visitor) |
void | parseObject (PropertyVisitor &&visitor) |
void | parseArray (ValueVisitor &&visitor) |
template<typename Visitor > | |
void | parseFile (Visitor visitor) |
template<typename Visitor > | |
void | parseValue (Visitor visitor) |
template<typename Visitor > | |
void | parseObject (Visitor visitor) |
template<typename Visitor > | |
void | parseArray (Visitor visitor) |
void | skipFile () |
Parse a single JSON value from the input and discard the result, then make sure the rest of the input only consists of whitespace. More... | |
void | skipValue () |
Parse a single JSON value from the input and discard the result. More... | |
Value | parseFile () |
Read a single JSON value from the input and make sure the rest of the input only consists of whitespace. More... | |
Value | parseValue () |
Read a single JSON value from the input. More... | |
Null | parseNull () |
Read a single JSON value of type Null from the input. More... | |
Boolean | parseBoolean () |
Read a single JSON value of type Boolean from the input. More... | |
String | parseString () |
Read a single JSON value of type String from the input. More... | |
Number | parseNumber () |
Read a single JSON value of type Number from the input. More... | |
Object | parseObject () |
Read a single JSON value of type Object from the input. More... | |
Array | parseArray () |
Read a single JSON value of type Array from the input. More... | |
void | advance () |
Advance the internal state of the underlying lexer by one token. More... | |
const Token & | peek () const |
Peek the next token without advancing the internal state of the underlying lexer. More... | |
Token | eat () |
Scan and consume the next token from the input. More... | |
Syntactic analyzer for parsing input in the JSON5 format obtained from a json::Lexer.
It | iterator type of the underlying input source. Must be an input iterator. |
|
inlineexplicit |
Construct a parser with an existing lexer as input.
lexer | lexer to scan JSON tokens from. |
|
inlineexplicit |
Construct a parser with a contiguous UTF-8 view as input.
codePoints | non-owning read-only view over the UTF-8 string to parse JSON tokens from. |
|
inlineexplicit |
Construct a parser with a contiguous UTF-8 string as input.
jsonString | non-owning read-only view over the UTF-8 string to parse JSON tokens from. |
|
inlineexplicit |
Construct a parser with a contiguous string of bytes, interpreted as UTF-8, as input.
jsonString | non-owning read-only view over the byte string to parse JSON tokens from. |
|
inlineexplicit |
Construct a parser with an input stream as input.
stream | input stream to parse JSON tokens from. |
|
inlineexplicit |
Construct a parser with an input stream buffer as input.
streambuf | input stream buffer to parse JSON tokens from. |
|
inline |
Read a single JSON value from the input and visit it, then make sure the rest of the input only consists of whitespace.
visitor | visitor to give the parsed value to. |
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
any | exception thrown by the visitor. |
|
inline |
Read a single JSON value from the input and visit it.
visitor | visitor to give the parsed value to. |
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
any | exception thrown by the visitor. |
|
inline |
Read a single JSON object from the input and visit each of its properties.
visitor | visitor to give each parsed property of the object to. |
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
any | exception thrown by the visitor. |
|
inline |
Read a single JSON array from the input and visit each of its values.
visitor | visitor to give each parsed value of the array to. |
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
any | exception thrown by the visitor. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Parse a single JSON value from the input and discard the result, then make sure the rest of the input only consists of whitespace.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Parse a single JSON value from the input and discard the result.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value from the input and make sure the rest of the input only consists of whitespace.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value of type Null from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value of type Boolean from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value of type String from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value of type Number from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value of type Object from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Read a single JSON value of type Array from the input.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Advance the internal state of the underlying lexer by one token.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Peek the next token without advancing the internal state of the underlying lexer.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |
|
inline |
Scan and consume the next token from the input.
This advances the internal state of the underlying lexer.
json::Error | on invalid input. |
std::bad_alloc | on allocation failure. |
any | exception thrown by the underlying input iterator. |