@willbooster/tree-sitter-sql 3.0.4 → 4.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 +56 -76
- package/common/common.mjs +0 -17
- package/mysql/src/node-types.json +22989 -0
- package/oracle/src/node-types.json +51807 -0
- package/package.json +17 -6
- package/postgresql/src/node-types.json +25382 -0
- package/sqlite/grammar.js +14 -10
- 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 +23 -2
package/sqlite/grammar.js
CHANGED
|
@@ -7,21 +7,25 @@
|
|
|
7
7
|
// and its tokenizer, src/tokenize.c, and also reject what SQLite rejects while parsing, beyond those two files (e.g. an
|
|
8
8
|
// unknown join type, or ORDER BY on a SELECT before UNION).
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
blockComment,
|
|
12
|
-
commaSep,
|
|
13
|
-
commaSep1,
|
|
14
|
-
keyword,
|
|
15
|
-
keywordPattern,
|
|
16
|
-
keywords,
|
|
17
|
-
lineComment,
|
|
18
|
-
quoted,
|
|
19
|
-
} from '../common/common.mjs';
|
|
10
|
+
import { commaSep, commaSep1, keyword, keywordPattern, keywords } from '../common/common.mjs';
|
|
20
11
|
|
|
21
12
|
// The CLI injects the DSL before loading this grammar.
|
|
22
13
|
const { grammar, alias, choice, field, optional, prec, repeat, repeat1, reserved, seq, token } =
|
|
23
14
|
/** @type {typeof globalThis & import('@willbooster/web-tree-sitter/dsl').DSL} */ (globalThis);
|
|
24
15
|
|
|
16
|
+
// The tokens below contain no NUL character, which ends the input of SQLite and is therefore an error wherever it
|
|
17
|
+
// appears.
|
|
18
|
+
/**
|
|
19
|
+
* A literal enclosed in `quote`, in which two consecutive quotes stand for one.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} quote
|
|
22
|
+
*/
|
|
23
|
+
const quoted = (quote) => new RegExp(`${quote}([^${quote}\\x00]|${quote}${quote})*${quote}`);
|
|
24
|
+
|
|
25
|
+
const lineComment = seq('--', /[^\n\u0000]*/);
|
|
26
|
+
|
|
27
|
+
const blockComment = /\/\*[^*\u0000]*\*+([^/*\u0000][^*\u0000]*\*+)*\//;
|
|
28
|
+
|
|
25
29
|
const PREC = {
|
|
26
30
|
OR: 1,
|
|
27
31
|
AND: 2,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/tree-sitter-sqlite.wasm
CHANGED
|
Binary file
|
package/tree-sitter.json
CHANGED
|
@@ -10,12 +10,33 @@
|
|
|
10
10
|
"sql"
|
|
11
11
|
],
|
|
12
12
|
"injection-regex": "^sqlite$"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "postgresql",
|
|
16
|
+
"camelcase": "PostgreSQL",
|
|
17
|
+
"scope": "source.sql.postgresql",
|
|
18
|
+
"path": "postgresql",
|
|
19
|
+
"injection-regex": "^(postgres|postgresql|pgsql)$"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "mysql",
|
|
23
|
+
"camelcase": "MySQL",
|
|
24
|
+
"scope": "source.sql.mysql",
|
|
25
|
+
"path": "mysql",
|
|
26
|
+
"injection-regex": "^mysql$"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "oracle",
|
|
30
|
+
"camelcase": "Oracle",
|
|
31
|
+
"scope": "source.sql.oracle",
|
|
32
|
+
"path": "oracle",
|
|
33
|
+
"injection-regex": "^(oracle|plsql)$"
|
|
13
34
|
}
|
|
14
35
|
],
|
|
15
36
|
"metadata": {
|
|
16
|
-
"version": "
|
|
37
|
+
"version": "4.0.0",
|
|
17
38
|
"license": "MIT",
|
|
18
|
-
"description": "SQL grammars (SQLite) for tree-sitter",
|
|
39
|
+
"description": "SQL grammars (SQLite, PostgreSQL, MySQL, and Oracle) for tree-sitter",
|
|
19
40
|
"authors": [
|
|
20
41
|
{
|
|
21
42
|
"name": "WillBooster Inc."
|