Skip to content

Commit

Permalink
Makes the way we add external keywords a bit better
Browse files Browse the repository at this point in the history
  • Loading branch information
ncordon committed Sep 13, 2024
1 parent 2f8a9fd commit ec87686
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-wombats-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neo4j-cypher/language-support': patch
---

Fixes bug using non language keywords (EXPLAIN, PROFILE, etc) as symbolic names
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,4 @@ listCompletionRule: LIST;

useCompletionRule: USE;


cmdCommandsKeywords: HISTORY | CLEAR | PARAM;


unescapedLabelSymbolicNameString
: IDENTIFIER | staticIdentifiers | preparserOption | cmdCommandsKeywords;
externalKeywords: preparserOption | HISTORY | CLEAR | PARAM;
3 changes: 0 additions & 3 deletions packages/language-support/src/antlr-grammar/CypherLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ ESCAPED_SYMBOLIC_NAME
: '`' ( ~'`' | '``' )* '`'
;
EXPLAIN:
E X P L A I N;
ACCESS
: A C C E S S
;
Expand Down
14 changes: 8 additions & 6 deletions packages/language-support/src/antlr-grammar/CypherParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1769,14 +1769,15 @@ symbolicLabelNameString
| unescapedLabelSymbolicNameString
;

// Do not remove this, it is needed for composing the grammar
// with other ones (e.g. language support ones)
externalKeywords
: IDENTIFIER
;

unescapedLabelSymbolicNameString
: IDENTIFIER | staticIdentifiers;



staticIdentifiers
:ACCESS
: IDENTIFIER
| ACCESS
| ACTIVE
| ADMIN
| ADMINISTRATOR
Expand Down Expand Up @@ -2030,6 +2031,7 @@ staticIdentifiers
| YIELD
| ZONE
| ZONED
| externalKeywords
;

endOfFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ EXPLAIN:
E X P L A I N;

PROFILE:
P R O F I L E;
P R O F I L E;
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ preparsedStatement:
preparserOption? statement;

preparserOption:
EXPLAIN | PROFILE;

EXPLAIN | PROFILE;

0 comments on commit ec87686

Please sign in to comment.