expression can be eather pattern expression or value expression

This commit is contained in:
Marko Budiselic 2016-06-26 12:27:26 +01:00
parent b5536d70fa
commit 04319c09e3
5 changed files with 21 additions and 9 deletions

View File

@ -141,6 +141,7 @@ EXECUTE_PROCESS(
# add main executable
add_executable(memgraph src/memgraph.cpp)
add_dependencies(memgraph cypher_lib)
# link libraries
target_link_libraries(memgraph Threads::Threads)

View File

@ -390,11 +390,11 @@ value_expr(E) ::= BOOL(V). {
E = ast->create<ast::Boolean>(value);
}
// %type pattern_expr {ast::Expr*}
//
// patter_expr(E) ::= pattern(P). {
// E = ast->create<ast::PatternExpr>(P);
// }
%type pattern_expr {ast::Expr*}
pattern_expr(E) ::= pattern(P). {
E = ast->create<ast::PatternExpr>(P);
}
%type expr {ast::Expr*}
@ -402,9 +402,9 @@ expr(E) ::= value_expr(V). {
E = V;
}
// expr(E) ::= patter_expr(P). {
// E = P;
// }
expr(E) ::= pattern_expr(P). {
E = P;
}
//%type alias {ast::Alias*}
//

View File

@ -106,6 +106,12 @@ public:
Traverser::visit(pattern);
}
void visit(ast::PatternExpr& pattern_expr) override
{
auto entry = printer.advance("Pattern Expression");
Traverser::visit(pattern_expr);
}
void visit(ast::Node& node) override
{
auto entry = printer.advance("Node");

View File

@ -39,6 +39,11 @@ public:
accept(pattern.next);
}
void visit(ast::PatternExpr& pattern_expr) override
{
accept(pattern_expr.pattern);
}
void visit(ast::Node& node) override
{
accept(node.idn);

View File

@ -1 +1 @@
# MATCH (p:Personnel)-[:CREATED]->(o:Opportunity)-[:HAS_MATCH]->(c:Company {id: "321"}) RETURN (a:Account {id: "123"})-[:IS]->(p)
MATCH (p:Personnel)-[:CREATED]->(o:Opportunity)-[:HAS_MATCH]->(c:Company {id: "321"}) RETURN (a:Account {id: "123"})-[:IS]->(p)