17 #ifndef COMMON_JSON_PARSER_HH
18 #define COMMON_JSON_PARSER_HH
20 #include<unordered_map>
55 bool check(
char e, std::string
const& oth =
"", std::unordered_map<char,std::string>
const& names_override = {});
56 bool inline check(
char e, std::unordered_map<char,std::string>
const& names_override)
57 {
return check(e,
"", names_override);}
74 static int const none = -3455678;
77 int peek(
bool ignore_spaces =
true);
78 int get(
bool ignore_spaces =
true);
99 static std::string
const&
escape(
char);
100 static std::string
escape(std::string
const&);
101 static std::string
unescape(std::string
const&,
bool quote =
false);
bool error()
Definition: parser.hh:84
int _current_char
Definition: parser.hh:75
bool _only_metadata
Definition: parser.hh:73
std::list< uint_or_string_t > _error_path
Attempt to give localisation of parsing error (only set if an error occured).
Definition: parser.hh:69
static std::string const & escape(char)
bool check(char e, std::unordered_map< char, std::string > const &names_override)
Definition: parser.hh:56
std::istream & _in
Definition: parser.hh:71
int get(bool ignore_spaces=true)
bool check(char e, std::string const &oth="", std::unordered_map< char, std::string > const &names_override={})
position_t position_of(int pos)
int peek(bool ignore_spaces=true)
static std::string unescape(std::string const &, bool quote=false)
static std::string const true_repr
Definition: parser.hh:42
static int const none
Definition: parser.hh:74
std::string extract_and_unescape_string(bool quote=true)
static std::string const null_repr
Definition: parser.hh:41
std::stringstream _error_message
Error message if on error occured.
Definition: parser.hh:65
static std::string const false_repr
Definition: parser.hh:43
parser_t(std::istream &i, bool only_metadata=false)
Definition: parser.hh:92
static std::ostream & escape_and_put(std::ostream &, std::string const &)
bool _error
Whether on error occured.
Definition: parser.hh:62
static std::string escape(std::string const &)
position_t position()
Definition: parser.hh:95
node_t * parse_constant(std::string const &)
std::list< uint_or_string_t > move_error_path()
Definition: parser.hh:88
std::string error_message()
Definition: parser.hh:85
std::ostream & json(automaton_t aut, std::ostream &out)
node_t * parse(std::istream &, bool stop_after_metadata=false)
Main namespace of Awali.
Definition: ato.hh:22
int line
Only positive values are allowed.
Definition: parser.hh:32
static position_t tellg_unsupported()
Definition: parser.hh:35
bool is_tellg_unsupported()
Definition: parser.hh:36
int column
Definition: parser.hh:33
static position_t eof()
Definition: parser.hh:37
bool is_eof()
Definition: parser.hh:38