memgraph/tests/manual/cypher_ast.cpp

44 lines
1.0 KiB
C++
Raw Normal View History

/**
* DEPRICATED!
*
* TODO: print AST (just for one query) using Antlr's visitor or listener
* the new file name should be opencypher_ast.cpp
*/
#include <cstdlib>
#include <vector>
#include <vector>
#include "query/language/cypher/common.hpp"
#include "query/language/cypher/compiler.hpp"
#include "query/language/cypher/debug/tree_print.hpp"
#include "utils/command_line/arguments.hpp"
#include "utils/terminate_handler.hpp"
2016-11-19 00:35:29 +08:00
#include "utils/variadic/variadic.hpp"
2016-11-19 00:35:29 +08:00
using utils::println;
using std::cout;
int main(int argc, char *argv[])
{
std::set_terminate(&terminate_handler);
2016-07-18 01:32:35 +08:00
// // arguments parsing
auto arguments = all_arguments(argc, argv);
2016-07-18 01:32:35 +08:00
// // query extraction
auto queries = extract_queries(arguments);
for (auto &query : queries)
{
2016-11-19 00:35:29 +08:00
println("QUERY: ", query);
auto print_visitor = new PrintVisitor(cout);
cypher::Compiler compiler;
auto tree = compiler.syntax_tree(query);
tree.root->accept(*print_visitor);
2016-11-19 00:35:29 +08:00
println("");
}
return 0;
}