header_utils
Loading...
Searching...
No Matches
S-Expressions

Functions that allow for parsing of simple, Lisp-style s-expressions (specifically - lists and atoms). More...

Functions

auto ghassanpl::formats::sexpressions::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 ghassanpl::formats::sexpressions::consume_atom (std::string_view &sexp_str, char end_brace=']') -> nlohmann::json
 Consumes a space-delimited word, 'string' "literal", or 14.46 number.
auto ghassanpl::formats::sexpressions::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 ghassanpl::formats::sexpressions::parse_value (std::string_view sexp_str, std::array< char, 2 > braces={ '[', ']' }) -> nlohmann::json
auto ghassanpl::formats::sexpressions::parse_atom (std::string_view sexp_str, char end_brace=']') -> nlohmann::json
auto ghassanpl::formats::sexpressions::parse_list (std::string_view sexp_str, std::array< char, 2 > braces={ '[', ']' }) -> nlohmann::json

Detailed Description

Functions that allow for parsing of simple, Lisp-style s-expressions (specifically - lists and atoms).

Uses the nlohmann::json library to store parsed values.

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", or 14.46 number.

Definition at line 41 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 100 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 113 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 31 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 32 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 30 of file sexps.h.