aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/json/jsonparse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/json/jsonparse.cc')
-rw-r--r--frontend/json/jsonparse.cc37
1 files changed, 12 insertions, 25 deletions
diff --git a/frontend/json/jsonparse.cc b/frontend/json/jsonparse.cc
index 277e602a..7d9e9dcf 100644
--- a/frontend/json/jsonparse.cc
+++ b/frontend/json/jsonparse.cc
@@ -795,39 +795,26 @@ void json_import(Context *ctx, string modname, JsonNode *node)
}
check_all_nets_driven(ctx);
}
+}; // End Namespace JsonParser
-struct JsonFrontend
+void parse_json_file(std::istream &f, std::string &filename, Context *ctx)
{
- // JsonFrontend() : Frontend("json", "read JSON file") { }
- JsonFrontend(void) {}
- virtual void help() {}
- virtual void execute(std::istream *&f, std::string &filename, Context *ctx)
- {
- // log_header(ctx, "Executing JSON frontend.\n");
+ using namespace JsonParser;
- JsonNode root(*f);
+ JsonNode root(f);
- if (root.type != 'D')
- log_error("JSON root node is not a dictionary.\n");
+ if (root.type != 'D')
+ log_error("JSON root node is not a dictionary.\n");
- if (root.data_dict.count("modules") != 0) {
- JsonNode *modules = root.data_dict.at("modules");
+ if (root.data_dict.count("modules") != 0) {
+ JsonNode *modules = root.data_dict.at("modules");
- if (modules->type != 'D')
- log_error("JSON modules node is not a dictionary.\n");
+ if (modules->type != 'D')
+ log_error("JSON modules node is not a dictionary.\n");
- for (auto &it : modules->data_dict)
- json_import(ctx, it.first, it.second);
- }
+ for (auto &it : modules->data_dict)
+ json_import(ctx, it.first, it.second);
}
-}; // JsonFrontend;
-
-}; // End Namespace JsonParser
-
-void parse_json_file(std::istream *&f, std::string &filename, Context *ctx)
-{
- auto *parser = new JsonParser::JsonFrontend();
- parser->execute(f, filename, ctx);
log_info("Checksum: 0x%08x\n", ctx->checksum());
log_break();