Unneeded namespace qualification for json::parse

This commit is contained in:
Danny Robson 2012-04-12 14:08:41 +10:00
parent 0fe4726d9f
commit a13c1b9183

View File

@ -234,48 +234,46 @@ struct parse_context {
* Node * Node
*/ */
namespace json { std::unique_ptr<json::node>
std::unique_ptr<json::node> json::parse (const boost::filesystem::path &path)
parse (const boost::filesystem::path &path) { return parse ((const char *)slurp (path)); }
{ return parse ((const char *)slurp (path)); }
std::unique_ptr<json::node> std::unique_ptr<json::node>
parse (const std::string &path) json::parse (const std::string &path)
{ return parse (path.c_str (), path.c_str () + path.size ()); } { return parse (path.c_str (), path.c_str () + path.size ()); }
std::unique_ptr<json::node> std::unique_ptr<json::node>
parse (const char *start, json::parse (const char *start,
const char *stop) { const char *stop) {
bool __success = true; bool __success = true;
json::node *__root = NULL; json::node *__root = NULL;
size_t top = 0; size_t top = 0;
int cs; int cs;
deque <int> fsmstack; deque <int> fsmstack;
deque <parse_context> nodestack; deque <parse_context> nodestack;
const char *p = start, const char *p = start,
*pe = stop, *pe = stop,
*eof = stop; *eof = stop;
%%write init; %%write init;
%%write exec; %%write exec;
if (!__success) if (!__success)
throw error ("unable to parse json"); throw error ("unable to parse json");
//__root->print (cout) << endl; //__root->print (cout) << endl;
assert (*__root == *__root); assert (*__root == *__root);
return std::unique_ptr<json::node> (__root); return std::unique_ptr<json::node> (__root);
}
std::unique_ptr<json::node>
parse (const char *start)
{ return parse (start, start + strlen (start)); }
} }
std::unique_ptr<json::node>
json::parse (const char *start)
{ return parse (start, start + strlen (start)); }
const json::object& const json::object&
json::node::to_object (void) const json::node::to_object (void) const
{ throw error ("node is not an object"); } { throw error ("node is not an object"); }