dt-sql-parser 4.1.0-beta.8 → 4.1.0

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +369 -0
  2. package/README.md +0 -51
  3. package/dist/lib/flink/FlinkSqlParser.d.ts +6 -2
  4. package/dist/lib/flink/FlinkSqlParser.js +2207 -2118
  5. package/dist/lib/postgresql/PostgreSqlParser.d.ts +3 -4
  6. package/dist/lib/postgresql/PostgreSqlParser.js +9175 -9197
  7. package/dist/lib/trino/TrinoSqlListener.d.ts +13 -0
  8. package/dist/lib/trino/TrinoSqlParser.d.ts +17 -4
  9. package/dist/lib/trino/TrinoSqlParser.js +1958 -1970
  10. package/dist/lib/trino/TrinoSqlVisitor.d.ts +8 -0
  11. package/dist/parser/common/basicSQL.d.ts +2 -15
  12. package/dist/parser/common/basicSQL.js +1 -15
  13. package/dist/parser/common/entityCollector.d.ts +7 -1
  14. package/dist/parser/common/entityCollector.js +20 -3
  15. package/dist/parser/common/types.d.ts +0 -25
  16. package/dist/parser/common/types.js +0 -7
  17. package/dist/parser/flink/index.d.ts +6 -8
  18. package/dist/parser/flink/index.js +5 -9
  19. package/dist/parser/hive/index.d.ts +5 -7
  20. package/dist/parser/hive/index.js +4 -8
  21. package/dist/parser/impala/index.d.ts +5 -7
  22. package/dist/parser/impala/index.js +4 -8
  23. package/dist/parser/mysql/index.d.ts +5 -7
  24. package/dist/parser/mysql/index.js +4 -8
  25. package/dist/parser/postgresql/index.d.ts +4 -6
  26. package/dist/parser/postgresql/index.js +4 -8
  27. package/dist/parser/spark/index.d.ts +7 -9
  28. package/dist/parser/spark/index.js +5 -9
  29. package/dist/parser/trino/index.d.ts +7 -9
  30. package/dist/parser/trino/index.js +5 -9
  31. package/package.json +2 -1
  32. package/dist/parser/common/semanticContextCollector.d.ts +0 -51
  33. package/dist/parser/common/semanticContextCollector.js +0 -202
  34. package/dist/parser/flink/flinkSemanticContextCollector.d.ts +0 -9
  35. package/dist/parser/flink/flinkSemanticContextCollector.js +0 -14
  36. package/dist/parser/hive/hiveSemanticContextCollector.d.ts +0 -9
  37. package/dist/parser/hive/hiveSemanticContextCollector.js +0 -14
  38. package/dist/parser/impala/impalaSemanticContextCollector.d.ts +0 -9
  39. package/dist/parser/impala/impalaSemanticContextCollector.js +0 -14
  40. package/dist/parser/mysql/mysqlSemanticContextCollector.d.ts +0 -9
  41. package/dist/parser/mysql/mysqlSemanticContextCollector.js +0 -14
  42. package/dist/parser/postgresql/postgreSemanticContextCollector.d.ts +0 -9
  43. package/dist/parser/postgresql/postgreSemanticContextCollector.js +0 -14
  44. package/dist/parser/spark/sparkSemanticContextCollector.d.ts +0 -9
  45. package/dist/parser/spark/sparkSemanticContextCollector.js +0 -14
  46. package/dist/parser/trino/trinoSemanticContextCollector.d.ts +0 -9
  47. package/dist/parser/trino/trinoSemanticContextCollector.js +0 -14
@@ -259,6 +259,7 @@ import { RowTypeContext } from "./TrinoSqlParser.js";
259
259
  import { IntervalTypeContext } from "./TrinoSqlParser.js";
260
260
  import { ArrayTypeContext } from "./TrinoSqlParser.js";
261
261
  import { DoublePrecisionTypeContext } from "./TrinoSqlParser.js";
262
+ import { TimeTypeContext } from "./TrinoSqlParser.js";
262
263
  import { LegacyArrayTypeContext } from "./TrinoSqlParser.js";
263
264
  import { GenericTypeContext } from "./TrinoSqlParser.js";
264
265
  import { DateTimeTypeContext } from "./TrinoSqlParser.js";
@@ -2122,6 +2123,13 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
2122
2123
  * @return the visitor result
2123
2124
  */
2124
2125
  visitDoublePrecisionType?: (ctx: DoublePrecisionTypeContext) => Result;
2126
+ /**
2127
+ * Visit a parse tree produced by the `timeType`
2128
+ * labeled alternative in `TrinoSqlParser.type`.
2129
+ * @param ctx the parse tree
2130
+ * @return the visitor result
2131
+ */
2132
+ visitTimeType?: (ctx: TimeTypeContext) => Result;
2125
2133
  /**
2126
2134
  * Visit a parse tree produced by the `legacyArrayType`
2127
2135
  * labeled alternative in `TrinoSqlParser.type`.
@@ -2,12 +2,11 @@ import { Lexer, Token, CommonTokenStream, CharStream, ParserRuleContext, ParseTr
2
2
  import { CandidatesCollection } from 'antlr4-c3';
3
3
  import { SQLParserBase } from '../../lib/SQLParserBase';
4
4
  import { TextSlice } from './textAndWord';
5
- import { CaretPosition, LOCALE_TYPE, SemanticCollectOptions, Suggestions } from './types';
5
+ import { CaretPosition, LOCALE_TYPE, Suggestions } from './types';
6
6
  import { ParseError, ErrorListener } from './parseErrorListener';
7
7
  import type { SplitListener } from './splitListener';
8
8
  import type { EntityCollector } from './entityCollector';
9
9
  import { EntityContext } from './entityCollector';
10
- import SemanticContextCollector from './semanticContextCollector';
11
10
  /**
12
11
  * Basic SQL class, every sql needs extends it.
13
12
  */
@@ -55,12 +54,8 @@ export declare abstract class BasicSQL<L extends Lexer = Lexer, PRC extends Pars
55
54
  /**
56
55
  * Get a new entityCollector instance.
57
56
  */
58
- protected abstract createEntityCollector(input: string, caretTokenIndex?: number): EntityCollector;
57
+ protected abstract createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): EntityCollector;
59
58
  locale: LOCALE_TYPE;
60
- /**
61
- * Get a new semanticContextCollector instance.
62
- */
63
- protected abstract createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): SemanticContextCollector;
64
59
  /**
65
60
  * Create an antlr4 lexer from input.
66
61
  * @param input string
@@ -141,12 +136,4 @@ export declare abstract class BasicSQL<L extends Lexer = Lexer, PRC extends Pars
141
136
  */
142
137
  getSuggestionAtCaretPosition(input: string, caretPosition: CaretPosition): Suggestions | null;
143
138
  getAllEntities(input: string, caretPosition?: CaretPosition): EntityContext[] | null;
144
- /**
145
- * Get semantic context infos
146
- * @param input source string
147
- * @param caretPosition caret position, such as cursor position
148
- * @param options semantic context options
149
- * @returns analyzed semantic context
150
- */
151
- getSemanticContextAtCaretPosition(input: string, caretPosition: CaretPosition, options?: SemanticCollectOptions): import("./types").SemanticContext;
152
139
  }
@@ -285,7 +285,7 @@ export class BasicSQL {
285
285
  const caretTokenIndex = caretPosition
286
286
  ? findCaretTokenIndex(caretPosition, allTokens)
287
287
  : void 0;
288
- const collectListener = this.createEntityCollector(input, caretTokenIndex);
288
+ const collectListener = this.createEntityCollector(input, allTokens, caretTokenIndex);
289
289
  // const parser = this.createParserWithCache(input);
290
290
  // parser.entityCollecting = true;
291
291
  // if(caretPosition) {
@@ -300,18 +300,4 @@ export class BasicSQL {
300
300
  // parser.entityCollecting = false;
301
301
  return collectListener.getEntities();
302
302
  }
303
- /**
304
- * Get semantic context infos
305
- * @param input source string
306
- * @param caretPosition caret position, such as cursor position
307
- * @param options semantic context options
308
- * @returns analyzed semantic context
309
- */
310
- getSemanticContextAtCaretPosition(input, caretPosition, options) {
311
- const allTokens = this.getAllTokens(input);
312
- const parseTree = this.parseWithCache(input);
313
- const statementContextListener = this.createSemanticContextCollector(input, caretPosition, allTokens, options);
314
- this.listen(statementContextListener, parseTree);
315
- return statementContextListener.semanticContext;
316
- }
317
303
  }
@@ -88,8 +88,9 @@ export declare function findAttribute(ctx: ParserRuleContextWithAttr | null, key
88
88
  * @todo: [may be need] Combine the entities in each clause.
89
89
  */
90
90
  export declare abstract class EntityCollector {
91
- constructor(input: string, caretTokenIndex?: number);
91
+ constructor(input: string, allTokens?: Token[], caretTokenIndex?: number);
92
92
  private readonly _input;
93
+ private readonly _allTokens;
93
94
  private readonly _caretTokenIndex;
94
95
  private readonly _entitiesSet;
95
96
  /** Staging statements that have already entered. */
@@ -108,6 +109,11 @@ export declare abstract class EntityCollector {
108
109
  getRootStmt(): StmtContext | null;
109
110
  getEntities(): EntityContext[];
110
111
  enterProgram(): void;
112
+ /**
113
+ * The antlr4 will ignore hidden tokens, if we type whitespace at the end of a statement,
114
+ * the whitespace token will not as stop token, so we consider the whitespace token as a part of the nonhidden token in front of it
115
+ */
116
+ protected getPrevNonHiddenTokenIndex(caretTokenIndex: number): number;
111
117
  protected pushStmt(ctx: ParserRuleContext, type: StmtContextType): StmtContext | null;
112
118
  protected popStmt(): StmtContext;
113
119
  protected pushEntity(ctx: ParserRuleContext, type: EntityContextType, attrInfo?: AttrInfo[]): EntityContext | null;
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { isToken } from 'antlr4ng';
12
+ import { isToken, Token } from 'antlr4ng';
13
13
  import { SimpleStack } from './simpleStack';
14
14
  import { ctxToText, isWordRange, tokenToWord, } from './textAndWord';
15
15
  import { EntityContextType } from './types';
@@ -173,8 +173,9 @@ function findAttributeChildren(ctx, keyName) {
173
173
  * @todo: [may be need] Combine the entities in each clause.
174
174
  */
175
175
  export class EntityCollector {
176
- constructor(input, caretTokenIndex) {
176
+ constructor(input, allTokens, caretTokenIndex) {
177
177
  this._input = input;
178
+ this._allTokens = allTokens || [];
178
179
  this._caretTokenIndex = caretTokenIndex !== null && caretTokenIndex !== void 0 ? caretTokenIndex : -1;
179
180
  this._entitiesSet = new Set();
180
181
  this._stmtStack = new SimpleStack();
@@ -197,6 +198,22 @@ export class EntityCollector {
197
198
  this._entityStack.clear();
198
199
  this._rootStmt = null;
199
200
  }
201
+ /**
202
+ * The antlr4 will ignore hidden tokens, if we type whitespace at the end of a statement,
203
+ * the whitespace token will not as stop token, so we consider the whitespace token as a part of the nonhidden token in front of it
204
+ */
205
+ getPrevNonHiddenTokenIndex(caretTokenIndex) {
206
+ if (this._allTokens[caretTokenIndex].channel !== Token.HIDDEN_CHANNEL)
207
+ return caretTokenIndex;
208
+ for (let i = caretTokenIndex - 1; i >= 0; i--) {
209
+ const token = this._allTokens[i];
210
+ if (token.channel !== Token.HIDDEN_CHANNEL) {
211
+ // If prev nonhidden token is ';', the current token does not belong to any statement.
212
+ return token.text === ';' ? Infinity : token.tokenIndex;
213
+ }
214
+ }
215
+ return Infinity;
216
+ }
200
217
  pushStmt(ctx, type) {
201
218
  var _a;
202
219
  let isContainCaret;
@@ -205,7 +222,7 @@ export class EntityCollector {
205
222
  !!ctx.start &&
206
223
  !!ctx.stop &&
207
224
  ctx.start.tokenIndex <= this._caretTokenIndex &&
208
- ctx.stop.tokenIndex >= this._caretTokenIndex;
225
+ ctx.stop.tokenIndex >= this.getPrevNonHiddenTokenIndex(this._caretTokenIndex);
209
226
  }
210
227
  const stmtContext = toStmtContext(ctx, type, this._input, this._rootStmt, this._stmtStack.peek(), isContainCaret);
211
228
  if (stmtContext) {
@@ -64,28 +64,3 @@ export interface Suggestions<T = WordRange> {
64
64
  readonly keywords: string[];
65
65
  }
66
66
  export type LOCALE_TYPE = 'zh_CN' | 'en_US';
67
- export interface SemanticContext {
68
- isStatementBeginning: boolean;
69
- }
70
- export declare enum SqlSplitStrategy {
71
- /** Only end the statement with semicolon symbol */
72
- STRICT = 0,
73
- /** Based on parse tree to split statements */
74
- LOOSE = 1
75
- }
76
- export interface SemanticCollectOptions {
77
- /**
78
- * `sqlSplitStrategy` will affects the result of `isStatementBeginning`;
79
- *
80
- * For example:
81
- *
82
- * The sql is "select id from t1 create\<cart_position\>"
83
- *
84
- * - `SqlSplitStrategy.STRICT`: split symbol `;` is missing after select statement so that it considerd as one statement, and `isStatementBeginning` is false
85
- *
86
- * - `SqlSplitStrategy.LOOSE`: in parse tree, it will parse to "select id from t1" and "create" two single statement, so `isStatementBeginning` is true
87
- *
88
- * @default SqlSplitStrategy.STRICT
89
- */
90
- sqlSplitStrategy?: SqlSplitStrategy;
91
- }
@@ -32,10 +32,3 @@ export var EntityContextType;
32
32
  /** column name that will be created */
33
33
  EntityContextType["COLUMN_CREATE"] = "columnCreate";
34
34
  })(EntityContextType || (EntityContextType = {}));
35
- export var SqlSplitStrategy;
36
- (function (SqlSplitStrategy) {
37
- /** Only end the statement with semicolon symbol */
38
- SqlSplitStrategy[SqlSplitStrategy["STRICT"] = 0] = "STRICT";
39
- /** Based on parse tree to split statements */
40
- SqlSplitStrategy[SqlSplitStrategy["LOOSE"] = 1] = "LOOSE";
41
- })(SqlSplitStrategy || (SqlSplitStrategy = {}));
@@ -1,22 +1,20 @@
1
- import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
2
1
  import { CandidatesCollection } from 'antlr4-c3';
2
+ import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { FlinkSqlLexer } from '../../lib/flink/FlinkSqlLexer';
4
4
  import { FlinkSqlParser, ProgramContext } from '../../lib/flink/FlinkSqlParser';
5
- import { CaretPosition, SemanticCollectOptions, Suggestions } from '../common/types';
6
5
  import { BasicSQL } from '../common/basicSQL';
7
- import { FlinkSqlSplitListener } from './flinkSplitListener';
8
- import { FlinkEntityCollector } from './flinkEntityCollector';
9
6
  import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
+ import { FlinkEntityCollector } from './flinkEntityCollector';
10
9
  import { FlinkErrorListener } from './flinkErrorListener';
11
- import { FlinkSemanticContextCollector } from './flinkSemanticContextCollector';
12
- export { FlinkSqlSplitListener, FlinkEntityCollector };
10
+ import { FlinkSqlSplitListener } from './flinkSplitListener';
11
+ export { FlinkEntityCollector, FlinkSqlSplitListener };
13
12
  export declare class FlinkSQL extends BasicSQL<FlinkSqlLexer, ProgramContext, FlinkSqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): FlinkSqlLexer;
15
14
  protected createParserFromTokenStream(tokenStream: CommonTokenStream): FlinkSqlParser;
16
15
  protected preferredRules: Set<number>;
17
16
  protected get splitListener(): FlinkSqlSplitListener;
18
17
  protected createErrorListener(_errorListener: ErrorListener): FlinkErrorListener;
19
- protected createEntityCollector(input: string, caretTokenIndex?: number): FlinkEntityCollector;
20
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): FlinkSemanticContextCollector;
18
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): FlinkEntityCollector;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,12 +1,11 @@
1
1
  import { FlinkSqlLexer } from '../../lib/flink/FlinkSqlLexer';
2
2
  import { FlinkSqlParser } from '../../lib/flink/FlinkSqlParser';
3
- import { EntityContextType, } from '../common/types';
4
3
  import { BasicSQL } from '../common/basicSQL';
5
- import { FlinkSqlSplitListener } from './flinkSplitListener';
4
+ import { EntityContextType } from '../common/types';
6
5
  import { FlinkEntityCollector } from './flinkEntityCollector';
7
6
  import { FlinkErrorListener } from './flinkErrorListener';
8
- import { FlinkSemanticContextCollector } from './flinkSemanticContextCollector';
9
- export { FlinkSqlSplitListener, FlinkEntityCollector };
7
+ import { FlinkSqlSplitListener } from './flinkSplitListener';
8
+ export { FlinkEntityCollector, FlinkSqlSplitListener };
10
9
  export class FlinkSQL extends BasicSQL {
11
10
  constructor() {
12
11
  super(...arguments);
@@ -37,11 +36,8 @@ export class FlinkSQL extends BasicSQL {
37
36
  const parserContext = this;
38
37
  return new FlinkErrorListener(_errorListener, parserContext, this.preferredRules);
39
38
  }
40
- createEntityCollector(input, caretTokenIndex) {
41
- return new FlinkEntityCollector(input, caretTokenIndex);
42
- }
43
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
44
- return new FlinkSemanticContextCollector(input, caretPosition, allTokens, options);
39
+ createEntityCollector(input, allTokens, caretTokenIndex) {
40
+ return new FlinkEntityCollector(input, allTokens, caretTokenIndex);
45
41
  }
46
42
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
47
43
  const originalSyntaxSuggestions = [];
@@ -1,14 +1,13 @@
1
- import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
2
1
  import { CandidatesCollection } from 'antlr4-c3';
2
+ import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { HiveSqlLexer } from '../../lib/hive/HiveSqlLexer';
4
4
  import { HiveSqlParser, ProgramContext } from '../../lib/hive/HiveSqlParser';
5
5
  import { BasicSQL } from '../common/basicSQL';
6
- import { CaretPosition, SemanticCollectOptions, Suggestions } from '../common/types';
7
- import { HiveSqlSplitListener } from './hiveSplitListener';
8
- import { HiveEntityCollector } from './hiveEntityCollector';
9
6
  import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
+ import { HiveEntityCollector } from './hiveEntityCollector';
10
9
  import { HiveErrorListener } from './hiveErrorListener';
11
- import { HiveSemanticContextCollector } from './hiveSemanticContextCollector';
10
+ import { HiveSqlSplitListener } from './hiveSplitListener';
12
11
  export { HiveEntityCollector, HiveSqlSplitListener };
13
12
  export declare class HiveSQL extends BasicSQL<HiveSqlLexer, ProgramContext, HiveSqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): HiveSqlLexer;
@@ -16,7 +15,6 @@ export declare class HiveSQL extends BasicSQL<HiveSqlLexer, ProgramContext, Hive
16
15
  protected preferredRules: Set<number>;
17
16
  protected get splitListener(): HiveSqlSplitListener;
18
17
  protected createErrorListener(_errorListener: ErrorListener): HiveErrorListener;
19
- protected createEntityCollector(input: string, caretTokenIndex?: number): HiveEntityCollector;
20
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): HiveSemanticContextCollector;
18
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): HiveEntityCollector;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,11 +1,10 @@
1
1
  import { HiveSqlLexer } from '../../lib/hive/HiveSqlLexer';
2
2
  import { HiveSqlParser } from '../../lib/hive/HiveSqlParser';
3
3
  import { BasicSQL } from '../common/basicSQL';
4
- import { EntityContextType, } from '../common/types';
5
- import { HiveSqlSplitListener } from './hiveSplitListener';
4
+ import { EntityContextType } from '../common/types';
6
5
  import { HiveEntityCollector } from './hiveEntityCollector';
7
6
  import { HiveErrorListener } from './hiveErrorListener';
8
- import { HiveSemanticContextCollector } from './hiveSemanticContextCollector';
7
+ import { HiveSqlSplitListener } from './hiveSplitListener';
9
8
  export { HiveEntityCollector, HiveSqlSplitListener };
10
9
  export class HiveSQL extends BasicSQL {
11
10
  constructor() {
@@ -37,11 +36,8 @@ export class HiveSQL extends BasicSQL {
37
36
  const parserContext = this;
38
37
  return new HiveErrorListener(_errorListener, parserContext, this.preferredRules);
39
38
  }
40
- createEntityCollector(input, caretTokenIndex) {
41
- return new HiveEntityCollector(input, caretTokenIndex);
42
- }
43
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
44
- return new HiveSemanticContextCollector(input, caretPosition, allTokens, options);
39
+ createEntityCollector(input, allTokens, caretTokenIndex) {
40
+ return new HiveEntityCollector(input, allTokens, caretTokenIndex);
45
41
  }
46
42
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
47
43
  const originalSyntaxSuggestions = [];
@@ -1,14 +1,13 @@
1
- import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
2
1
  import { CandidatesCollection } from 'antlr4-c3';
2
+ import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { ImpalaSqlLexer } from '../../lib/impala/ImpalaSqlLexer';
4
4
  import { ImpalaSqlParser, ProgramContext } from '../../lib/impala/ImpalaSqlParser';
5
5
  import { BasicSQL } from '../common/basicSQL';
6
- import { CaretPosition, SemanticCollectOptions, Suggestions } from '../common/types';
7
- import { ImpalaSqlSplitListener } from './impalaSplitListener';
8
- import { ImpalaEntityCollector } from './impalaEntityCollector';
9
6
  import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
+ import { ImpalaEntityCollector } from './impalaEntityCollector';
10
9
  import { ImpalaErrorListener } from './ImpalaErrorListener';
11
- import { ImpalaSemanticContextCollector } from './impalaSemanticContextCollector';
10
+ import { ImpalaSqlSplitListener } from './impalaSplitListener';
12
11
  export { ImpalaEntityCollector, ImpalaSqlSplitListener };
13
12
  export declare class ImpalaSQL extends BasicSQL<ImpalaSqlLexer, ProgramContext, ImpalaSqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): ImpalaSqlLexer;
@@ -16,7 +15,6 @@ export declare class ImpalaSQL extends BasicSQL<ImpalaSqlLexer, ProgramContext,
16
15
  protected preferredRules: Set<number>;
17
16
  protected get splitListener(): ImpalaSqlSplitListener;
18
17
  protected createErrorListener(_errorListener: ErrorListener): ImpalaErrorListener;
19
- protected createEntityCollector(input: string, caretTokenIndex?: number): ImpalaEntityCollector;
20
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): ImpalaSemanticContextCollector;
18
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): ImpalaEntityCollector;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,11 +1,10 @@
1
1
  import { ImpalaSqlLexer } from '../../lib/impala/ImpalaSqlLexer';
2
2
  import { ImpalaSqlParser } from '../../lib/impala/ImpalaSqlParser';
3
3
  import { BasicSQL } from '../common/basicSQL';
4
- import { EntityContextType, } from '../common/types';
5
- import { ImpalaSqlSplitListener } from './impalaSplitListener';
4
+ import { EntityContextType } from '../common/types';
6
5
  import { ImpalaEntityCollector } from './impalaEntityCollector';
7
6
  import { ImpalaErrorListener } from './ImpalaErrorListener';
8
- import { ImpalaSemanticContextCollector } from './impalaSemanticContextCollector';
7
+ import { ImpalaSqlSplitListener } from './impalaSplitListener';
9
8
  export { ImpalaEntityCollector, ImpalaSqlSplitListener };
10
9
  export class ImpalaSQL extends BasicSQL {
11
10
  constructor() {
@@ -36,11 +35,8 @@ export class ImpalaSQL extends BasicSQL {
36
35
  const parserContext = this;
37
36
  return new ImpalaErrorListener(_errorListener, parserContext, this.preferredRules);
38
37
  }
39
- createEntityCollector(input, caretTokenIndex) {
40
- return new ImpalaEntityCollector(input, caretTokenIndex);
41
- }
42
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
43
- return new ImpalaSemanticContextCollector(input, caretPosition, allTokens, options);
38
+ createEntityCollector(input, allTokens, caretTokenIndex) {
39
+ return new ImpalaEntityCollector(input, allTokens, caretTokenIndex);
44
40
  }
45
41
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
46
42
  const originalSyntaxSuggestions = [];
@@ -1,14 +1,13 @@
1
- import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
2
1
  import { CandidatesCollection } from 'antlr4-c3';
2
+ import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { MySqlLexer } from '../../lib/mysql/MySqlLexer';
4
4
  import { MySqlParser, ProgramContext } from '../../lib/mysql/MySqlParser';
5
5
  import { BasicSQL } from '../common/basicSQL';
6
- import { Suggestions, CaretPosition, SemanticCollectOptions } from '../common/types';
7
- import { MysqlSplitListener } from './mysqlSplitListener';
6
+ import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
8
  import { MySqlEntityCollector } from './mysqlEntityCollector';
9
9
  import { MysqlErrorListener } from './mysqlErrorListener';
10
- import { ErrorListener } from '../common/parseErrorListener';
11
- import { MySqlSemanticContextCollector } from '../mysql/mysqlSemanticContextCollector';
10
+ import { MysqlSplitListener } from './mysqlSplitListener';
12
11
  export { MySqlEntityCollector, MysqlSplitListener };
13
12
  export declare class MySQL extends BasicSQL<MySqlLexer, ProgramContext, MySqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): MySqlLexer;
@@ -16,7 +15,6 @@ export declare class MySQL extends BasicSQL<MySqlLexer, ProgramContext, MySqlPar
16
15
  protected preferredRules: Set<number>;
17
16
  protected get splitListener(): MysqlSplitListener;
18
17
  protected createErrorListener(_errorListener: ErrorListener): MysqlErrorListener;
19
- protected createEntityCollector(input: string, caretTokenIndex?: number): MySqlEntityCollector;
20
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): MySqlSemanticContextCollector;
18
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): MySqlEntityCollector;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,11 +1,10 @@
1
1
  import { MySqlLexer } from '../../lib/mysql/MySqlLexer';
2
2
  import { MySqlParser } from '../../lib/mysql/MySqlParser';
3
3
  import { BasicSQL } from '../common/basicSQL';
4
- import { EntityContextType, } from '../common/types';
5
- import { MysqlSplitListener } from './mysqlSplitListener';
4
+ import { EntityContextType } from '../common/types';
6
5
  import { MySqlEntityCollector } from './mysqlEntityCollector';
7
6
  import { MysqlErrorListener } from './mysqlErrorListener';
8
- import { MySqlSemanticContextCollector } from '../mysql/mysqlSemanticContextCollector';
7
+ import { MysqlSplitListener } from './mysqlSplitListener';
9
8
  export { MySqlEntityCollector, MysqlSplitListener };
10
9
  export class MySQL extends BasicSQL {
11
10
  constructor() {
@@ -36,11 +35,8 @@ export class MySQL extends BasicSQL {
36
35
  const parserContext = this;
37
36
  return new MysqlErrorListener(_errorListener, parserContext, this.preferredRules);
38
37
  }
39
- createEntityCollector(input, caretTokenIndex) {
40
- return new MySqlEntityCollector(input, caretTokenIndex);
41
- }
42
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
43
- return new MySqlSemanticContextCollector(input, caretPosition, allTokens, options);
38
+ createEntityCollector(input, allTokens, caretTokenIndex) {
39
+ return new MySqlEntityCollector(input, allTokens, caretTokenIndex);
44
40
  }
45
41
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
46
42
  const originalSyntaxSuggestions = [];
@@ -2,13 +2,12 @@ import { CandidatesCollection } from 'antlr4-c3';
2
2
  import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { PostgreSqlLexer } from '../../lib/postgresql/PostgreSqlLexer';
4
4
  import { PostgreSqlParser, ProgramContext } from '../../lib/postgresql/PostgreSqlParser';
5
- import { CaretPosition, SemanticCollectOptions, Suggestions } from '../common/types';
6
5
  import { BasicSQL } from '../common/basicSQL';
7
- import { PostgreSqlEntityCollector } from './postgreEntityCollector';
8
- import { PostgreSqlSplitListener } from './postgreSplitListener';
9
6
  import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
+ import { PostgreSqlEntityCollector } from './postgreEntityCollector';
10
9
  import { PostgreSqlErrorListener } from './postgreErrorListener';
11
- import { PostgreSemanticContextCollector } from './postgreSemanticContextCollector';
10
+ import { PostgreSqlSplitListener } from './postgreSplitListener';
12
11
  export { PostgreSqlEntityCollector, PostgreSqlSplitListener };
13
12
  export declare class PostgreSQL extends BasicSQL<PostgreSqlLexer, ProgramContext, PostgreSqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): PostgreSqlLexer;
@@ -16,7 +15,6 @@ export declare class PostgreSQL extends BasicSQL<PostgreSqlLexer, ProgramContext
16
15
  protected preferredRules: Set<number>;
17
16
  protected get splitListener(): PostgreSqlSplitListener;
18
17
  protected createErrorListener(_errorListener: ErrorListener): PostgreSqlErrorListener;
19
- protected createEntityCollector(input: string, caretTokenIndex?: number): PostgreSqlEntityCollector;
20
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): PostgreSemanticContextCollector;
18
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): PostgreSqlEntityCollector;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,11 +1,10 @@
1
1
  import { PostgreSqlLexer } from '../../lib/postgresql/PostgreSqlLexer';
2
2
  import { PostgreSqlParser } from '../../lib/postgresql/PostgreSqlParser';
3
- import { EntityContextType, } from '../common/types';
4
3
  import { BasicSQL } from '../common/basicSQL';
4
+ import { EntityContextType } from '../common/types';
5
5
  import { PostgreSqlEntityCollector } from './postgreEntityCollector';
6
- import { PostgreSqlSplitListener } from './postgreSplitListener';
7
6
  import { PostgreSqlErrorListener } from './postgreErrorListener';
8
- import { PostgreSemanticContextCollector } from './postgreSemanticContextCollector';
7
+ import { PostgreSqlSplitListener } from './postgreSplitListener';
9
8
  export { PostgreSqlEntityCollector, PostgreSqlSplitListener };
10
9
  export class PostgreSQL extends BasicSQL {
11
10
  constructor() {
@@ -40,11 +39,8 @@ export class PostgreSQL extends BasicSQL {
40
39
  const parserContext = this;
41
40
  return new PostgreSqlErrorListener(_errorListener, parserContext, this.preferredRules);
42
41
  }
43
- createEntityCollector(input, caretTokenIndex) {
44
- return new PostgreSqlEntityCollector(input, caretTokenIndex);
45
- }
46
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
47
- return new PostgreSemanticContextCollector(input, caretPosition, allTokens, options);
42
+ createEntityCollector(input, allTokens, caretTokenIndex) {
43
+ return new PostgreSqlEntityCollector(input, allTokens, caretTokenIndex);
48
44
  }
49
45
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
50
46
  const originalSyntaxSuggestions = [];
@@ -1,22 +1,20 @@
1
- import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
2
1
  import { CandidatesCollection } from 'antlr4-c3';
2
+ import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { SparkSqlLexer } from '../../lib/spark/SparkSqlLexer';
4
- import { SparkSqlParser, ProgramContext } from '../../lib/spark/SparkSqlParser';
4
+ import { ProgramContext, SparkSqlParser } from '../../lib/spark/SparkSqlParser';
5
5
  import { BasicSQL } from '../common/basicSQL';
6
- import { Suggestions, CaretPosition, SemanticCollectOptions } from '../common/types';
7
- import { SparkSqlSplitListener } from './sparkSplitListener';
6
+ import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
8
  import { SparkEntityCollector } from './sparkEntityCollector';
9
9
  import { SparkErrorListener } from './sparkErrorListener';
10
- import { ErrorListener } from '../common/parseErrorListener';
11
- import { SparkSemanticContextCollector } from './sparkSemanticContextCollector';
12
- export { SparkSqlSplitListener, SparkEntityCollector };
10
+ import { SparkSqlSplitListener } from './sparkSplitListener';
11
+ export { SparkEntityCollector, SparkSqlSplitListener };
13
12
  export declare class SparkSQL extends BasicSQL<SparkSqlLexer, ProgramContext, SparkSqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): SparkSqlLexer;
15
14
  protected createParserFromTokenStream(tokenStream: CommonTokenStream): SparkSqlParser;
16
15
  protected preferredRules: Set<number>;
17
16
  protected get splitListener(): SparkSqlSplitListener;
18
17
  protected createErrorListener(_errorListener: ErrorListener): SparkErrorListener;
19
- protected createEntityCollector(input: string, caretTokenIndex?: number): SparkEntityCollector;
20
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): SparkSemanticContextCollector;
18
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): SparkEntityCollector;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,12 +1,11 @@
1
1
  import { SparkSqlLexer } from '../../lib/spark/SparkSqlLexer';
2
2
  import { SparkSqlParser } from '../../lib/spark/SparkSqlParser';
3
3
  import { BasicSQL } from '../common/basicSQL';
4
- import { EntityContextType, } from '../common/types';
5
- import { SparkSqlSplitListener } from './sparkSplitListener';
4
+ import { EntityContextType } from '../common/types';
6
5
  import { SparkEntityCollector } from './sparkEntityCollector';
7
6
  import { SparkErrorListener } from './sparkErrorListener';
8
- import { SparkSemanticContextCollector } from './sparkSemanticContextCollector';
9
- export { SparkSqlSplitListener, SparkEntityCollector };
7
+ import { SparkSqlSplitListener } from './sparkSplitListener';
8
+ export { SparkEntityCollector, SparkSqlSplitListener };
10
9
  export class SparkSQL extends BasicSQL {
11
10
  constructor() {
12
11
  super(...arguments);
@@ -36,11 +35,8 @@ export class SparkSQL extends BasicSQL {
36
35
  const parserContext = this;
37
36
  return new SparkErrorListener(_errorListener, parserContext, this.preferredRules);
38
37
  }
39
- createEntityCollector(input, caretTokenIndex) {
40
- return new SparkEntityCollector(input, caretTokenIndex);
41
- }
42
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
43
- return new SparkSemanticContextCollector(input, caretPosition, allTokens, options);
38
+ createEntityCollector(input, allTokens, caretTokenIndex) {
39
+ return new SparkEntityCollector(input, allTokens, caretTokenIndex);
44
40
  }
45
41
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
46
42
  const originalSyntaxSuggestions = [];
@@ -1,22 +1,20 @@
1
- import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
2
1
  import { CandidatesCollection } from 'antlr4-c3';
2
+ import { CharStream, CommonTokenStream, Token } from 'antlr4ng';
3
3
  import { TrinoSqlLexer } from '../../lib/trino/TrinoSqlLexer';
4
- import { TrinoSqlParser, ProgramContext } from '../../lib/trino/TrinoSqlParser';
4
+ import { ProgramContext, TrinoSqlParser } from '../../lib/trino/TrinoSqlParser';
5
5
  import { BasicSQL } from '../common/basicSQL';
6
- import { Suggestions, CaretPosition, SemanticCollectOptions } from '../common/types';
7
- import { TrinoSqlSplitListener } from './trinoSplitListener';
8
- import { TrinoEntityCollector } from './trinoEntityCollector';
9
6
  import { ErrorListener } from '../common/parseErrorListener';
7
+ import { Suggestions } from '../common/types';
8
+ import { TrinoEntityCollector } from './trinoEntityCollector';
10
9
  import { TrinoErrorListener } from './trinoErrorListener';
11
- import { TrinoSemanticContextCollector } from './trinoSemanticContextCollector';
12
- export { TrinoSqlSplitListener, TrinoEntityCollector };
10
+ import { TrinoSqlSplitListener } from './trinoSplitListener';
11
+ export { TrinoEntityCollector, TrinoSqlSplitListener };
13
12
  export declare class TrinoSQL extends BasicSQL<TrinoSqlLexer, ProgramContext, TrinoSqlParser> {
14
13
  protected createLexerFromCharStream(charStreams: CharStream): TrinoSqlLexer;
15
14
  protected createParserFromTokenStream(tokenStream: CommonTokenStream): TrinoSqlParser;
16
15
  protected get splitListener(): TrinoSqlSplitListener;
17
16
  protected createErrorListener(_errorListener: ErrorListener): TrinoErrorListener;
18
- protected createEntityCollector(input: string, caretTokenIndex?: number): TrinoEntityCollector;
19
- protected createSemanticContextCollector(input: string, caretPosition: CaretPosition, allTokens: Token[], options?: SemanticCollectOptions): TrinoSemanticContextCollector;
17
+ protected createEntityCollector(input: string, allTokens?: Token[], caretTokenIndex?: number): TrinoEntityCollector;
20
18
  protected preferredRules: Set<number>;
21
19
  protected processCandidates(candidates: CandidatesCollection, allTokens: Token[], caretTokenIndex: number, tokenIndexOffset: number): Suggestions<Token>;
22
20
  }
@@ -1,12 +1,11 @@
1
1
  import { TrinoSqlLexer } from '../../lib/trino/TrinoSqlLexer';
2
2
  import { TrinoSqlParser } from '../../lib/trino/TrinoSqlParser';
3
3
  import { BasicSQL } from '../common/basicSQL';
4
- import { EntityContextType, } from '../common/types';
5
- import { TrinoSqlSplitListener } from './trinoSplitListener';
4
+ import { EntityContextType } from '../common/types';
6
5
  import { TrinoEntityCollector } from './trinoEntityCollector';
7
6
  import { TrinoErrorListener } from './trinoErrorListener';
8
- import { TrinoSemanticContextCollector } from './trinoSemanticContextCollector';
9
- export { TrinoSqlSplitListener, TrinoEntityCollector };
7
+ import { TrinoSqlSplitListener } from './trinoSplitListener';
8
+ export { TrinoEntityCollector, TrinoSqlSplitListener };
10
9
  export class TrinoSQL extends BasicSQL {
11
10
  constructor() {
12
11
  super(...arguments);
@@ -38,11 +37,8 @@ export class TrinoSQL extends BasicSQL {
38
37
  const parserContext = this;
39
38
  return new TrinoErrorListener(_errorListener, parserContext, this.preferredRules);
40
39
  }
41
- createEntityCollector(input, caretTokenIndex) {
42
- return new TrinoEntityCollector(input, caretTokenIndex);
43
- }
44
- createSemanticContextCollector(input, caretPosition, allTokens, options) {
45
- return new TrinoSemanticContextCollector(input, caretPosition, allTokens, options);
40
+ createEntityCollector(input, allTokens, caretTokenIndex) {
41
+ return new TrinoEntityCollector(input, allTokens, caretTokenIndex);
46
42
  }
47
43
  processCandidates(candidates, allTokens, caretTokenIndex, tokenIndexOffset) {
48
44
  const originalSyntaxSuggestions = [];