@@ -3,15 +3,13 @@ import {
3
3
CommonToken ,
4
4
CommonTokenStream ,
5
5
ErrorListener as ANTLRErrorListener ,
6
- ParseTree ,
7
6
Recognizer ,
8
7
TerminalNode ,
9
8
Token ,
10
9
} from 'antlr4' ;
11
10
import { default as CypherCmdLexer } from '../generated-parser/CypherCmdLexer' ;
12
11
import CypherCmdParser , {
13
12
EscapedSymbolicNameStringContext ,
14
- MergeClauseContext ,
15
13
UnescapedSymbolicNameString_Context ,
16
14
} from '../generated-parser/CypherCmdParser' ;
17
15
import { lexerKeywords } from '../lexerSymbols' ;
@@ -76,41 +74,6 @@ const traillingCharacters = [
76
74
CypherCmdLexer . RBRACKET ,
77
75
] ;
78
76
79
- // TODO: This function should probably not exist; we're not really fans of
80
- // shuffling around the AST like we're doing right now...
81
- export function handleMergeClause (
82
- ctx : MergeClauseContext ,
83
- visit : ( node : ParseTree ) => void ,
84
- startGroup ?: ( ) => number ,
85
- endGroup ?: ( id : number ) => void ,
86
- avoidBreakBetween ?: ( ) => void ,
87
- ) {
88
- visit ( ctx . MERGE ( ) ) ;
89
- avoidBreakBetween ?.( ) ;
90
- let patternGrp : number ;
91
- if ( startGroup ) {
92
- patternGrp = startGroup ( ) ;
93
- }
94
- visit ( ctx . pattern ( ) ) ;
95
- if ( endGroup ) {
96
- endGroup ( patternGrp ) ;
97
- }
98
- const mergeActions = ctx
99
- . mergeAction_list ( )
100
- . map ( ( action , index ) => ( { action, index } ) ) ;
101
- mergeActions . sort ( ( a , b ) => {
102
- if ( a . action . CREATE ( ) && b . action . MATCH ( ) ) {
103
- return - 1 ;
104
- } else if ( a . action . MATCH ( ) && b . action . CREATE ( ) ) {
105
- return 1 ;
106
- }
107
- return a . index - b . index ;
108
- } ) ;
109
- mergeActions . forEach ( ( { action } ) => {
110
- visit ( action ) ;
111
- } ) ;
112
- }
113
-
114
77
export function wantsToBeUpperCase ( node : TerminalNode ) : boolean {
115
78
return isKeywordTerminal ( node ) ;
116
79
}
0 commit comments