Add labels and edge type test nodes to ast

Reviewers: teon.banek

Reviewed By: teon.banek

Differential Revision: https://phabricator.memgraph.io/D343
This commit is contained in:
Mislav Bradac 2017-05-04 14:49:29 +02:00
parent 0968224a3d
commit d2f9affb4c
2 changed files with 48 additions and 3 deletions

View File

@ -487,6 +487,48 @@ class PropertyLookup : public Expression {
: Expression(uid), expression_(expression), property_(property) {}
};
class LabelsTest : public Expression {
friend class AstTreeStorage;
public:
void Accept(TreeVisitorBase &visitor) override {
if (visitor.PreVisit(*this)) {
visitor.Visit(*this);
expression_->Accept(visitor);
visitor.PostVisit(*this);
}
}
Expression *expression_ = nullptr;
std::vector<GraphDbTypes::Label> labels_;
protected:
LabelsTest(int uid, Expression *expression,
std::vector<GraphDbTypes::Label> labels)
: Expression(uid), expression_(expression), labels_(labels) {}
};
class EdgeTypeTest : public Expression {
friend class AstTreeStorage;
public:
void Accept(TreeVisitorBase &visitor) override {
if (visitor.PreVisit(*this)) {
visitor.Visit(*this);
expression_->Accept(visitor);
visitor.PostVisit(*this);
}
}
Expression *expression_ = nullptr;
std::vector<GraphDbTypes::EdgeType> edge_types_;
protected:
EdgeTypeTest(int uid, Expression *expression,
std::vector<GraphDbTypes::EdgeType> edge_types)
: Expression(uid), expression_(expression), edge_types_(edge_types) {}
};
class Function : public Expression {
friend class AstTreeStorage;

View File

@ -9,6 +9,8 @@ class Query;
class NamedExpression;
class Identifier;
class PropertyLookup;
class LabelsTest;
class EdgeTypeTest;
class Aggregation;
class Function;
class Create;
@ -57,8 +59,9 @@ using TreeVisitorBase = ::utils::Visitor<
LessOperator, GreaterOperator, LessEqualOperator, GreaterEqualOperator,
ListIndexingOperator, ListSlicingOperator, UnaryPlusOperator,
UnaryMinusOperator, IsNullOperator, Identifier, PrimitiveLiteral,
ListLiteral, PropertyLookup, Aggregation, Function, Create, Match, Return,
With, Pattern, NodeAtom, EdgeAtom, Delete, Where, SetProperty,
SetProperties, SetLabels, RemoveProperty, RemoveLabels, Merge, Unwind>;
ListLiteral, PropertyLookup, LabelsTest, EdgeTypeTest, Aggregation,
Function, Create, Match, Return, With, Pattern, NodeAtom, EdgeAtom, Delete,
Where, SetProperty, SetProperties, SetLabels, RemoveProperty, RemoveLabels,
Merge, Unwind>;
} // namespace query