2016-01-27 06:40:11 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-01-28 07:29:38 +08:00
|
|
|
#include "cypher/codegen/cppgen.hpp"
|
|
|
|
#include "cypher/compiler.hpp"
|
|
|
|
#include "cypher/ast/ast.hpp"
|
|
|
|
|
2016-01-27 06:40:11 +08:00
|
|
|
class QueryTraverser
|
|
|
|
{
|
2016-01-28 07:29:38 +08:00
|
|
|
public:
|
|
|
|
QueryTraverser() = default;
|
|
|
|
|
|
|
|
void build_tree(const std::string& query)
|
|
|
|
{
|
|
|
|
tree = compiler.syntax_tree(query);
|
|
|
|
}
|
|
|
|
|
|
|
|
void traverse()
|
|
|
|
{
|
|
|
|
tree.root->accept(traverser);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ast::Ast tree;
|
|
|
|
cypher::Compiler compiler;
|
|
|
|
CppGen traverser;
|
2016-01-27 06:40:11 +08:00
|
|
|
};
|