dt-sql-parser 4.1.0-beta.1 → 4.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/hive/HiveSqlParser.d.ts +3 -0
- package/dist/lib/hive/HiveSqlParser.js +656 -630
- package/dist/lib/postgresql/PostgreSqlParser.d.ts +3 -2
- package/dist/lib/postgresql/PostgreSqlParser.js +2269 -2716
- package/dist/parser/common/basicSQL.d.ts +2 -2
- package/dist/parser/common/basicSQL.js +6 -59
- package/dist/parser/flink/index.d.ts +1 -1
- package/dist/parser/flink/index.js +3 -3
- package/dist/parser/hive/index.d.ts +1 -1
- package/dist/parser/hive/index.js +3 -3
- package/dist/parser/impala/index.d.ts +1 -1
- package/dist/parser/impala/index.js +3 -3
- package/dist/parser/mysql/index.d.ts +1 -1
- package/dist/parser/mysql/index.js +3 -3
- package/dist/parser/postgresql/index.d.ts +1 -1
- package/dist/parser/postgresql/index.js +3 -3
- package/dist/parser/spark/index.d.ts +1 -1
- package/dist/parser/spark/index.js +3 -3
- package/dist/parser/trino/index.d.ts +1 -1
- package/dist/parser/trino/index.js +3 -3
- package/package.json +3 -2
|
@@ -40,8 +40,9 @@ export declare abstract class BasicSQL<L extends Lexer = Lexer, PRC extends Pars
|
|
|
40
40
|
* @param candidates candidate list
|
|
41
41
|
* @param allTokens all tokens from input
|
|
42
42
|
* @param caretTokenIndex tokenIndex of caretPosition
|
|
43
|
+
* @param tokenIndexOffset offset of the tokenIndex in the candidates compared to the tokenIndex in allTokens
|
|
43
44
|
*/
|
|
44
|
-
protected abstract processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
45
|
+
protected abstract processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
45
46
|
/**
|
|
46
47
|
* Get a new splitListener instance.
|
|
47
48
|
*/
|
|
@@ -110,7 +111,6 @@ export declare abstract class BasicSQL<L extends Lexer = Lexer, PRC extends Pars
|
|
|
110
111
|
* @param input source string
|
|
111
112
|
*/
|
|
112
113
|
splitSQLByStatement(input: string): TextSlice[] | null;
|
|
113
|
-
private splitInputBySeparator;
|
|
114
114
|
/**
|
|
115
115
|
* Get suggestions of syntax and token at caretPosition
|
|
116
116
|
* @param input source string
|
|
@@ -3,7 +3,6 @@ import { CodeCompletionCore } from 'antlr4-c3';
|
|
|
3
3
|
import { findCaretTokenIndex } from './findCaretTokenIndex';
|
|
4
4
|
import { ctxToText, tokenToWord } from './textAndWord';
|
|
5
5
|
import { ErrorStrategy } from './errorStrategy';
|
|
6
|
-
const SEPARATOR = ';';
|
|
7
6
|
/**
|
|
8
7
|
* Basic SQL class, every sql needs extends it.
|
|
9
8
|
*/
|
|
@@ -149,39 +148,6 @@ export class BasicSQL {
|
|
|
149
148
|
.filter(Boolean);
|
|
150
149
|
return res;
|
|
151
150
|
}
|
|
152
|
-
// 通过分隔符进一步切分语句
|
|
153
|
-
splitInputBySeparator(inputSlice, caretTokenIndex) {
|
|
154
|
-
const allTokens = this.getAllTokens(inputSlice);
|
|
155
|
-
/**
|
|
156
|
-
* set startToken
|
|
157
|
-
*/
|
|
158
|
-
let startToken = null;
|
|
159
|
-
for (let tokenIndex = caretTokenIndex; tokenIndex >= 0; tokenIndex--) {
|
|
160
|
-
const token = allTokens[tokenIndex];
|
|
161
|
-
if ((token === null || token === void 0 ? void 0 : token.text) === SEPARATOR) {
|
|
162
|
-
startToken = allTokens[tokenIndex + 1];
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (startToken === null) {
|
|
167
|
-
startToken = allTokens[0];
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* set stopToken
|
|
171
|
-
*/
|
|
172
|
-
let stopToken = null;
|
|
173
|
-
for (let tokenIndex = caretTokenIndex; tokenIndex < allTokens.length; tokenIndex++) {
|
|
174
|
-
const token = allTokens[tokenIndex];
|
|
175
|
-
if ((token === null || token === void 0 ? void 0 : token.text) === SEPARATOR) {
|
|
176
|
-
stopToken = token;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (stopToken === null) {
|
|
181
|
-
stopToken = allTokens[allTokens.length - 1];
|
|
182
|
-
}
|
|
183
|
-
return { startToken, stopToken };
|
|
184
|
-
}
|
|
185
151
|
/**
|
|
186
152
|
* Get suggestions of syntax and token at caretPosition
|
|
187
153
|
* @param input source string
|
|
@@ -189,13 +155,13 @@ export class BasicSQL {
|
|
|
189
155
|
* @returns suggestion
|
|
190
156
|
*/
|
|
191
157
|
getSuggestionAtCaretPosition(input, caretPosition) {
|
|
192
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
193
159
|
const splitListener = this.splitListener;
|
|
194
160
|
this.parseWithCache(input);
|
|
195
161
|
if (!this._parseTree)
|
|
196
162
|
return null;
|
|
197
163
|
let sqlParserIns = this._parser;
|
|
198
|
-
|
|
164
|
+
const allTokens = this.getAllTokens(input);
|
|
199
165
|
let caretTokenIndex = findCaretTokenIndex(caretPosition, allTokens);
|
|
200
166
|
let c3Context = this._parseTree;
|
|
201
167
|
let tokenIndexOffset = 0;
|
|
@@ -240,8 +206,8 @@ export class BasicSQL {
|
|
|
240
206
|
}
|
|
241
207
|
}
|
|
242
208
|
// A boundary consisting of the index of the input.
|
|
243
|
-
|
|
244
|
-
|
|
209
|
+
const startIndex = (_e = (_d = startStatement === null || startStatement === void 0 ? void 0 : startStatement.start) === null || _d === void 0 ? void 0 : _d.start) !== null && _e !== void 0 ? _e : 0;
|
|
210
|
+
const stopIndex = (_g = (_f = stopStatement === null || stopStatement === void 0 ? void 0 : stopStatement.stop) === null || _f === void 0 ? void 0 : _f.stop) !== null && _g !== void 0 ? _g : input.length - 1;
|
|
245
211
|
/**
|
|
246
212
|
* Save offset of the tokenIndex in the range of input
|
|
247
213
|
* compared to the tokenIndex in the whole input
|
|
@@ -252,26 +218,7 @@ export class BasicSQL {
|
|
|
252
218
|
* Reparse the input fragment,
|
|
253
219
|
* and c3 will collect candidates in the newly generated parseTree.
|
|
254
220
|
*/
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Split the inputSlice by separator.
|
|
258
|
-
*/
|
|
259
|
-
if (inputSlice.includes(SEPARATOR)) {
|
|
260
|
-
const { startToken, stopToken } = this.splitInputBySeparator(inputSlice, caretTokenIndex);
|
|
261
|
-
startIndex = (_k = startToken === null || startToken === void 0 ? void 0 : startToken.start) !== null && _k !== void 0 ? _k : 0;
|
|
262
|
-
stopIndex = (_l = (stopToken === null || stopToken === void 0 ? void 0 : stopToken.stop) + 1) !== null && _l !== void 0 ? _l : input.length;
|
|
263
|
-
/**
|
|
264
|
-
* Save offset of the tokenIndex in the range of input
|
|
265
|
-
* compared to the tokenIndex in the whole input
|
|
266
|
-
*/
|
|
267
|
-
tokenIndexOffset = (_m = startToken === null || startToken === void 0 ? void 0 : startToken.tokenIndex) !== null && _m !== void 0 ? _m : 0;
|
|
268
|
-
caretTokenIndex = caretTokenIndex - tokenIndexOffset;
|
|
269
|
-
/**
|
|
270
|
-
* Get the smaller range of inputSlice
|
|
271
|
-
*/
|
|
272
|
-
inputSlice = inputSlice.slice(startIndex, stopIndex);
|
|
273
|
-
allTokens = this.getAllTokens(inputSlice);
|
|
274
|
-
}
|
|
221
|
+
const inputSlice = input.slice(startIndex, stopIndex);
|
|
275
222
|
const lexer = this.createLexer(inputSlice);
|
|
276
223
|
lexer.removeErrorListeners();
|
|
277
224
|
const tokenStream = new CommonTokenStream(lexer);
|
|
@@ -287,7 +234,7 @@ export class BasicSQL {
|
|
|
287
234
|
const core = new CodeCompletionCore(sqlParserIns);
|
|
288
235
|
core.preferredRules = this.preferredRules;
|
|
289
236
|
const candidates = core.collectCandidates(caretTokenIndex, c3Context);
|
|
290
|
-
const originalSuggestions = this.processCandidates(candidates, allTokens, caretTokenIndex);
|
|
237
|
+
const originalSuggestions = this.processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset);
|
|
291
238
|
const syntaxSuggestions = originalSuggestions.syntax.map((syntaxCtx) => {
|
|
292
239
|
const wordRanges = syntaxCtx.wordRanges.map((token) => {
|
|
293
240
|
return tokenToWord(token, this._parsedInput);
|
|
@@ -16,5 +16,5 @@ export declare class FlinkSQL extends BasicSQL<FlinkSqlLexer, ProgramContext, Fl
|
|
|
16
16
|
protected get splitListener(): FlinkSqlSplitListener;
|
|
17
17
|
protected createErrorListener(_errorListener: ErrorListener): FlinkErrorListener;
|
|
18
18
|
protected createEntityCollector(input: string, caretTokenIndex?: number): FlinkEntityCollector;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -38,13 +38,13 @@ export class FlinkSQL extends BasicSQL {
|
|
|
38
38
|
createEntityCollector(input, caretTokenIndex) {
|
|
39
39
|
return new FlinkEntityCollector(input, caretTokenIndex);
|
|
40
40
|
}
|
|
41
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
41
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
42
42
|
const originalSyntaxSuggestions = [];
|
|
43
43
|
const keywords = [];
|
|
44
44
|
for (let candidate of candidates.rules) {
|
|
45
45
|
const [ruleType, candidateRule] = candidate;
|
|
46
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
47
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
46
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
47
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
48
48
|
let syntaxContextType = void 0;
|
|
49
49
|
switch (ruleType) {
|
|
50
50
|
case FlinkSqlParser.RULE_catalogPath: {
|
|
@@ -16,5 +16,5 @@ export declare class HiveSQL extends BasicSQL<HiveSqlLexer, ProgramContext, Hive
|
|
|
16
16
|
protected get splitListener(): HiveSqlSplitListener;
|
|
17
17
|
protected createErrorListener(_errorListener: ErrorListener): HiveErrorListener;
|
|
18
18
|
protected createEntityCollector(input: string, caretTokenIndex?: number): HiveEntityCollector;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -38,13 +38,13 @@ export class HiveSQL extends BasicSQL {
|
|
|
38
38
|
createEntityCollector(input, caretTokenIndex) {
|
|
39
39
|
return new HiveEntityCollector(input, caretTokenIndex);
|
|
40
40
|
}
|
|
41
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
41
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
42
42
|
const originalSyntaxSuggestions = [];
|
|
43
43
|
const keywords = [];
|
|
44
44
|
for (let candidate of candidates.rules) {
|
|
45
45
|
const [ruleType, candidateRule] = candidate;
|
|
46
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
47
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
46
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
47
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
48
48
|
let syntaxContextType = void 0;
|
|
49
49
|
switch (ruleType) {
|
|
50
50
|
case HiveSqlParser.RULE_dbSchemaName: {
|
|
@@ -16,5 +16,5 @@ export declare class ImpalaSQL extends BasicSQL<ImpalaSqlLexer, ProgramContext,
|
|
|
16
16
|
protected get splitListener(): ImpalaSqlSplitListener;
|
|
17
17
|
protected createErrorListener(_errorListener: ErrorListener): ImpalaErrorListener;
|
|
18
18
|
protected createEntityCollector(input: string, caretTokenIndex?: number): ImpalaEntityCollector;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -37,13 +37,13 @@ export class ImpalaSQL extends BasicSQL {
|
|
|
37
37
|
createEntityCollector(input, caretTokenIndex) {
|
|
38
38
|
return new ImpalaEntityCollector(input, caretTokenIndex);
|
|
39
39
|
}
|
|
40
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
40
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
41
41
|
const originalSyntaxSuggestions = [];
|
|
42
42
|
const keywords = [];
|
|
43
43
|
for (let candidate of candidates.rules) {
|
|
44
44
|
const [ruleType, candidateRule] = candidate;
|
|
45
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
46
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
45
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
46
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
47
47
|
let syntaxContextType = void 0;
|
|
48
48
|
switch (ruleType) {
|
|
49
49
|
case ImpalaSqlParser.RULE_functionNameCreate: {
|
|
@@ -16,5 +16,5 @@ export declare class MySQL extends BasicSQL<MySqlLexer, ProgramContext, MySqlPar
|
|
|
16
16
|
protected get splitListener(): MysqlSplitListener;
|
|
17
17
|
protected createErrorListener(_errorListener: ErrorListener): MysqlErrorListener;
|
|
18
18
|
protected createEntityCollector(input: string, caretTokenIndex?: number): MySqlEntityCollector;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -37,13 +37,13 @@ export class MySQL extends BasicSQL {
|
|
|
37
37
|
createEntityCollector(input, caretTokenIndex) {
|
|
38
38
|
return new MySqlEntityCollector(input, caretTokenIndex);
|
|
39
39
|
}
|
|
40
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
40
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
41
41
|
const originalSyntaxSuggestions = [];
|
|
42
42
|
const keywords = [];
|
|
43
43
|
for (const candidate of candidates.rules) {
|
|
44
44
|
const [ruleType, candidateRule] = candidate;
|
|
45
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
46
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
45
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
46
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
47
47
|
let syntaxContextType = void 0;
|
|
48
48
|
switch (ruleType) {
|
|
49
49
|
case MySqlParser.RULE_databaseName: {
|
|
@@ -16,5 +16,5 @@ export declare class PostgreSQL extends BasicSQL<PostgreSqlLexer, ProgramContext
|
|
|
16
16
|
protected get splitListener(): PostgreSqlSplitListener;
|
|
17
17
|
protected createErrorListener(_errorListener: ErrorListener): PostgreSqlErrorListener;
|
|
18
18
|
protected createEntityCollector(input: string, caretTokenIndex?: number): PostgreSqlEntityCollector;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -41,13 +41,13 @@ export class PostgreSQL extends BasicSQL {
|
|
|
41
41
|
createEntityCollector(input, caretTokenIndex) {
|
|
42
42
|
return new PostgreSqlEntityCollector(input, caretTokenIndex);
|
|
43
43
|
}
|
|
44
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
44
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
45
45
|
const originalSyntaxSuggestions = [];
|
|
46
46
|
const keywords = [];
|
|
47
47
|
for (let candidate of candidates.rules) {
|
|
48
48
|
const [ruleType, candidateRule] = candidate;
|
|
49
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
50
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
49
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
50
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
51
51
|
let syntaxContextType = void 0;
|
|
52
52
|
switch (ruleType) {
|
|
53
53
|
case PostgreSqlParser.RULE_table_name_create: {
|
|
@@ -16,5 +16,5 @@ export declare class SparkSQL extends BasicSQL<SparkSqlLexer, ProgramContext, Sp
|
|
|
16
16
|
protected get splitListener(): SparkSqlSplitListener;
|
|
17
17
|
protected createErrorListener(_errorListener: ErrorListener): SparkErrorListener;
|
|
18
18
|
protected createEntityCollector(input: string, caretTokenIndex?: number): SparkEntityCollector;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -37,13 +37,13 @@ export class SparkSQL extends BasicSQL {
|
|
|
37
37
|
createEntityCollector(input, caretTokenIndex) {
|
|
38
38
|
return new SparkEntityCollector(input, caretTokenIndex);
|
|
39
39
|
}
|
|
40
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
40
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
41
41
|
const originalSyntaxSuggestions = [];
|
|
42
42
|
const keywords = [];
|
|
43
43
|
for (const candidate of candidates.rules) {
|
|
44
44
|
const [ruleType, candidateRule] = candidate;
|
|
45
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
46
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
45
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
46
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
47
47
|
let syntaxContextType = void 0;
|
|
48
48
|
switch (ruleType) {
|
|
49
49
|
case SparkSqlParser.RULE_namespaceName: {
|
|
@@ -16,5 +16,5 @@ export declare class TrinoSQL extends BasicSQL<TrinoSqlLexer, ProgramContext, Tr
|
|
|
16
16
|
protected createErrorListener(_errorListener: ErrorListener): TrinoErrorListener;
|
|
17
17
|
protected createEntityCollector(input: string, caretTokenIndex?: number): TrinoEntityCollector;
|
|
18
18
|
protected preferredRules: Set<number>;
|
|
19
|
-
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number): Suggestions<Token>;
|
|
19
|
+
protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
|
|
20
20
|
}
|
|
@@ -39,13 +39,13 @@ export class TrinoSQL extends BasicSQL {
|
|
|
39
39
|
createEntityCollector(input, caretTokenIndex) {
|
|
40
40
|
return new TrinoEntityCollector(input, caretTokenIndex);
|
|
41
41
|
}
|
|
42
|
-
processCandidates(candidates, allTokens, caretTokenIndex) {
|
|
42
|
+
processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
|
|
43
43
|
const originalSyntaxSuggestions = [];
|
|
44
44
|
const keywords = [];
|
|
45
45
|
for (let candidate of candidates.rules) {
|
|
46
46
|
const [ruleType, candidateRule] = candidate;
|
|
47
|
-
const startTokenIndex = candidateRule.startTokenIndex;
|
|
48
|
-
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + 1);
|
|
47
|
+
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
|
48
|
+
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
|
49
49
|
let syntaxContextType = void 0;
|
|
50
50
|
switch (ruleType) {
|
|
51
51
|
case TrinoSqlParser.RULE_catalogRef: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dt-sql-parser",
|
|
3
|
-
"version": "4.1.0-beta.
|
|
3
|
+
"version": "4.1.0-beta.3",
|
|
4
4
|
"authors": "DTStack Corporation",
|
|
5
5
|
"description": "SQL Parsers for BigData, built with antlr4",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"format": "prettier --write .",
|
|
35
35
|
"format-g4": "antlr-format -c ./antlr.format.json -v ./src/grammar/**/*.g4",
|
|
36
36
|
"cleanComment": "node ./scripts/cleanCommentCli.js",
|
|
37
|
-
"benchmark": "node --no-warnings ./scripts/benchmark.js"
|
|
37
|
+
"benchmark": "NODE_OPTIONS=--max_old_space_size=4096 && node --no-warnings ./scripts/benchmark.js",
|
|
38
|
+
"benchmark:release": "node --no-warnings ./scripts/benchmark.js --release"
|
|
38
39
|
},
|
|
39
40
|
"license": "MIT",
|
|
40
41
|
"dependencies": {
|