Skip to content

Commit

Permalink
Fix parser error
Browse files Browse the repository at this point in the history
  • Loading branch information
acquamarin committed May 25, 2023
1 parent 58c92ee commit ff4f40b
Show file tree
Hide file tree
Showing 4 changed files with 1,682 additions and 1,861 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
4 changes: 2 additions & 2 deletions test/parser/syntax_error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ TEST_F(SyntaxErrorTest, QueryNotConcludeWithReturn2) {

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";
"Parser exception: Invalid input <MATCH a>: expected rule oC_SingleQuery (line: 1, offset: "
"6)\n";
expectedException += "\"MATCH a RETURN *;\"\n";
expectedException += " ^";
auto input = "MATCH a RETURN *;";
Expand Down
Loading

0 comments on commit ff4f40b

Please sign in to comment.