memgraph/cypher/codegen/cppgen.hpp

43 lines
826 B
C++
Raw Normal View History

2015-10-28 03:21:28 +08:00
#ifndef MEMGRAPH_CYPHER_CODEGEN_CPPGEN_HPP
#define MEMGRAPH_CYPHER_CODEGEN_CPPGEN_HPP
#include "cypher/visitor/traverser.hpp"
2015-10-30 08:24:01 +08:00
#include <iostream>
using std::cout;
using std::endl;
2015-10-28 03:21:28 +08:00
class CppGen : public Traverser
{
struct CreateGen : public Traverser
{
void visit(ast::Pattern& pattern) override
{
2015-10-30 08:24:01 +08:00
Traverser::visit(pattern);
}
void visit(ast::Node& node) override
{
auto next_node = node.props->next;
cout << next_node->value->idn->name;
Traverser::visit(node);
2015-10-28 03:21:28 +08:00
}
};
public:
void visit(ast::Start& start) override
{
2015-10-30 08:24:01 +08:00
Traverser::visit(start);
2015-10-28 03:21:28 +08:00
}
2015-10-30 08:24:01 +08:00
void visit(ast::Create& create) override
2015-10-28 03:21:28 +08:00
{
2015-10-29 05:55:57 +08:00
auto create_gen = CreateGen();
create.accept(create_gen);
2015-10-28 03:21:28 +08:00
};
};
#endif