@willbooster/tree-sitter-sql 4.0.0 → 5.0.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.
- package/README.md +19 -23
- package/mysql/src/node-types.json +5361 -19850
- package/oracle/src/node-types.json +8786 -48891
- package/package.json +4 -5
- package/postgresql/src/node-types.json +8543 -23838
- package/tree-sitter-mysql.wasm +0 -0
- package/tree-sitter-oracle.wasm +0 -0
- package/tree-sitter-postgresql.wasm +0 -0
- package/tree-sitter-sqlite.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-sql/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-sql/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-sql)
|
|
10
10
|
|
|
11
11
|
SQL grammars for [tree-sitter](https://github.com/tree-sitter/tree-sitter), generated with the
|
|
@@ -15,8 +15,8 @@ reject. The supported WillBooster runtime is version 23.0.0 or later in the 23.x
|
|
|
15
15
|
|
|
16
16
|
## Dialects
|
|
17
17
|
|
|
18
|
-
Each dialect has its own grammar and external scanner in `<dialect>/`, built independently on top of
|
|
19
|
-
helpers in `common/common.mjs`:
|
|
18
|
+
Each dialect has its own grammar and, except MySQL, an external scanner in `<dialect>/`, built independently on top of
|
|
19
|
+
the small DSL helpers in `common/common.mjs`:
|
|
20
20
|
|
|
21
21
|
| Dialect | Directory | Wasm file | Rust constants | Cargo feature |
|
|
22
22
|
| -------------------------------------------------------------------------------------------- | ------------- | ----------------------------- | ---------------------------------------------- | ------------- |
|
|
@@ -25,29 +25,25 @@ helpers in `common/common.mjs`:
|
|
|
25
25
|
| [MySQL](https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html) 8.4 | `mysql/` | `tree-sitter-mysql.wasm` | `LANGUAGE_MYSQL`, `MYSQL_NODE_TYPES` | `mysql` |
|
|
26
26
|
| [Oracle Database](https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/) 23ai | `oracle/` | `tree-sitter-oracle.wasm` | `LANGUAGE_ORACLE`, `ORACLE_NODE_TYPES` | `oracle` |
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
programs (`CREATE PROCEDURE`, `CREATE FUNCTION`, `CREATE TRIGGER`, `CREATE EVENT`) and executable versioned comments
|
|
39
|
-
(`/*! ... */` and `/*!50700 ... */`). Client `mysql` directives (`DELIMITER`, `SOURCE`) yield syntax errors.
|
|
40
|
-
- `oracle` follows Oracle Database 23ai's documented SQL and embedded PL/SQL syntax (`CREATE TRIGGER`, `CREATE FUNCTION`,
|
|
41
|
-
`CREATE PROCEDURE`, `CREATE PACKAGE`, `CREATE TYPE`, anonymous `DECLARE`/`BEGIN` blocks, and inline `WITH` functions
|
|
42
|
-
and procedures). Client SQL*Plus directives (`REM`, `SET`, `CONNECT`, `PROMPT`, `SPOOL`, `@`, standalone `/`) yield
|
|
43
|
-
syntax errors.
|
|
28
|
+
`sqlite` follows SQLite's parser (`src/parse.y`) and tokenizer (`src/tokenize.c`) in its default build, except for
|
|
29
|
+
`OVER` as an alias without `AS` before `WINDOW` after a non-call closing parenthesis (such as
|
|
30
|
+
`SELECT (1) OVER WINDOW w AS ()`), a NUL character (which ends input for SQLite's C parser), and invalid UTF-8/UTF-16.
|
|
31
|
+
It rejects what SQLite's parser grammar and tokenizer reject, plus single-clause shape checks; semantic, compile-time,
|
|
32
|
+
scope, label, numeric-range, limit, catalog, and cross-clause errors are accepted without `ERROR` nodes.
|
|
33
|
+
|
|
34
|
+
The other three grammars favor size and speed over completeness: they target the SQL found in application code and
|
|
35
|
+
schema scripts, give structured trees to its common statements, and parse most other statements as a
|
|
36
|
+
`generic_statement` of words, literals, operators, and parenthesized groups up to the next statement terminator.
|
|
37
|
+
Rarely written clauses inside structured statements yield `ERROR` nodes, and some invalid input parses without them.
|
|
44
38
|
|
|
45
39
|
## Support Scope
|
|
46
40
|
|
|
47
|
-
This repository maintains only full parsing
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
This repository maintains only full parsing, optimized for binary size and parse speed: valid code as found in
|
|
42
|
+
real-world projects yields a correct tree, other valid code yields a correct tree or one with `ERROR` or `MISSING`
|
|
43
|
+
nodes, and any input parses without crashing, hanging, or taking more than linear time. Invalid input may parse without
|
|
44
|
+
`ERROR` or `MISSING` nodes. Incremental parsing is not supported, and no queries (highlights, locals, injections, tags)
|
|
45
|
+
are shipped. Node types, field names, and the trees that error recovery produces may change; such changes are released
|
|
46
|
+
as new major versions.
|
|
51
47
|
|
|
52
48
|
## Usage
|
|
53
49
|
|