Move 'explain' to Cypher.g4 and add it to keyword list

Summary: Move explain to Cypher.g4 so MemgraphCypher contains only enterprise features. Also added `EXPLAIN` to keyword list because query `MATCH (explain) RETURN explain` wasn't working.

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1632
This commit is contained in:
Marin Tomic 2018-10-04 16:31:41 +02:00
parent 9071552ce1
commit 343fe54f2c
5 changed files with 21 additions and 18 deletions

View File

@ -23,7 +23,11 @@ cypher : statement ';'? EOF ;
statement : query ;
query : regularQuery ;
query : regularQuery
| explainQuery
;
explainQuery : EXPLAIN regularQuery ;
regularQuery : singleQuery ( cypherUnion )* ;
@ -291,6 +295,7 @@ cypherKeyword : ALL
| ELSE
| END
| ENDS
| EXPLAIN
| EXTRACT
| FALSE
| FILTER

View File

@ -89,6 +89,7 @@ DISTINCT : D I S T I N C T ;
ELSE : E L S E ;
END : E N D ;
ENDS : E N D S ;
EXPLAIN : E X P L A I N ;
EXTRACT : E X T R A C T ;
FALSE : F A L S E ;
FILTER : F I L T E R ;

View File

@ -1,4 +1,4 @@
/* Memgraph specific part of Cypher grammar. */
/* Memgraph specific part of Cypher grammar with enterprise features. */
parser grammar MemgraphCypher ;
@ -51,8 +51,6 @@ query : regularQuery
| explainQuery
;
explainQuery : EXPLAIN regularQuery ;
authQuery : createRole
| dropRole
| showRoles

View File

@ -1,4 +1,4 @@
/* Memgraph specific Cypher reserved words. */
/* Memgraph specific Cypher reserved words used for enterprise features. */
/*
* When changing this grammar make sure to update constants in
@ -18,7 +18,6 @@ CLEAR : C L E A R ;
DATA : D A T A ;
DENY : D E N Y ;
DROP : D R O P ;
EXPLAIN : E X P L A I N ;
FOR : F O R ;
FROM : F R O M ;
GRANT : G R A N T ;

View File

@ -79,18 +79,18 @@ class Trie {
const int kBitsetSize = 65536;
const trie::Trie kKeywords = {
"union", "all", "optional", "match", "unwind", "as",
"merge", "on", "create", "set", "detach", "delete",
"remove", "with", "distinct", "return", "order", "by",
"skip", "limit", "ascending", "asc", "descending", "desc",
"where", "or", "xor", "and", "not", "in",
"starts", "ends", "contains", "is", "null", "case",
"when", "then", "else", "end", "count", "filter",
"extract", "any", "none", "single", "true", "false",
"reduce", "user", "password", "alter", "drop", "stream",
"streams", "load", "data", "kafka", "transform", "batch",
"interval", "show", "start", "stop", "size", "topic",
"test"};
"union", "all", "optional", "match", "unwind", "as",
"merge", "on", "create", "set", "detach", "delete",
"remove", "with", "distinct", "return", "order", "by",
"skip", "limit", "ascending", "asc", "descending", "desc",
"where", "or", "xor", "and", "not", "in",
"starts", "ends", "contains", "is", "null", "case",
"when", "then", "else", "end", "count", "filter",
"extract", "any", "none", "single", "true", "false",
"reduce", "user", "password", "alter", "drop", "stream",
"streams", "load", "data", "kafka", "transform", "batch",
"interval", "show", "start", "stop", "size", "topic",
"test", "explain"};
// Unicode codepoints that are allowed at the start of the unescaped name.
const std::bitset<kBitsetSize> kUnescapedNameAllowedStarts(std::string(