Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates grammar and semantic analysis to 5.24 #268

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
lexer grammar CypherLexer;
lexer grammar Cypher5Lexer;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need/want to do this rename before we've done the spikes into cypher 5/6 mgmt and decided how we're going to handle that?


SPACE
: ( '\u0009'
Expand Down Expand Up @@ -222,6 +222,10 @@ CALL
: C A L L
;
CASCADE
: C A S C A D E
;
CASE
: C A S E
;
Expand Down Expand Up @@ -786,6 +790,10 @@ OF
: O F
;
OFFSET
: O F F S E T
;
ON
: O N
;
Expand Down Expand Up @@ -974,6 +982,10 @@ REQUIRED
: R E Q U I R E D
;
RESTRICT
: R E S T R I C T
;
RETURN
: R E T U R N
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
parser grammar CypherParser;
parser grammar Cypher5Parser;


options { tokenVocab = CypherLexer; }
options { tokenVocab = Cypher5Lexer; }
statements
: statement (SEMICOLON statement)* SEMICOLON? EOF
;
Expand Down Expand Up @@ -55,6 +55,7 @@ clause
| subqueryClause
| loadCSVClause
| foreachClause
| orderBySkipLimitClause
;

useClause
Expand Down Expand Up @@ -104,7 +105,7 @@ orderBy
;

skip
: SKIPROWS expression
: (OFFSET | SKIPROWS) expression
;

limit
Expand Down Expand Up @@ -190,7 +191,7 @@ unwindClause
;

callClause
: CALL procedureName (LPAREN (procedureArgument (COMMA procedureArgument)*)? RPAREN)? (YIELD (TIMES | procedureResultItem (COMMA procedureResultItem)* whereClause?))?
: OPTIONAL? CALL procedureName (LPAREN (procedureArgument (COMMA procedureArgument)*)? RPAREN)? (YIELD (TIMES | procedureResultItem (COMMA procedureResultItem)* whereClause?))?
;

procedureName
Expand All @@ -214,7 +215,7 @@ foreachClause
;

subqueryClause
: CALL subqueryScope? LCURLY regularQuery RCURLY subqueryInTransactionsParameters?
: OPTIONAL? CALL subqueryScope? LCURLY regularQuery RCURLY subqueryInTransactionsParameters?
;

subqueryScope
Expand All @@ -237,6 +238,12 @@ subqueryInTransactionsReportParameters
: REPORT STATUS AS variable
;

orderBySkipLimitClause
: orderBy skip? limit?
| skip limit?
| limit
;

patternList
: pattern (COMMA pattern)*
;
Expand Down Expand Up @@ -840,7 +847,7 @@ yieldItem
;

yieldSkip
: SKIPROWS signedIntegerLiteral
: (OFFSET | SKIPROWS) signedIntegerLiteral
;

yieldLimit
Expand Down Expand Up @@ -1585,7 +1592,12 @@ secondaryToken
;

dropDatabase
: COMPOSITE? DATABASE symbolicAliasNameOrParameter (IF EXISTS)? ((DUMP | DESTROY) DATA)? waitClause?
: COMPOSITE? DATABASE symbolicAliasNameOrParameter (IF EXISTS)? aliasAction? ((DUMP | DESTROY) DATA)? waitClause?
;

aliasAction
: RESTRICT
| CASCADE (ALIAS | ALIASES)
;

alterDatabase
Expand Down Expand Up @@ -1630,6 +1642,14 @@ showDatabase

// Alias commands

aliasName
: symbolicAliasNameOrParameter
;

databaseName
: symbolicAliasNameOrParameter
;

createAlias
: ALIAS aliasName (IF NOT EXISTS)? FOR DATABASE databaseName (AT stringOrParameter USER commandNameExpression PASSWORD passwordExpression (DRIVER mapOrParameter)?)? (PROPERTIES mapOrParameter)?
;
Expand Down Expand Up @@ -1669,7 +1689,7 @@ alterAliasProperties
;

showAliases
: (ALIAS | ALIASES) symbolicAliasNameOrParameter? FOR (DATABASE | DATABASES) showCommandYield?
: (ALIAS | ALIASES) aliasName? FOR (DATABASE | DATABASES) showCommandYield?
;

// Various strings, symbolic names, lists and maps
Expand Down Expand Up @@ -1703,12 +1723,6 @@ symbolicAliasName
: symbolicNameString (DOT symbolicNameString)*
;

aliasName:
symbolicAliasNameOrParameter;

databaseName:
symbolicAliasNameOrParameter;

stringListLiteral
: LBRACKET (stringLiteral (COMMA stringLiteral)*)? RBRACKET
;
Expand Down Expand Up @@ -1769,7 +1783,7 @@ symbolicLabelNameString
| unescapedLabelSymbolicNameString
;

// Do not remove this, it is needed for composing the grammar
// Do not remove this, it is needed for composing the grammar
// with other ones (e.g. language support ones)
externalKeywords
: IDENTIFIER
Expand Down Expand Up @@ -1807,6 +1821,7 @@ unescapedLabelSymbolicNameString
| BUILT
| BY
| CALL
| CASCADE
| CASE
| CHANGE
| CIDR
Expand Down Expand Up @@ -1919,6 +1934,7 @@ unescapedLabelSymbolicNameString
| NOTHING
| NOWAIT
| OF
| OFFSET
| ON
| ONLY
| OPTIONAL
Expand Down Expand Up @@ -1959,6 +1975,7 @@ unescapedLabelSymbolicNameString
| REPORT
| REQUIRE
| REQUIRED
| RESTRICT
| RETURN
| REVOKE
| ROLE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lexer grammar CypherPreLexer;

import CypherLexer;
import Cypher5Lexer;

EXPLAIN:
E X P L A I N;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parser grammar CypherPreParser;

import CypherParser;
import Cypher5Parser;

options { tokenVocab = CypherPreLexer; }

Expand Down
3 changes: 3 additions & 0 deletions packages/language-support/src/lexerSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const lexerKeywords = [
CypherLexer.BUILT,
CypherLexer.BY,
CypherLexer.CALL,
CypherLexer.CASCADE,
CypherLexer.CASE,
CypherLexer.CIDR,
CypherLexer.CHANGE,
Expand Down Expand Up @@ -246,6 +247,7 @@ export const lexerKeywords = [
CypherLexer.NOWAIT,
CypherLexer.NULL,
CypherLexer.OF,
CypherLexer.OFFSET,
CypherLexer.ON,
CypherLexer.ONLY,
CypherLexer.OPTION,
Expand Down Expand Up @@ -286,6 +288,7 @@ export const lexerKeywords = [
CypherLexer.REPORT,
CypherLexer.REQUIRE,
CypherLexer.REQUIRED,
CypherLexer.RESTRICT,
CypherLexer.RETURN,
CypherLexer.REVOKE,
CypherLexer.ROLE,
Expand Down
Loading