-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Console command support (:use, :params, :clear, history) (#165)
* create gramamr for client commands * some basic commands * consider * add test file * mellan * rename * add unit tests * cleanuptodos * todos * fix syntax highlighting for console commands * add tests * fix completions * add errors when cmd disabled * semantic analysis handles multiple queries * comment * self review * unused variable * fix unit tests * self review * rename parser * rename rules * rephrase comment * fix crash and add tests * remove todo * mellan * properly merge main * improve error messages for console commands * add changeset * fix bad merge
- Loading branch information
1 parent
87817aa
commit 8cc77c6
Showing
27 changed files
with
1,232 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@neo4j-cypher/language-support': patch | ||
'@neo4j-cypher/react-codemirror': patch | ||
'@neo4j-cypher/language-server': patch | ||
--- | ||
|
||
Add support for console commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/language-support/src/antlr-grammar/CypherCmdLexer.g4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
lexer grammar CypherCmdLexer; | ||
|
||
import CypherLexer; | ||
|
||
PARAM : P A R A M S?; | ||
|
||
CLEAR: C L E A R; | ||
|
||
HISTORY: H I S T O R Y; |
28 changes: 28 additions & 0 deletions
28
packages/language-support/src/antlr-grammar/CypherCmdParser.g4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
parser grammar CypherCmdParser; | ||
|
||
import CypherParser; | ||
|
||
options { tokenVocab = CypherCmdLexer; } | ||
|
||
statementsOrCommands: statementOrCommand (SEMICOLON statementOrCommand)* SEMICOLON? EOF; | ||
|
||
statementOrCommand: (statement | consoleCommand); | ||
|
||
consoleCommand: COLON (clearCmd | historyCmd | useCmd | paramsCmd); | ||
|
||
paramsCmd: PARAM paramsArgs?; | ||
|
||
paramsArgs: (CLEAR | listCompletionRule | map | lambda); | ||
|
||
lambda: unescapedSymbolicNameString EQ GT expression; | ||
|
||
clearCmd: CLEAR; | ||
|
||
historyCmd: HISTORY; | ||
|
||
useCmd: useCompletionRule symbolicAliasName?; | ||
|
||
// These rules are needed to distinguish cypher <-> commands, for exapmle `USE` and `:use` in autocompletion | ||
listCompletionRule: LIST; | ||
|
||
useCompletionRule: USE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.