Skip to content

Commit

Permalink
only commit range litral
Browse files Browse the repository at this point in the history
  • Loading branch information
AEsir777 committed Sep 12, 2023
1 parent c578381 commit bb88cd6
Show file tree
Hide file tree
Showing 4 changed files with 988 additions and 950 deletions.
2 changes: 1 addition & 1 deletion src/antlr4/Cypher.g4
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ oC_NodeLabel
: ':' SP? oC_LabelName ;

oC_RangeLiteral
: '*' SP? ( SHORTEST | ALL SP SHORTEST )? SP? oC_IntegerLiteral SP? '..' SP? oC_IntegerLiteral (SP? '(' SP? oC_Variable SP? ',' SP? '_' SP? '|' SP? oC_Where SP? ')')? ;
: '*' SP? ( SHORTEST | ALL SP SHORTEST )? SP? ((oC_IntegerLiteral SP? '..' SP?)? oC_IntegerLiteral)? (SP? '(' SP? oC_Variable SP? ',' SP? '_' SP? '|' SP? oC_Where SP? ')')? ;

SHORTEST : ( 'S' | 's' ) ( 'H' | 'h' ) ( 'O' | 'o' ) ( 'R' | 'r' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'T' | 't' ) ;

Expand Down
13 changes: 11 additions & 2 deletions src/parser/transform/transform_graph_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,17 @@ std::unique_ptr<RelPattern> Transformer::transformRelationshipPattern(
relType = QueryRelType::VARIABLE_LENGTH;
}
auto range = relDetail->oC_RangeLiteral();
auto lowerBound = range->oC_IntegerLiteral()[0]->getText();
auto upperBound = range->oC_IntegerLiteral()[1]->getText();
auto lowerBound = std::to_string(1);
auto upperBound = std::to_string(UINT32_MAX);

if (range->oC_IntegerLiteral().size() == 1) {
lowerBound = range->oC_IntegerLiteral()[0]->getText();
lowerBound = range->oC_IntegerLiteral()[0]->getText();

Check warning on line 118 in src/parser/transform/transform_graph_pattern.cpp

View check run for this annotation

Codecov / codecov/patch

src/parser/transform/transform_graph_pattern.cpp#L117-L118

Added lines #L117 - L118 were not covered by tests
} else if (range->oC_IntegerLiteral().size() == 2) {
lowerBound = range->oC_IntegerLiteral()[0]->getText();
upperBound = range->oC_IntegerLiteral()[1]->getText();
}

auto recursiveRelName = std::string();
std::unique_ptr<ParsedExpression> whereExpression = nullptr;
if (range->oC_Where()) {
Expand Down
Loading

0 comments on commit bb88cd6

Please sign in to comment.