dt-sql-parser 4.5.0-beta.1 → 4.5.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.
Files changed (40) hide show
  1. package/dist/lib/SQLParserBase.d.ts +1 -13
  2. package/dist/lib/SQLParserBase.js +5 -40
  3. package/dist/lib/flink/FlinkSqlLexer.d.ts +399 -397
  4. package/dist/lib/flink/FlinkSqlLexer.js +2504 -2489
  5. package/dist/lib/flink/FlinkSqlParser.d.ts +726 -617
  6. package/dist/lib/flink/FlinkSqlParser.js +4861 -3558
  7. package/dist/lib/flink/FlinkSqlParserListener.d.ts +90 -33
  8. package/dist/lib/flink/FlinkSqlParserVisitor.d.ts +57 -21
  9. package/dist/lib/hive/HiveSqlParser.d.ts +228 -274
  10. package/dist/lib/hive/HiveSqlParser.js +5912 -6304
  11. package/dist/lib/hive/HiveSqlParserListener.d.ts +0 -33
  12. package/dist/lib/hive/HiveSqlParserVisitor.d.ts +0 -21
  13. package/dist/lib/impala/ImpalaSqlParser.d.ts +103 -145
  14. package/dist/lib/impala/ImpalaSqlParser.js +3320 -3687
  15. package/dist/lib/impala/ImpalaSqlParserListener.d.ts +0 -33
  16. package/dist/lib/impala/ImpalaSqlParserVisitor.d.ts +0 -21
  17. package/dist/lib/mysql/MySqlParser.d.ts +94 -161
  18. package/dist/lib/mysql/MySqlParser.js +9499 -9959
  19. package/dist/lib/mysql/MySqlParserListener.d.ts +5 -79
  20. package/dist/lib/mysql/MySqlParserVisitor.d.ts +3 -49
  21. package/dist/lib/postgresql/PostgreSqlParser.d.ts +71 -108
  22. package/dist/lib/postgresql/PostgreSqlParser.js +10388 -13330
  23. package/dist/lib/postgresql/PostgreSqlParserListener.d.ts +0 -48
  24. package/dist/lib/postgresql/PostgreSqlParserVisitor.d.ts +0 -30
  25. package/dist/lib/spark/SparkSqlParser.d.ts +145 -185
  26. package/dist/lib/spark/SparkSqlParser.js +5109 -5420
  27. package/dist/lib/spark/SparkSqlParserListener.d.ts +0 -33
  28. package/dist/lib/spark/SparkSqlParserVisitor.d.ts +0 -21
  29. package/dist/parser/common/basicSQL.d.ts +17 -5
  30. package/dist/parser/common/basicSQL.js +74 -3
  31. package/dist/parser/common/entityCollector.js +2 -14
  32. package/dist/parser/flink/index.js +2 -5
  33. package/dist/parser/mysql/index.js +1 -3
  34. package/dist/parser/mysql/mysqlEntityCollector.d.ts +1 -2
  35. package/dist/parser/mysql/mysqlEntityCollector.js +3 -13
  36. package/dist/parser/mysql/mysqlErrorListener.js +0 -2
  37. package/dist/parser/postgresql/postgreEntityCollector.d.ts +1 -3
  38. package/dist/parser/postgresql/postgreEntityCollector.js +0 -13
  39. package/dist/parser/spark/index.js +1 -3
  40. package/package.json +1 -1
@@ -4,17 +4,5 @@ export declare abstract class SQLParserBase<T = antlr.ParserRuleContext> extends
4
4
  abstract program(): T;
5
5
  caretTokenIndex: number;
6
6
  entityCollecting: boolean;
7
- /**
8
- * Semantic predicate to determine whether to match empty column.
9
- *
10
- * Key design:
11
- * 1. Only match empty column in entityCollecting mode
12
- * 2. Check if caret position is at the empty column position
13
- * 3. In validate mode (entityCollecting=false), this predicate returns false
14
- * and reports an error to ensure incomplete SQL is caught
15
- *
16
- * IMPORTANT: This predicate should be used carefully to avoid affecting
17
- * prediction in non-entity-collecting contexts.
18
- */
19
- shouldMatchEmpty(ruleName?: string): boolean;
7
+ shouldMatchEmpty(): boolean;
20
8
  }
@@ -5,45 +5,10 @@ export class SQLParserBase extends antlr.Parser {
5
5
  this.caretTokenIndex = -1;
6
6
  this.entityCollecting = false;
7
7
  }
8
- /**
9
- * Semantic predicate to determine whether to match empty column.
10
- *
11
- * Key design:
12
- * 1. Only match empty column in entityCollecting mode
13
- * 2. Check if caret position is at the empty column position
14
- * 3. In validate mode (entityCollecting=false), this predicate returns false
15
- * and reports an error to ensure incomplete SQL is caught
16
- *
17
- * IMPORTANT: This predicate should be used carefully to avoid affecting
18
- * prediction in non-entity-collecting contexts.
19
- */
20
- shouldMatchEmpty(ruleName) {
21
- var _a, _b;
22
- // Only match in entityCollecting mode or when caret position is specified (suggestion mode)
23
- if (this.entityCollecting || this.caretTokenIndex >= 0) {
24
- // If no caret position specified, match all empty columns
25
- if (this.caretTokenIndex < 0) {
26
- return true;
27
- }
28
- // Check if caret is at the position where empty column would be
29
- const prevTokenIndex = (_a = this.tokenStream.LT(-1)) === null || _a === void 0 ? void 0 : _a.tokenIndex;
30
- const nextTokenIndex = (_b = this.tokenStream.LT(1)) === null || _b === void 0 ? void 0 : _b.tokenIndex;
31
- // Match if caret is between previous and next token
32
- if (prevTokenIndex !== undefined && nextTokenIndex !== undefined) {
33
- return prevTokenIndex <= this.caretTokenIndex && nextTokenIndex >= this.caretTokenIndex;
34
- }
35
- // If only previous token exists, match if caret is after it
36
- if (prevTokenIndex !== undefined) {
37
- return prevTokenIndex <= this.caretTokenIndex;
38
- }
39
- // If only next token exists, match if caret is before it
40
- if (nextTokenIndex !== undefined) {
41
- return nextTokenIndex >= this.caretTokenIndex;
42
- }
43
- return false;
44
- }
45
- // In pure validate mode, don't match empty columns
46
- // This allows ANTLR to report errors naturally
47
- return false;
8
+ shouldMatchEmpty() {
9
+ var _a, _b, _c, _d;
10
+ return this.entityCollecting
11
+ && ((_b = (_a = this.tokenStream.LT(-1)) === null || _a === void 0 ? void 0 : _a.tokenIndex) !== null && _b !== void 0 ? _b : Infinity) <= this.caretTokenIndex
12
+ && ((_d = (_c = this.tokenStream.LT(1)) === null || _c === void 0 ? void 0 : _c.tokenIndex) !== null && _d !== void 0 ? _d : -Infinity) >= this.caretTokenIndex;
48
13
  }
49
14
  }