Return list is expanded, this commit is related to T45

This commit is contained in:
Marko Budiselic 2016-06-03 16:48:23 +02:00
parent c4e0e68e0b
commit 83880f8244
6 changed files with 24 additions and 7 deletions

View File

@ -22,10 +22,11 @@ endfunction(list_includes)
# custom targets
# move test data files to a build directory
# move test data data to the build directory
if (UNIX)
set(test_data_src "${CMAKE_SOURCE_DIR}/tests/data")
set(test_data_dst "${CMAKE_BINARY_DIR}/tests/data")
set(test_data "tests/data")
set(test_data_src "${CMAKE_SOURCE_DIR}/${test_data}")
set(test_data_dst "${CMAKE_BINARY_DIR}/${test_data}")
add_custom_target (test_data
COMMAND rm -rf ${test_data_dst}
COMMAND cp -r ${test_data_src} ${test_data_dst}

View File

@ -17,3 +17,4 @@
#include "queries.hpp"
#include "start.hpp"
#include "set.hpp"
#include "expr.hpp"

View File

@ -41,6 +41,7 @@ struct Relationship;
struct Node;
struct LabelList;
struct Pattern;
struct PatternExpr;
struct Return;
struct ReturnList;
@ -66,7 +67,7 @@ struct SetList;
struct AstVisitor : public Visitor<Accessor, Boolean, Float, Identifier, Alias,
Integer, String, Property, And, Or, Lt, Gt, Ge, Le, Eq, Ne, Plus, Minus,
Star, Slash, Rem, PropertyList, RelationshipList, Relationship, Node,
RelationshipSpecs, LabelList, ReturnList, Pattern, Match, ReadQuery,
RelationshipSpecs, LabelList, ReturnList, Pattern, PatternExpr, Match, ReadQuery,
Start, Where, WriteQuery, Create, Return, Distinct, Delete,
DeleteQuery, UpdateQuery, Set, SetKey, SetValue, SetElement, SetList> {};

View File

@ -36,4 +36,11 @@ struct BinaryExpr : public VisitableExpr<Derived>
Expr* right;
};
struct PatternExpr : public VisitableExpr<PatternExpr>
{
PatternExpr(Pattern* pattern) : pattern(pattern) {}
Pattern* pattern;
};
}

View File

@ -360,13 +360,19 @@ expr(E) ::= expr(L) REM expr(R). {
E = ast->create<ast::Rem>(L, R);
}
expr(E) ::= idn(I). {
E = ast->create<ast::Accessor>(I, nullptr);
}
expr(E) ::= idn(I) DOT idn(P). {
E = ast->create<ast::Accessor>(I, P);
}
expr(E) ::= idn(I). {
E = ast->create<ast::Accessor>(I, nullptr);
}
// this production produces parser conflicts TODO: findout why
// the intention os to add patter in the RETURN statement
// expr(E) ::= pattern(P). {
// E = ast->create<ast::PatternExpr>(P);
// }
%type idn {ast::Identifier*}

View File

@ -0,0 +1 @@
MATCH (test) RETURN test, test.property, "test" = "test", test.property > 5