dt-sql-parser 4.0.0-beta.4.5 → 4.0.0-beta.4.6
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/README.md +16 -16
- package/dist/lib/pgsql/PostgreSQLLexer.d.ts +561 -538
- package/dist/lib/pgsql/PostgreSQLLexer.js +3529 -3356
- package/dist/lib/pgsql/PostgreSQLLexer.js.map +1 -1
- package/dist/lib/pgsql/PostgreSQLParser.d.ts +4756 -3799
- package/dist/lib/pgsql/PostgreSQLParser.js +61779 -53458
- package/dist/lib/pgsql/PostgreSQLParser.js.map +1 -1
- package/dist/lib/pgsql/PostgreSQLParserListener.d.ts +757 -141
- package/dist/lib/pgsql/PostgreSQLParserListener.js +1 -1
- package/dist/lib/pgsql/PostgreSQLParserListener.js.map +1 -1
- package/dist/lib/pgsql/PostgreSQLParserVisitor.d.ts +481 -89
- package/dist/lib/pgsql/PostgreSQLParserVisitor.js +1 -1
- package/dist/lib/pgsql/PostgreSQLParserVisitor.js.map +1 -1
- package/dist/parser/common/basic-parser-types.d.ts +5 -1
- package/dist/parser/common/basic-parser-types.js +4 -0
- package/dist/parser/common/basic-parser-types.js.map +1 -1
- package/dist/parser/pgsql.d.ts +9 -2
- package/dist/parser/pgsql.js +107 -5
- package/dist/parser/pgsql.js.map +1 -1
- package/package.json +5 -4
- package/dist/lib/pgsql/PostgreSQLLexerBase.d.ts +0 -16
- package/dist/lib/pgsql/PostgreSQLLexerBase.js +0 -56
- package/dist/lib/pgsql/PostgreSQLLexerBase.js.map +0 -1
- package/dist/lib/pgsql/PostgreSQLParserBase.d.ts +0 -11
- package/dist/lib/pgsql/PostgreSQLParserBase.js +0 -96
- package/dist/lib/pgsql/PostgreSQLParserBase.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,9 +13,9 @@ English | [简体中文](./README-zh_CN.md)
|
|
|
13
13
|
[online-chat-img]: https://img.shields.io/discord/920616811261743104?logo=Molecule
|
|
14
14
|
[online-chat-url]: https://discord.gg/uVvq6mfPfa
|
|
15
15
|
|
|
16
|
-
dt-sql-parser is a **SQL Parser** project built with [ANTLR4](https://github.com/antlr/antlr4), and it's mainly for the **BigData**
|
|
16
|
+
dt-sql-parser is a **SQL Parser** project built with [ANTLR4](https://github.com/antlr/antlr4), and it's mainly for the **BigData** field. The [ANTLR4](https://github.com/antlr/antlr4) generated the basic Parser, Visitor, and Listener, so it's easy to complete the **syntax validation**, **tokenizer**, **traverse** the AST, and so on features.
|
|
17
17
|
|
|
18
|
-
Additionally, it provides auxiliary functions such as SQL splitting and
|
|
18
|
+
Additionally, it provides auxiliary functions such as **SQL splitting** and **code completion**.
|
|
19
19
|
|
|
20
20
|
**Supported SQL**:
|
|
21
21
|
|
|
@@ -29,15 +29,15 @@ Additionally, it provides auxiliary functions such as SQL splitting and Auto-Com
|
|
|
29
29
|
|
|
30
30
|
**Supported auxiliary methods**
|
|
31
31
|
|
|
32
|
-
| SQL Type | SQL
|
|
33
|
-
| ----------- |
|
|
34
|
-
| Generic SQL | WIP
|
|
35
|
-
| Flink SQL | ✅
|
|
36
|
-
| Spark SQL | ✅
|
|
37
|
-
| Hive SQL | ✅
|
|
38
|
-
| PL/SQL | WIP
|
|
39
|
-
|
|
|
40
|
-
| Trino SQL | ✅
|
|
32
|
+
| SQL Type | SQL Spliting | Code Completion |
|
|
33
|
+
| ----------- | ------------ | --------------- |
|
|
34
|
+
| Generic SQL | WIP | WIP |
|
|
35
|
+
| Flink SQL | ✅ | ✅ |
|
|
36
|
+
| Spark SQL | ✅ | ✅ |
|
|
37
|
+
| Hive SQL | ✅ | ✅ |
|
|
38
|
+
| PL/SQL | WIP | WIP |
|
|
39
|
+
| PostgreSQL | ✅ | ✅ |
|
|
40
|
+
| Trino SQL | ✅ | ✅ |
|
|
41
41
|
|
|
42
42
|
>Tips: This project is the default for Javascript language, also you can try to compile it to other languages if you need.
|
|
43
43
|
|
|
@@ -68,13 +68,13 @@ We recommend learning the Fundamentals usage before continuing. The dt-sql-parse
|
|
|
68
68
|
import { GenericSQL, FlinkSQL, SparkSQL, HiveSQL, PLSQL, PostgresSQL, TrinoSQL } from 'dt-sql-parser';
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Before
|
|
71
|
+
Before using syntax validation, code completion, and other features, it is necessary to instantiate the Parser of the relevant SQL type.
|
|
72
72
|
For instance, one can consider using `GenericSQL` as an example:
|
|
73
73
|
```javascript
|
|
74
74
|
const parser = new GenericSQL();
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
The following usage examples will utilize the `GenericSQL`, and the Parser for other SQL types will be
|
|
77
|
+
The following usage examples will utilize the `GenericSQL`, and the Parser for other SQL types will be used in a similar manner as `GenericSQL`.
|
|
78
78
|
|
|
79
79
|
### Syntax Validation
|
|
80
80
|
```javascript
|
|
@@ -256,10 +256,10 @@ console.log(sqlSlices)
|
|
|
256
256
|
```
|
|
257
257
|
|
|
258
258
|
### Code Completion
|
|
259
|
-
Obtaining
|
|
259
|
+
Obtaining code completion information at a specified position in SQL.
|
|
260
260
|
We can refer to the example of using `FlinkSQL`.
|
|
261
261
|
|
|
262
|
-
Invoke the `getSuggestionAtCaretPosition` method, pass the SQL content and the row and column numbers indicating the position where
|
|
262
|
+
Invoke the `getSuggestionAtCaretPosition` method, pass the SQL content and the row and column numbers indicating the position where code completion is desired.
|
|
263
263
|
+ keyword candidates list
|
|
264
264
|
|
|
265
265
|
```javascript
|
|
@@ -313,7 +313,7 @@ Invoke the `getSuggestionAtCaretPosition` method, pass the SQL content and the r
|
|
|
313
313
|
]
|
|
314
314
|
*/
|
|
315
315
|
```
|
|
316
|
-
The grammar-related
|
|
316
|
+
The grammar-related code completion information returns an array, where each item represents what grammar can be filled in at that position. For example, the output in the above example represents that the position can be filled with either a **table name** or **a view name**. In this case, `syntaxContextType` represents the type of grammar that can be completed, and `wordRanges` represents the content that has already been filled.
|
|
317
317
|
|
|
318
318
|
### Other API
|
|
319
319
|
|