diff --git a/src/query/frontend/opencypher/grammar/Cypher.g4 b/src/query/frontend/opencypher/grammar/Cypher.g4 index 80e808948..880c3e665 100644 --- a/src/query/frontend/opencypher/grammar/Cypher.g4 +++ b/src/query/frontend/opencypher/grammar/Cypher.g4 @@ -16,7 +16,7 @@ */ grammar Cypher; -cypher : SP? statement ( SP? ';' )? SP? ; +cypher : SP? statement ( SP? ';' )? SP? EOF ; statement : query ; diff --git a/tests/unit/cypher_main_visitor.cpp b/tests/unit/cypher_main_visitor.cpp index 67ec4a092..db148c592 100644 --- a/tests/unit/cypher_main_visitor.cpp +++ b/tests/unit/cypher_main_visitor.cpp @@ -47,6 +47,10 @@ TEST(CypherMainVisitorTest, SyntaxException) { ASSERT_THROW(AstGenerator("CREATE ()-[*1...2]-()"), SyntaxException); } +TEST(CypherMainVisitorTest, SyntaxExceptionOnTrailingText) { + ASSERT_THROW(AstGenerator("RETURN 2 + 2 mirko"), SyntaxException); +} + TEST(CypherMainVisitorTest, PropertyLookup) { AstGenerator ast_generator("RETURN n.x"); auto *query = ast_generator.query_;