header_utils
Loading...
Searching...
No Matches
ghassanpl::formats::sexpressions Namespace Reference

Implementation. More...

Functions

auto consume_value (std::string_view &sexp_str, std::array< char, 2 > braces={ '[', ']' }) -> nlohmann::json
 Consumes [list] or atom; a ',' (comma character) is considered its own atom.
 
auto consume_atom (std::string_view &sexp_str, char end_brace=']') -> nlohmann::json
 Consumes a space-delimited word, ‘'string’ "literal", or14.46` number.
 
auto consume_list (std::string_view &sexp_str, std::array< char, 2 > braces={ '[', ']' }) -> nlohmann::json
 Consumes space-delimited elements until close-brace or end-of-string.
 
auto parse_value (std::string_view sexp_str, std::array< char, 2 > braces={ '[', ']' }) -> nlohmann::json
 
auto parse_atom (std::string_view sexp_str, char end_brace=']') -> nlohmann::json
 
auto parse_list (std::string_view sexp_str, std::array< char, 2 > braces={ '[', ']' }) -> nlohmann::json
 

Detailed Description

Implementation.

Function Documentation

◆ consume_atom()

auto ghassanpl::formats::sexpressions::consume_atom ( std::string_view &  sexp_str,
char  end_brace = ']' 
) -> nlohmann::json
inline

Consumes a space-delimited word, ‘'string’ "literal", or14.46` number.

Definition at line 33 of file sexps.h.

◆ consume_list()

auto ghassanpl::formats::sexpressions::consume_list ( std::string_view &  sexp_str,
std::array< char, 2 >  braces = { '[', ']' } 
) -> nlohmann::json
inline

Consumes space-delimited elements until close-brace or end-of-string.

sexp_str MUST NOT start with open-brace.

Definition at line 91 of file sexps.h.

◆ consume_value()

auto ghassanpl::formats::sexpressions::consume_value ( std::string_view &  sexp_str,
std::array< char, 2 >  braces = { '[', ']' } 
) -> nlohmann::json
inline

Consumes [list] or atom; a ',' (comma character) is considered its own atom.

Definition at line 104 of file sexps.h.

◆ parse_atom()

auto ghassanpl::formats::sexpressions::parse_atom ( std::string_view  sexp_str,
char  end_brace = ']' 
) -> nlohmann::json
inline

Definition at line 25 of file sexps.h.

◆ parse_list()

auto ghassanpl::formats::sexpressions::parse_list ( std::string_view  sexp_str,
std::array< char, 2 >  braces = { '[', ']' } 
) -> nlohmann::json
inline

Definition at line 26 of file sexps.h.

◆ parse_value()

auto ghassanpl::formats::sexpressions::parse_value ( std::string_view  sexp_str,
std::array< char, 2 >  braces = { '[', ']' } 
) -> nlohmann::json
inline

Definition at line 24 of file sexps.h.