Skip to content

Commit

Permalink
Merge pull request #1572 from kuzudb/parser-error
Browse files Browse the repository at this point in the history
Fix parser error
  • Loading branch information
acquamarin committed May 25, 2023
2 parents 58c92ee + 6b00141 commit dba7110
Show file tree
Hide file tree
Showing 4 changed files with 1,680 additions and 1,869 deletions.
4 changes: 1 addition & 3 deletions src/antlr4/Cypher.g4
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ oC_PatternElement
;

oC_NodePattern
: '(' SP? ( oC_Variable SP? )? ( oC_NodeLabels SP? )? ( kU_Properties SP? )? ')'
| SP? ( oC_Variable SP? )? ( oC_NodeLabels SP? )? ( kU_Properties SP? )? { notifyNodePatternWithoutParentheses($oC_Variable.text, $oC_Variable.start); }
;
: '(' SP? ( oC_Variable SP? )? ( oC_NodeLabels SP? )? ( kU_Properties SP? )? ')' ;

oC_PatternElementChain
: oC_RelationshipPattern SP? oC_NodePattern ;
Expand Down
10 changes: 0 additions & 10 deletions test/parser/syntax_error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ TEST_F(SyntaxErrorTest, QueryNotConcludeWithReturn2) {
ASSERT_STREQ(expectedException.c_str(), getParsingError(input).c_str());
}

TEST_F(SyntaxErrorTest, QueryNodeWithOutParentheses) {
std::string expectedException =
"Parser exception: Parentheses are required to identify nodes in "
"patterns, i.e. (a) (line: 1, offset: 6)\n";
expectedException += "\"MATCH a RETURN *;\"\n";
expectedException += " ^";
auto input = "MATCH a RETURN *;";
ASSERT_STREQ(expectedException.c_str(), getParsingError(input).c_str());
}

TEST_F(SyntaxErrorTest, InvalidNotEqualOperator) {
std::string expectedException =
"Parser exception: Unknown operation '!=' (you probably meant to use '<>', which is "
Expand Down
Loading

0 comments on commit dba7110

Please sign in to comment.