docs: prettier md format
This commit is contained in:
		@ -7,7 +7,7 @@
 | 
			
		||||
 | 
			
		||||
[English](./README.md) | 简体中文
 | 
			
		||||
 | 
			
		||||
dt-sql-parser 是一个基于 [ANTLR4](https://github.com/antlr/antlr4) 开发的, 针对大数据领域的 `SQL Parser` 项目。通过[ANTLR4](https://github.com/antlr/antlr4) 默认生成的 Parser、Visitor 和 Listener 对象,我们可以轻松的做到对 SQL 语句的`语法检查`(Syntax Validation)、`词法分析`(Tokenizer)、 `遍历 AST` 节点等功能。此外,还提供了几个辅助方法, 例如 SQL 切分(Split)、过滤 SQL 语句中的 `--` 和 `/**/` 等类型的注释。
 | 
			
		||||
dt-sql-parser 是一个基于 [ANTLR4](https://github.com/antlr/antlr4) 开发的, 针对大数据领域的 **SQL Parser** 项目。通过[ANTLR4](https://github.com/antlr/antlr4) 默认生成的 Parser、Visitor 和 Listener 对象,我们可以轻松的做到对 SQL 语句的**语法检查**(Syntax Validation)、**词法分析**(Tokenizer)、 **遍历 AST** 节点等功能。此外,还提供了几个辅助方法, 例如 SQL 切分(Split)、过滤 SQL 语句中的 `--` 和 `/**/` 等类型的注释。
 | 
			
		||||
 | 
			
		||||
已支持的 SQL 类型:
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,7 @@ yarn add dt-sql-parser
 | 
			
		||||
### 语法校验(Syntax Validation)
 | 
			
		||||
 | 
			
		||||
首先需要声明相应的 Parser 对象,不同的 SQL 类型需要引入不同的 Parser 对象处理,例如如果是
 | 
			
		||||
针对 `Flink SQL`,则需要单独引入 `FlinkSQL` Parser,这里我们使用 `GenericSQL` 作为示例:
 | 
			
		||||
针对 **Flink SQL**,则需要单独引入 **FlinkSQL** Parser,这里我们使用 **GenericSQL** 作为示例:
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
import { GenericSQL } from 'dt-sql-parser';
 | 
			
		||||
@ -78,7 +78,7 @@ console.log(errors);
 | 
			
		||||
*/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
先实例化 Parser 对象,然后使用 `validate` 方法对 SQL 语句进行校验,如果校验失败,则返回一个包含 `Error` 信息的数组。
 | 
			
		||||
先实例化 Parser 对象,然后使用 `validate` 方法对 SQL 语句进行校验,如果校验失败,则返回一个包含 `error` 信息的数组。
 | 
			
		||||
 | 
			
		||||
### 词法分析(Tokenizer)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							@ -7,9 +7,9 @@ English | [简体中文](./README-zh_CN.md)
 | 
			
		||||
[npm-image]: https://img.shields.io/npm/v/dt-sql-parser.svg?style=flat-square
 | 
			
		||||
[npm-url]: https://www.npmjs.com/package/dt-sql-parser
 | 
			
		||||
 | 
			
		||||
dt-sql-parser is a `SQL Parser` project built with [ANTLR4](https://github.com/antlr/antlr4), and it's mainly for the `BigData` domain. 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.
 | 
			
		||||
dt-sql-parser is a **SQL Parser** project built with [ANTLR4](https://github.com/antlr/antlr4), and it's mainly for the **BigData** domain. 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.
 | 
			
		||||
 | 
			
		||||
Besides, it' provides some helper methods, like `split` SQL, and filter the `--` and `/**/` types of comments in SQL.
 | 
			
		||||
Besides, it' provides some helper methods, like **split** SQL, and filter the `--` and `/**/` types of comments in SQL.
 | 
			
		||||
 | 
			
		||||
> Tips: This project is the default for Javascript language, also you can try to compile it to other languages if you need.
 | 
			
		||||
 | 
			
		||||
@ -35,10 +35,10 @@ yarn add dt-sql-parser
 | 
			
		||||
 | 
			
		||||
### Syntax Validation
 | 
			
		||||
 | 
			
		||||
First, we need to import the `Parser` object from `dt-sql-parser`, the different language needs
 | 
			
		||||
different Parser, so if you need to handle the `Flink SQL`, you can import the `FlinkSQL Parser`.
 | 
			
		||||
First, we need to import the **Parser** object from `dt-sql-parser`, the different language needs
 | 
			
		||||
different Parser, so if you need to handle the **Flink SQL**, you can import the **FlinkSQL Parser**.
 | 
			
		||||
 | 
			
		||||
The below is a `GenericSQL Parser` example:
 | 
			
		||||
The below is a **GenericSQL Parser** example:
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
import { GenericSQL } from 'dt-sql-parser';
 | 
			
		||||
@ -82,12 +82,12 @@ output:
 | 
			
		||||
*/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
We instanced a Parser object, and use the `validate` method to check the SQL syntax, if failed
 | 
			
		||||
returns an array object includes `error` message.
 | 
			
		||||
We instanced a Parser object, and use the **validate** method to check the SQL syntax, if failed
 | 
			
		||||
returns an array object includes **error** message.
 | 
			
		||||
 | 
			
		||||
### Tokenizer
 | 
			
		||||
 | 
			
		||||
You can also the all `tokens` by the Parser:
 | 
			
		||||
You can also the all **tokens** by the Parser:
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
import { GenericSQL } from 'dt-sql-parser';
 | 
			
		||||
@ -152,7 +152,7 @@ TableName user1
 | 
			
		||||
 | 
			
		||||
### Listener
 | 
			
		||||
 | 
			
		||||
access the specified node in the AST by Listener pattern
 | 
			
		||||
Access the specified node in the AST by the Listener
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
import { GenericSQL, SqlParserListener } from 'dt-sql-parser';
 | 
			
		||||
@ -185,7 +185,7 @@ TableName user1
 | 
			
		||||
 | 
			
		||||
### Clean
 | 
			
		||||
 | 
			
		||||
Clear the `comments` and `spaces` before and after
 | 
			
		||||
Clear the **comments** and **spaces** before and after
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
import { cleanSql } from 'dt-sql-parser';
 | 
			
		||||
@ -202,7 +202,7 @@ select id,name from user1;
 | 
			
		||||
 | 
			
		||||
### Split SQL
 | 
			
		||||
 | 
			
		||||
When the SQL text is very big, you can think about to split it by `;` , and handle each line.
 | 
			
		||||
When the SQL text is very big, you can think about to split it by `;` , and handle it by each line.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
import { splitSql } from 'dt-sql-parser';
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user