Skip to content

Commit

Permalink
add match3/4 --
Browse files Browse the repository at this point in the history
  • Loading branch information
AEsir777 committed Sep 11, 2023
1 parent 510d804 commit b0dcc17
Show file tree
Hide file tree
Showing 7 changed files with 1,729 additions and 1,102 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ tools/python_api/test/test_PYTHON_CSV.csv

# antlr4 jar
scripts/antlr4/antlr4.jar
# .antlr
src/antlr4/.antlr/

# macOS
.DS_Store
Expand Down
6 changes: 2 additions & 4 deletions src/antlr4/Cypher.g4
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ oC_SingleQuery
oC_SinglePartQuery
: ( oC_ReadingClause SP? )* oC_Return
| ( ( oC_ReadingClause SP? )* oC_UpdatingClause ( SP? oC_UpdatingClause )* ( SP? oC_Return )? )
| ( oC_ReadingClause SP? )* { notifyQueryNotConcludeWithReturn($ctx->start); }
| ( oC_ReadingClause SP? )+ { notifyQueryNotConcludeWithReturn($ctx->start); }
;

oC_MultiPartQuery
Expand Down Expand Up @@ -722,9 +722,7 @@ WHITESPACE
;

Comment
: ( '/*' ( Comment_1 | ( '*' Comment_2 ) )* '*/' )
| ( '--' ( Comment_3 )* CR? ( LF | EOF ) )
;
: ( '/*' ( Comment_1 | ( '*' Comment_2 ) )* '*/' ) ;

oC_LeftArrowHead
: '<'
Expand Down
23 changes: 14 additions & 9 deletions src/parser/transform/transform_graph_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ std::unique_ptr<RelPattern> Transformer::transformRelationshipPattern(
CypherParser::OC_RelationshipPatternContext& ctx) {
auto relDetail = ctx.oC_RelationshipDetail();
auto variable = std::string();
if (relDetail->oC_Variable()) {
variable = transformVariable(*relDetail->oC_Variable());
}
auto relTypes = std::vector<std::string>{};
if (relDetail->oC_RelationshipTypes()) {
relTypes = transformRelTypes(*relDetail->oC_RelationshipTypes());
}
auto properties = std::vector<std::pair<std::string, std::unique_ptr<ParsedExpression>>>{};
if (relDetail->kU_Properties()) {
properties = transformProperties(*relDetail->kU_Properties());

if (relDetail) {
if (relDetail->oC_Variable()) {
variable = transformVariable(*relDetail->oC_Variable());
}
if (relDetail->oC_RelationshipTypes()) {
relTypes = transformRelTypes(*relDetail->oC_RelationshipTypes());
}
if (relDetail->kU_Properties()) {
properties = transformProperties(*relDetail->kU_Properties());
}
}

ArrowDirection arrowDirection;
if (ctx.oC_LeftArrowHead()) {
arrowDirection = ArrowDirection::LEFT;
Expand All @@ -94,9 +98,10 @@ std::unique_ptr<RelPattern> Transformer::transformRelationshipPattern(
} else {
arrowDirection = ArrowDirection::BOTH;
}

auto relType = QueryRelType::NON_RECURSIVE;
std::unique_ptr<RecursiveRelPatternInfo> recursiveInfo;
if (relDetail->oC_RangeLiteral()) {
if (relDetail && relDetail->oC_RangeLiteral()) {
if (relDetail->oC_RangeLiteral()->ALL()) {
relType = QueryRelType::ALL_SHORTEST;
} else if (relDetail->oC_RangeLiteral()->SHORTEST()) {
Expand Down
Loading

0 comments on commit b0dcc17

Please sign in to comment.