-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add query file and direct query to verifier cli
- Loading branch information
Showing
7 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <drivers/driver.h> | ||
#include <nlohmann/json.hpp> | ||
#include "query_json_loader.h" | ||
|
||
namespace aaltitoad { | ||
auto load_query_json_file(const std::string& json_file, std::initializer_list<expr::symbol_table_ref_t> environments) -> std::vector<ctl::compiler::compiled_expr_t> { | ||
try { | ||
std::vector<ctl::compiler::compiled_expr_t> result{}; | ||
ctl::compiler c{environments}; | ||
std::ifstream f(json_file); | ||
auto data = nlohmann::json::parse(f); | ||
for(auto& q : data) { | ||
spdlog::trace("compiling query {0}", q["query"]); | ||
result.emplace_back(c.compile(q["query"])); | ||
} | ||
return result; | ||
} catch (std::exception &e) { | ||
spdlog::error("unable to parse json file {0}: {1}", json_file, e.what()); | ||
throw e; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef AALTITOAD_QUERY_JSON_LOADER_H | ||
#define AALTITOAD_QUERY_JSON_LOADER_H | ||
#include <ctl_compiler.h> | ||
|
||
namespace aaltitoad { | ||
auto load_query_json_file(const std::string& json_file, std::initializer_list<expr::symbol_table_ref_t> environments) -> std::vector<ctl::compiler::compiled_expr_t>; | ||
} | ||
|
||
#endif //AALTITOAD_QUERY_JSON_LOADER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters