@willbooster/tree-sitter-sql 5.0.0 → 7.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 +12 -13
- package/common/common.mjs +2 -9
- package/mysql/src/node-types.json +9 -5
- package/oracle/src/node-types.json +275 -0
- package/package.json +3 -3
- package/postgresql/src/node-types.json +8 -0
- package/sqlite/grammar.js +6 -5
- 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
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
SQL grammars for [tree-sitter](https://github.com/tree-sitter/tree-sitter), generated with the
|
|
12
12
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. Each generated `TSLanguage` carries
|
|
13
|
-
the WillBooster ABI (`
|
|
14
|
-
reject. The supported WillBooster runtime is version
|
|
13
|
+
the WillBooster ABI (`0x5742000e`), which upstream `tree-sitter` runtimes and WillBooster runtimes prior to 23.1.0
|
|
14
|
+
reject. The supported WillBooster runtime is version 26.3.0 through 27.x.
|
|
15
15
|
|
|
16
16
|
## Dialects
|
|
17
17
|
|
|
18
|
-
Each dialect has its own grammar and
|
|
19
|
-
|
|
18
|
+
Each dialect has its own grammar and external scanner in `<dialect>/`, built independently on top of the small DSL
|
|
19
|
+
helpers in `common/common.mjs`:
|
|
20
20
|
|
|
21
21
|
| Dialect | Directory | Wasm file | Rust constants | Cargo feature |
|
|
22
22
|
| -------------------------------------------------------------------------------------------- | ------------- | ----------------------------- | ---------------------------------------------- | ------------- |
|
|
@@ -39,17 +39,16 @@ Rarely written clauses inside structured statements yield `ERROR` nodes, and som
|
|
|
39
39
|
## Support Scope
|
|
40
40
|
|
|
41
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,
|
|
43
|
-
nodes, and
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
as new major versions.
|
|
42
|
+
real-world projects yields a correct tree, rare valid syntax whose support would noticeably grow the parser may instead
|
|
43
|
+
yield `ERROR` or `MISSING` nodes, and valid code never yields an incorrect tree without them. Any input parses without
|
|
44
|
+
crashing, hanging, or taking more than linear time. Invalid input may parse without `ERROR` or `MISSING` nodes.
|
|
45
|
+
Incremental parsing is not supported, and no queries (highlights, locals, injections, tags) are shipped. Node types,
|
|
46
|
+
field names, and the trees that error recovery produces may change; such changes are released as new major versions.
|
|
47
47
|
|
|
48
48
|
## Usage
|
|
49
49
|
|
|
50
50
|
The npm package ships one `.wasm` file per dialect for
|
|
51
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
52
|
-
the 23.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers. Replace `tree-sitter-sqlite.wasm` in the
|
|
51
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 26.3.0 through 27.x, which runs in Node.js, Bun, browsers, and Cloudflare Workers. Replace `tree-sitter-sqlite.wasm` in the
|
|
53
52
|
examples below with `tree-sitter-postgresql.wasm`, `tree-sitter-mysql.wasm`, or `tree-sitter-oracle.wasm` for another
|
|
54
53
|
dialect.
|
|
55
54
|
|
|
@@ -96,10 +95,10 @@ The package also ships each dialect's `src/node-types.json`, `sqlite/grammar.js`
|
|
|
96
95
|
`common/common.mjs`, and `tree-sitter.json`.
|
|
97
96
|
|
|
98
97
|
In Rust, depend on [willbooster-tree-sitter-sql](https://crates.io/crates/willbooster-tree-sitter-sql) and on
|
|
99
|
-
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter) version
|
|
98
|
+
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter) version 26.3.0 through 27.x:
|
|
100
99
|
|
|
101
100
|
```sh
|
|
102
|
-
cargo add willbooster-tree-sitter@
|
|
101
|
+
cargo add willbooster-tree-sitter@27.0.0 --rename tree-sitter
|
|
103
102
|
cargo add willbooster-tree-sitter-sql --rename tree-sitter-sql
|
|
104
103
|
```
|
|
105
104
|
|
package/common/common.mjs
CHANGED
|
@@ -3,23 +3,16 @@
|
|
|
3
3
|
/** @import {RuleOrLiteral} from '@willbooster/web-tree-sitter/dsl' */
|
|
4
4
|
|
|
5
5
|
// The CLI injects the DSL before loading the grammar that imports this module.
|
|
6
|
-
const {
|
|
6
|
+
const { optional, repeat, seq } = /** @type {typeof globalThis & import('@willbooster/web-tree-sitter/dsl').DSL} */ (
|
|
7
7
|
globalThis
|
|
8
8
|
);
|
|
9
9
|
|
|
10
|
-
// SQL keywords are ASCII words that match without regard to case. A pattern with the `i` flag would also match the
|
|
11
|
-
// Unicode characters that fold to an ASCII letter (e.g. U+212A KELVIN SIGN for `k`), which SQL dialects read as an
|
|
12
|
-
// identifier, so each letter lists its two ASCII cases instead.
|
|
13
|
-
/** @param {string} word */
|
|
14
|
-
export const keywordPattern = (word) =>
|
|
15
|
-
new RegExp(word.replaceAll(/[A-Za-z]/g, (letter) => `[${letter.toUpperCase()}${letter.toLowerCase()}]`));
|
|
16
|
-
|
|
17
10
|
/**
|
|
18
11
|
* A keyword token, which appears in the tree as an anonymous node named after the keyword in upper case.
|
|
19
12
|
*
|
|
20
13
|
* @param {string} word
|
|
21
14
|
*/
|
|
22
|
-
export const keyword = (word) =>
|
|
15
|
+
export const keyword = (word) => word.toUpperCase();
|
|
23
16
|
|
|
24
17
|
/**
|
|
25
18
|
* A sequence of keywords separated by spaces in `phrase`, such as `'PRIMARY KEY'`.
|
|
@@ -6327,6 +6327,10 @@
|
|
|
6327
6327
|
{
|
|
6328
6328
|
"type": "_statement",
|
|
6329
6329
|
"named": true
|
|
6330
|
+
},
|
|
6331
|
+
{
|
|
6332
|
+
"type": "delimiter_command",
|
|
6333
|
+
"named": true
|
|
6330
6334
|
}
|
|
6331
6335
|
]
|
|
6332
6336
|
}
|
|
@@ -6530,7 +6534,7 @@
|
|
|
6530
6534
|
"fields": {},
|
|
6531
6535
|
"children": {
|
|
6532
6536
|
"multiple": true,
|
|
6533
|
-
"required":
|
|
6537
|
+
"required": true,
|
|
6534
6538
|
"types": [
|
|
6535
6539
|
{
|
|
6536
6540
|
"type": "boolean_literal",
|
|
@@ -7788,10 +7792,6 @@
|
|
|
7788
7792
|
"type": "DELETE",
|
|
7789
7793
|
"named": false
|
|
7790
7794
|
},
|
|
7791
|
-
{
|
|
7792
|
-
"type": "DELIMITER",
|
|
7793
|
-
"named": false
|
|
7794
|
-
},
|
|
7795
7795
|
{
|
|
7796
7796
|
"type": "DESC",
|
|
7797
7797
|
"named": false
|
|
@@ -8461,6 +8461,10 @@
|
|
|
8461
8461
|
"type": "default",
|
|
8462
8462
|
"named": true
|
|
8463
8463
|
},
|
|
8464
|
+
{
|
|
8465
|
+
"type": "delimiter_command",
|
|
8466
|
+
"named": true
|
|
8467
|
+
},
|
|
8464
8468
|
{
|
|
8465
8469
|
"type": "identifier",
|
|
8466
8470
|
"named": true
|
|
@@ -275,6 +275,10 @@
|
|
|
275
275
|
"type": "function_call",
|
|
276
276
|
"named": true
|
|
277
277
|
},
|
|
278
|
+
{
|
|
279
|
+
"type": "generalized_invocation",
|
|
280
|
+
"named": true
|
|
281
|
+
},
|
|
278
282
|
{
|
|
279
283
|
"type": "in_expression",
|
|
280
284
|
"named": true
|
|
@@ -390,6 +394,10 @@
|
|
|
390
394
|
"type": "function_call",
|
|
391
395
|
"named": true
|
|
392
396
|
},
|
|
397
|
+
{
|
|
398
|
+
"type": "generalized_invocation",
|
|
399
|
+
"named": true
|
|
400
|
+
},
|
|
393
401
|
{
|
|
394
402
|
"type": "identifier",
|
|
395
403
|
"named": true
|
|
@@ -598,6 +606,10 @@
|
|
|
598
606
|
"type": "function_call",
|
|
599
607
|
"named": true
|
|
600
608
|
},
|
|
609
|
+
{
|
|
610
|
+
"type": "generalized_invocation",
|
|
611
|
+
"named": true
|
|
612
|
+
},
|
|
601
613
|
{
|
|
602
614
|
"type": "in_expression",
|
|
603
615
|
"named": true
|
|
@@ -736,6 +748,10 @@
|
|
|
736
748
|
"type": "function_call",
|
|
737
749
|
"named": true
|
|
738
750
|
},
|
|
751
|
+
{
|
|
752
|
+
"type": "generalized_invocation",
|
|
753
|
+
"named": true
|
|
754
|
+
},
|
|
739
755
|
{
|
|
740
756
|
"type": "in_expression",
|
|
741
757
|
"named": true
|
|
@@ -852,6 +868,10 @@
|
|
|
852
868
|
"type": "function_call",
|
|
853
869
|
"named": true
|
|
854
870
|
},
|
|
871
|
+
{
|
|
872
|
+
"type": "generalized_invocation",
|
|
873
|
+
"named": true
|
|
874
|
+
},
|
|
855
875
|
{
|
|
856
876
|
"type": "in_expression",
|
|
857
877
|
"named": true
|
|
@@ -967,6 +987,10 @@
|
|
|
967
987
|
"type": "function_call",
|
|
968
988
|
"named": true
|
|
969
989
|
},
|
|
990
|
+
{
|
|
991
|
+
"type": "generalized_invocation",
|
|
992
|
+
"named": true
|
|
993
|
+
},
|
|
970
994
|
{
|
|
971
995
|
"type": "in_expression",
|
|
972
996
|
"named": true
|
|
@@ -1082,6 +1106,10 @@
|
|
|
1082
1106
|
"type": "function_call",
|
|
1083
1107
|
"named": true
|
|
1084
1108
|
},
|
|
1109
|
+
{
|
|
1110
|
+
"type": "generalized_invocation",
|
|
1111
|
+
"named": true
|
|
1112
|
+
},
|
|
1085
1113
|
{
|
|
1086
1114
|
"type": "in_expression",
|
|
1087
1115
|
"named": true
|
|
@@ -1274,6 +1302,10 @@
|
|
|
1274
1302
|
"type": "function_call",
|
|
1275
1303
|
"named": true
|
|
1276
1304
|
},
|
|
1305
|
+
{
|
|
1306
|
+
"type": "generalized_invocation",
|
|
1307
|
+
"named": true
|
|
1308
|
+
},
|
|
1277
1309
|
{
|
|
1278
1310
|
"type": "in_expression",
|
|
1279
1311
|
"named": true
|
|
@@ -1442,6 +1474,10 @@
|
|
|
1442
1474
|
"type": "pipe_row_statement",
|
|
1443
1475
|
"named": true
|
|
1444
1476
|
},
|
|
1477
|
+
{
|
|
1478
|
+
"type": "pragma",
|
|
1479
|
+
"named": true
|
|
1480
|
+
},
|
|
1445
1481
|
{
|
|
1446
1482
|
"type": "quoted_identifier",
|
|
1447
1483
|
"named": true
|
|
@@ -1553,6 +1589,10 @@
|
|
|
1553
1589
|
"type": "function_call",
|
|
1554
1590
|
"named": true
|
|
1555
1591
|
},
|
|
1592
|
+
{
|
|
1593
|
+
"type": "generalized_invocation",
|
|
1594
|
+
"named": true
|
|
1595
|
+
},
|
|
1556
1596
|
{
|
|
1557
1597
|
"type": "in_expression",
|
|
1558
1598
|
"named": true
|
|
@@ -1676,6 +1716,10 @@
|
|
|
1676
1716
|
"type": "function_call",
|
|
1677
1717
|
"named": true
|
|
1678
1718
|
},
|
|
1719
|
+
{
|
|
1720
|
+
"type": "generalized_invocation",
|
|
1721
|
+
"named": true
|
|
1722
|
+
},
|
|
1679
1723
|
{
|
|
1680
1724
|
"type": "identifier",
|
|
1681
1725
|
"named": true
|
|
@@ -1830,6 +1874,10 @@
|
|
|
1830
1874
|
"type": "function_call",
|
|
1831
1875
|
"named": true
|
|
1832
1876
|
},
|
|
1877
|
+
{
|
|
1878
|
+
"type": "generalized_invocation",
|
|
1879
|
+
"named": true
|
|
1880
|
+
},
|
|
1833
1881
|
{
|
|
1834
1882
|
"type": "identifier",
|
|
1835
1883
|
"named": true
|
|
@@ -1978,6 +2026,10 @@
|
|
|
1978
2026
|
"type": "function_call",
|
|
1979
2027
|
"named": true
|
|
1980
2028
|
},
|
|
2029
|
+
{
|
|
2030
|
+
"type": "generalized_invocation",
|
|
2031
|
+
"named": true
|
|
2032
|
+
},
|
|
1981
2033
|
{
|
|
1982
2034
|
"type": "identifier",
|
|
1983
2035
|
"named": true
|
|
@@ -2340,6 +2392,10 @@
|
|
|
2340
2392
|
"type": "function_call",
|
|
2341
2393
|
"named": true
|
|
2342
2394
|
},
|
|
2395
|
+
{
|
|
2396
|
+
"type": "generalized_invocation",
|
|
2397
|
+
"named": true
|
|
2398
|
+
},
|
|
2343
2399
|
{
|
|
2344
2400
|
"type": "identifier",
|
|
2345
2401
|
"named": true
|
|
@@ -3452,6 +3508,10 @@
|
|
|
3452
3508
|
"type": "pipe_row_statement",
|
|
3453
3509
|
"named": true
|
|
3454
3510
|
},
|
|
3511
|
+
{
|
|
3512
|
+
"type": "pragma",
|
|
3513
|
+
"named": true
|
|
3514
|
+
},
|
|
3455
3515
|
{
|
|
3456
3516
|
"type": "raise_statement",
|
|
3457
3517
|
"named": true
|
|
@@ -3571,6 +3631,10 @@
|
|
|
3571
3631
|
"type": "function_call",
|
|
3572
3632
|
"named": true
|
|
3573
3633
|
},
|
|
3634
|
+
{
|
|
3635
|
+
"type": "generalized_invocation",
|
|
3636
|
+
"named": true
|
|
3637
|
+
},
|
|
3574
3638
|
{
|
|
3575
3639
|
"type": "generic_statement",
|
|
3576
3640
|
"named": true
|
|
@@ -3651,6 +3715,10 @@
|
|
|
3651
3715
|
"type": "pipe_row_statement",
|
|
3652
3716
|
"named": true
|
|
3653
3717
|
},
|
|
3718
|
+
{
|
|
3719
|
+
"type": "pragma",
|
|
3720
|
+
"named": true
|
|
3721
|
+
},
|
|
3654
3722
|
{
|
|
3655
3723
|
"type": "raise_statement",
|
|
3656
3724
|
"named": true
|
|
@@ -3837,6 +3905,10 @@
|
|
|
3837
3905
|
"type": "pipe_row_statement",
|
|
3838
3906
|
"named": true
|
|
3839
3907
|
},
|
|
3908
|
+
{
|
|
3909
|
+
"type": "pragma",
|
|
3910
|
+
"named": true
|
|
3911
|
+
},
|
|
3840
3912
|
{
|
|
3841
3913
|
"type": "quoted_identifier",
|
|
3842
3914
|
"named": true
|
|
@@ -3931,6 +4003,10 @@
|
|
|
3931
4003
|
"type": "function_call",
|
|
3932
4004
|
"named": true
|
|
3933
4005
|
},
|
|
4006
|
+
{
|
|
4007
|
+
"type": "generalized_invocation",
|
|
4008
|
+
"named": true
|
|
4009
|
+
},
|
|
3934
4010
|
{
|
|
3935
4011
|
"type": "in_expression",
|
|
3936
4012
|
"named": true
|
|
@@ -4061,6 +4137,10 @@
|
|
|
4061
4137
|
"type": "function_call",
|
|
4062
4138
|
"named": true
|
|
4063
4139
|
},
|
|
4140
|
+
{
|
|
4141
|
+
"type": "generalized_invocation",
|
|
4142
|
+
"named": true
|
|
4143
|
+
},
|
|
4064
4144
|
{
|
|
4065
4145
|
"type": "identifier",
|
|
4066
4146
|
"named": true
|
|
@@ -4184,6 +4264,10 @@
|
|
|
4184
4264
|
"type": "function_call",
|
|
4185
4265
|
"named": true
|
|
4186
4266
|
},
|
|
4267
|
+
{
|
|
4268
|
+
"type": "generalized_invocation",
|
|
4269
|
+
"named": true
|
|
4270
|
+
},
|
|
4187
4271
|
{
|
|
4188
4272
|
"type": "in_expression",
|
|
4189
4273
|
"named": true
|
|
@@ -4299,6 +4383,10 @@
|
|
|
4299
4383
|
"type": "function_call",
|
|
4300
4384
|
"named": true
|
|
4301
4385
|
},
|
|
4386
|
+
{
|
|
4387
|
+
"type": "generalized_invocation",
|
|
4388
|
+
"named": true
|
|
4389
|
+
},
|
|
4302
4390
|
{
|
|
4303
4391
|
"type": "in_expression",
|
|
4304
4392
|
"named": true
|
|
@@ -4414,6 +4502,10 @@
|
|
|
4414
4502
|
"type": "function_call",
|
|
4415
4503
|
"named": true
|
|
4416
4504
|
},
|
|
4505
|
+
{
|
|
4506
|
+
"type": "generalized_invocation",
|
|
4507
|
+
"named": true
|
|
4508
|
+
},
|
|
4417
4509
|
{
|
|
4418
4510
|
"type": "in_expression",
|
|
4419
4511
|
"named": true
|
|
@@ -4533,6 +4625,10 @@
|
|
|
4533
4625
|
"type": "function_call",
|
|
4534
4626
|
"named": true
|
|
4535
4627
|
},
|
|
4628
|
+
{
|
|
4629
|
+
"type": "generalized_invocation",
|
|
4630
|
+
"named": true
|
|
4631
|
+
},
|
|
4536
4632
|
{
|
|
4537
4633
|
"type": "in_expression",
|
|
4538
4634
|
"named": true
|
|
@@ -4648,6 +4744,10 @@
|
|
|
4648
4744
|
"type": "function_call",
|
|
4649
4745
|
"named": true
|
|
4650
4746
|
},
|
|
4747
|
+
{
|
|
4748
|
+
"type": "generalized_invocation",
|
|
4749
|
+
"named": true
|
|
4750
|
+
},
|
|
4651
4751
|
{
|
|
4652
4752
|
"type": "in_expression",
|
|
4653
4753
|
"named": true
|
|
@@ -4771,6 +4871,10 @@
|
|
|
4771
4871
|
"type": "function_call",
|
|
4772
4872
|
"named": true
|
|
4773
4873
|
},
|
|
4874
|
+
{
|
|
4875
|
+
"type": "generalized_invocation",
|
|
4876
|
+
"named": true
|
|
4877
|
+
},
|
|
4774
4878
|
{
|
|
4775
4879
|
"type": "identifier",
|
|
4776
4880
|
"named": true
|
|
@@ -4964,6 +5068,10 @@
|
|
|
4964
5068
|
"type": "function_call",
|
|
4965
5069
|
"named": true
|
|
4966
5070
|
},
|
|
5071
|
+
{
|
|
5072
|
+
"type": "generalized_invocation",
|
|
5073
|
+
"named": true
|
|
5074
|
+
},
|
|
4967
5075
|
{
|
|
4968
5076
|
"type": "in_expression",
|
|
4969
5077
|
"named": true
|
|
@@ -5080,6 +5188,29 @@
|
|
|
5080
5188
|
]
|
|
5081
5189
|
}
|
|
5082
5190
|
},
|
|
5191
|
+
{
|
|
5192
|
+
"type": "generalized_invocation",
|
|
5193
|
+
"named": true,
|
|
5194
|
+
"fields": {},
|
|
5195
|
+
"children": {
|
|
5196
|
+
"multiple": true,
|
|
5197
|
+
"required": true,
|
|
5198
|
+
"types": [
|
|
5199
|
+
{
|
|
5200
|
+
"type": "identifier",
|
|
5201
|
+
"named": true
|
|
5202
|
+
},
|
|
5203
|
+
{
|
|
5204
|
+
"type": "quoted_identifier",
|
|
5205
|
+
"named": true
|
|
5206
|
+
},
|
|
5207
|
+
{
|
|
5208
|
+
"type": "type_name",
|
|
5209
|
+
"named": true
|
|
5210
|
+
}
|
|
5211
|
+
]
|
|
5212
|
+
}
|
|
5213
|
+
},
|
|
5083
5214
|
{
|
|
5084
5215
|
"type": "generic_statement",
|
|
5085
5216
|
"named": true,
|
|
@@ -5198,6 +5329,10 @@
|
|
|
5198
5329
|
"type": "function_call",
|
|
5199
5330
|
"named": true
|
|
5200
5331
|
},
|
|
5332
|
+
{
|
|
5333
|
+
"type": "generalized_invocation",
|
|
5334
|
+
"named": true
|
|
5335
|
+
},
|
|
5201
5336
|
{
|
|
5202
5337
|
"type": "in_expression",
|
|
5203
5338
|
"named": true
|
|
@@ -5313,6 +5448,10 @@
|
|
|
5313
5448
|
"type": "function_call",
|
|
5314
5449
|
"named": true
|
|
5315
5450
|
},
|
|
5451
|
+
{
|
|
5452
|
+
"type": "generalized_invocation",
|
|
5453
|
+
"named": true
|
|
5454
|
+
},
|
|
5316
5455
|
{
|
|
5317
5456
|
"type": "in_expression",
|
|
5318
5457
|
"named": true
|
|
@@ -5428,6 +5567,10 @@
|
|
|
5428
5567
|
"type": "function_call",
|
|
5429
5568
|
"named": true
|
|
5430
5569
|
},
|
|
5570
|
+
{
|
|
5571
|
+
"type": "generalized_invocation",
|
|
5572
|
+
"named": true
|
|
5573
|
+
},
|
|
5431
5574
|
{
|
|
5432
5575
|
"type": "in_expression",
|
|
5433
5576
|
"named": true
|
|
@@ -5605,6 +5748,10 @@
|
|
|
5605
5748
|
"type": "function_call",
|
|
5606
5749
|
"named": true
|
|
5607
5750
|
},
|
|
5751
|
+
{
|
|
5752
|
+
"type": "generalized_invocation",
|
|
5753
|
+
"named": true
|
|
5754
|
+
},
|
|
5608
5755
|
{
|
|
5609
5756
|
"type": "generic_statement",
|
|
5610
5757
|
"named": true
|
|
@@ -5685,6 +5832,10 @@
|
|
|
5685
5832
|
"type": "pipe_row_statement",
|
|
5686
5833
|
"named": true
|
|
5687
5834
|
},
|
|
5835
|
+
{
|
|
5836
|
+
"type": "pragma",
|
|
5837
|
+
"named": true
|
|
5838
|
+
},
|
|
5688
5839
|
{
|
|
5689
5840
|
"type": "raise_statement",
|
|
5690
5841
|
"named": true
|
|
@@ -5780,6 +5931,10 @@
|
|
|
5780
5931
|
"type": "function_call",
|
|
5781
5932
|
"named": true
|
|
5782
5933
|
},
|
|
5934
|
+
{
|
|
5935
|
+
"type": "generalized_invocation",
|
|
5936
|
+
"named": true
|
|
5937
|
+
},
|
|
5783
5938
|
{
|
|
5784
5939
|
"type": "in_expression",
|
|
5785
5940
|
"named": true
|
|
@@ -5956,6 +6111,10 @@
|
|
|
5956
6111
|
"type": "function_call",
|
|
5957
6112
|
"named": true
|
|
5958
6113
|
},
|
|
6114
|
+
{
|
|
6115
|
+
"type": "generalized_invocation",
|
|
6116
|
+
"named": true
|
|
6117
|
+
},
|
|
5959
6118
|
{
|
|
5960
6119
|
"type": "in_expression",
|
|
5961
6120
|
"named": true
|
|
@@ -6106,6 +6265,10 @@
|
|
|
6106
6265
|
"type": "function_call",
|
|
6107
6266
|
"named": true
|
|
6108
6267
|
},
|
|
6268
|
+
{
|
|
6269
|
+
"type": "generalized_invocation",
|
|
6270
|
+
"named": true
|
|
6271
|
+
},
|
|
6109
6272
|
{
|
|
6110
6273
|
"type": "in_expression",
|
|
6111
6274
|
"named": true
|
|
@@ -6221,6 +6384,10 @@
|
|
|
6221
6384
|
"type": "function_call",
|
|
6222
6385
|
"named": true
|
|
6223
6386
|
},
|
|
6387
|
+
{
|
|
6388
|
+
"type": "generalized_invocation",
|
|
6389
|
+
"named": true
|
|
6390
|
+
},
|
|
6224
6391
|
{
|
|
6225
6392
|
"type": "identifier",
|
|
6226
6393
|
"named": true
|
|
@@ -6358,6 +6525,10 @@
|
|
|
6358
6525
|
"type": "function_call",
|
|
6359
6526
|
"named": true
|
|
6360
6527
|
},
|
|
6528
|
+
{
|
|
6529
|
+
"type": "generalized_invocation",
|
|
6530
|
+
"named": true
|
|
6531
|
+
},
|
|
6361
6532
|
{
|
|
6362
6533
|
"type": "in_expression",
|
|
6363
6534
|
"named": true
|
|
@@ -6595,6 +6766,10 @@
|
|
|
6595
6766
|
"type": "function_call",
|
|
6596
6767
|
"named": true
|
|
6597
6768
|
},
|
|
6769
|
+
{
|
|
6770
|
+
"type": "generalized_invocation",
|
|
6771
|
+
"named": true
|
|
6772
|
+
},
|
|
6598
6773
|
{
|
|
6599
6774
|
"type": "in_expression",
|
|
6600
6775
|
"named": true
|
|
@@ -6754,6 +6929,10 @@
|
|
|
6754
6929
|
"type": "function_call",
|
|
6755
6930
|
"named": true
|
|
6756
6931
|
},
|
|
6932
|
+
{
|
|
6933
|
+
"type": "generalized_invocation",
|
|
6934
|
+
"named": true
|
|
6935
|
+
},
|
|
6757
6936
|
{
|
|
6758
6937
|
"type": "generic_statement",
|
|
6759
6938
|
"named": true
|
|
@@ -6838,6 +7017,10 @@
|
|
|
6838
7017
|
"type": "pipe_row_statement",
|
|
6839
7018
|
"named": true
|
|
6840
7019
|
},
|
|
7020
|
+
{
|
|
7021
|
+
"type": "pragma",
|
|
7022
|
+
"named": true
|
|
7023
|
+
},
|
|
6841
7024
|
{
|
|
6842
7025
|
"type": "quoted_identifier",
|
|
6843
7026
|
"named": true
|
|
@@ -6973,6 +7156,10 @@
|
|
|
6973
7156
|
"type": "function_call",
|
|
6974
7157
|
"named": true
|
|
6975
7158
|
},
|
|
7159
|
+
{
|
|
7160
|
+
"type": "generalized_invocation",
|
|
7161
|
+
"named": true
|
|
7162
|
+
},
|
|
6976
7163
|
{
|
|
6977
7164
|
"type": "member_expression",
|
|
6978
7165
|
"named": true
|
|
@@ -7051,6 +7238,10 @@
|
|
|
7051
7238
|
"type": "function_call",
|
|
7052
7239
|
"named": true
|
|
7053
7240
|
},
|
|
7241
|
+
{
|
|
7242
|
+
"type": "generalized_invocation",
|
|
7243
|
+
"named": true
|
|
7244
|
+
},
|
|
7054
7245
|
{
|
|
7055
7246
|
"type": "in_expression",
|
|
7056
7247
|
"named": true
|
|
@@ -7330,6 +7521,10 @@
|
|
|
7330
7521
|
"type": "function_call",
|
|
7331
7522
|
"named": true
|
|
7332
7523
|
},
|
|
7524
|
+
{
|
|
7525
|
+
"type": "generalized_invocation",
|
|
7526
|
+
"named": true
|
|
7527
|
+
},
|
|
7333
7528
|
{
|
|
7334
7529
|
"type": "in_expression",
|
|
7335
7530
|
"named": true
|
|
@@ -7445,6 +7640,10 @@
|
|
|
7445
7640
|
"type": "function_call",
|
|
7446
7641
|
"named": true
|
|
7447
7642
|
},
|
|
7643
|
+
{
|
|
7644
|
+
"type": "generalized_invocation",
|
|
7645
|
+
"named": true
|
|
7646
|
+
},
|
|
7448
7647
|
{
|
|
7449
7648
|
"type": "in_expression",
|
|
7450
7649
|
"named": true
|
|
@@ -7579,6 +7778,10 @@
|
|
|
7579
7778
|
"type": "function_call",
|
|
7580
7779
|
"named": true
|
|
7581
7780
|
},
|
|
7781
|
+
{
|
|
7782
|
+
"type": "generalized_invocation",
|
|
7783
|
+
"named": true
|
|
7784
|
+
},
|
|
7582
7785
|
{
|
|
7583
7786
|
"type": "in_expression",
|
|
7584
7787
|
"named": true
|
|
@@ -7732,6 +7935,10 @@
|
|
|
7732
7935
|
"type": "function_call",
|
|
7733
7936
|
"named": true
|
|
7734
7937
|
},
|
|
7938
|
+
{
|
|
7939
|
+
"type": "generalized_invocation",
|
|
7940
|
+
"named": true
|
|
7941
|
+
},
|
|
7735
7942
|
{
|
|
7736
7943
|
"type": "in_expression",
|
|
7737
7944
|
"named": true
|
|
@@ -7887,6 +8094,10 @@
|
|
|
7887
8094
|
"type": "function_call",
|
|
7888
8095
|
"named": true
|
|
7889
8096
|
},
|
|
8097
|
+
{
|
|
8098
|
+
"type": "generalized_invocation",
|
|
8099
|
+
"named": true
|
|
8100
|
+
},
|
|
7890
8101
|
{
|
|
7891
8102
|
"type": "in_expression",
|
|
7892
8103
|
"named": true
|
|
@@ -8017,6 +8228,10 @@
|
|
|
8017
8228
|
"type": "function_call",
|
|
8018
8229
|
"named": true
|
|
8019
8230
|
},
|
|
8231
|
+
{
|
|
8232
|
+
"type": "generalized_invocation",
|
|
8233
|
+
"named": true
|
|
8234
|
+
},
|
|
8020
8235
|
{
|
|
8021
8236
|
"type": "in_expression",
|
|
8022
8237
|
"named": true
|
|
@@ -8304,6 +8519,10 @@
|
|
|
8304
8519
|
"type": "function_call",
|
|
8305
8520
|
"named": true
|
|
8306
8521
|
},
|
|
8522
|
+
{
|
|
8523
|
+
"type": "generalized_invocation",
|
|
8524
|
+
"named": true
|
|
8525
|
+
},
|
|
8307
8526
|
{
|
|
8308
8527
|
"type": "in_expression",
|
|
8309
8528
|
"named": true
|
|
@@ -8419,6 +8638,10 @@
|
|
|
8419
8638
|
"type": "function_call",
|
|
8420
8639
|
"named": true
|
|
8421
8640
|
},
|
|
8641
|
+
{
|
|
8642
|
+
"type": "generalized_invocation",
|
|
8643
|
+
"named": true
|
|
8644
|
+
},
|
|
8422
8645
|
{
|
|
8423
8646
|
"type": "in_expression",
|
|
8424
8647
|
"named": true
|
|
@@ -8534,6 +8757,10 @@
|
|
|
8534
8757
|
"type": "function_call",
|
|
8535
8758
|
"named": true
|
|
8536
8759
|
},
|
|
8760
|
+
{
|
|
8761
|
+
"type": "generalized_invocation",
|
|
8762
|
+
"named": true
|
|
8763
|
+
},
|
|
8537
8764
|
{
|
|
8538
8765
|
"type": "in_expression",
|
|
8539
8766
|
"named": true
|
|
@@ -8725,6 +8952,10 @@
|
|
|
8725
8952
|
"type": "function_call",
|
|
8726
8953
|
"named": true
|
|
8727
8954
|
},
|
|
8955
|
+
{
|
|
8956
|
+
"type": "generalized_invocation",
|
|
8957
|
+
"named": true
|
|
8958
|
+
},
|
|
8728
8959
|
{
|
|
8729
8960
|
"type": "in_expression",
|
|
8730
8961
|
"named": true
|
|
@@ -8922,6 +9153,10 @@
|
|
|
8922
9153
|
"type": "bind_variable",
|
|
8923
9154
|
"named": true
|
|
8924
9155
|
},
|
|
9156
|
+
{
|
|
9157
|
+
"type": "conditional_compilation",
|
|
9158
|
+
"named": true
|
|
9159
|
+
},
|
|
8925
9160
|
{
|
|
8926
9161
|
"type": "identifier",
|
|
8927
9162
|
"named": true
|
|
@@ -9159,6 +9394,10 @@
|
|
|
9159
9394
|
"type": "function_call",
|
|
9160
9395
|
"named": true
|
|
9161
9396
|
},
|
|
9397
|
+
{
|
|
9398
|
+
"type": "generalized_invocation",
|
|
9399
|
+
"named": true
|
|
9400
|
+
},
|
|
9162
9401
|
{
|
|
9163
9402
|
"type": "identifier",
|
|
9164
9403
|
"named": true
|
|
@@ -9413,6 +9652,10 @@
|
|
|
9413
9652
|
"type": "pipe_row_statement",
|
|
9414
9653
|
"named": true
|
|
9415
9654
|
},
|
|
9655
|
+
{
|
|
9656
|
+
"type": "pragma",
|
|
9657
|
+
"named": true
|
|
9658
|
+
},
|
|
9416
9659
|
{
|
|
9417
9660
|
"type": "raise_statement",
|
|
9418
9661
|
"named": true
|
|
@@ -9444,6 +9687,10 @@
|
|
|
9444
9687
|
"type": "bind_variable",
|
|
9445
9688
|
"named": true
|
|
9446
9689
|
},
|
|
9690
|
+
{
|
|
9691
|
+
"type": "conditional_compilation",
|
|
9692
|
+
"named": true
|
|
9693
|
+
},
|
|
9447
9694
|
{
|
|
9448
9695
|
"type": "identifier",
|
|
9449
9696
|
"named": true
|
|
@@ -9681,6 +9928,10 @@
|
|
|
9681
9928
|
"type": "function_call",
|
|
9682
9929
|
"named": true
|
|
9683
9930
|
},
|
|
9931
|
+
{
|
|
9932
|
+
"type": "generalized_invocation",
|
|
9933
|
+
"named": true
|
|
9934
|
+
},
|
|
9684
9935
|
{
|
|
9685
9936
|
"type": "in_expression",
|
|
9686
9937
|
"named": true
|
|
@@ -9915,6 +10166,10 @@
|
|
|
9915
10166
|
"type": "function_call",
|
|
9916
10167
|
"named": true
|
|
9917
10168
|
},
|
|
10169
|
+
{
|
|
10170
|
+
"type": "generalized_invocation",
|
|
10171
|
+
"named": true
|
|
10172
|
+
},
|
|
9918
10173
|
{
|
|
9919
10174
|
"type": "in_expression",
|
|
9920
10175
|
"named": true
|
|
@@ -10054,6 +10309,10 @@
|
|
|
10054
10309
|
"type": "function_call",
|
|
10055
10310
|
"named": true
|
|
10056
10311
|
},
|
|
10312
|
+
{
|
|
10313
|
+
"type": "generalized_invocation",
|
|
10314
|
+
"named": true
|
|
10315
|
+
},
|
|
10057
10316
|
{
|
|
10058
10317
|
"type": "in_expression",
|
|
10059
10318
|
"named": true
|
|
@@ -10214,6 +10473,10 @@
|
|
|
10214
10473
|
"type": "function_call",
|
|
10215
10474
|
"named": true
|
|
10216
10475
|
},
|
|
10476
|
+
{
|
|
10477
|
+
"type": "generalized_invocation",
|
|
10478
|
+
"named": true
|
|
10479
|
+
},
|
|
10217
10480
|
{
|
|
10218
10481
|
"type": "generic_statement",
|
|
10219
10482
|
"named": true
|
|
@@ -10294,6 +10557,10 @@
|
|
|
10294
10557
|
"type": "pipe_row_statement",
|
|
10295
10558
|
"named": true
|
|
10296
10559
|
},
|
|
10560
|
+
{
|
|
10561
|
+
"type": "pragma",
|
|
10562
|
+
"named": true
|
|
10563
|
+
},
|
|
10297
10564
|
{
|
|
10298
10565
|
"type": "raise_statement",
|
|
10299
10566
|
"named": true
|
|
@@ -10385,6 +10652,10 @@
|
|
|
10385
10652
|
"type": "function_call",
|
|
10386
10653
|
"named": true
|
|
10387
10654
|
},
|
|
10655
|
+
{
|
|
10656
|
+
"type": "generalized_invocation",
|
|
10657
|
+
"named": true
|
|
10658
|
+
},
|
|
10388
10659
|
{
|
|
10389
10660
|
"type": "in_expression",
|
|
10390
10661
|
"named": true
|
|
@@ -10500,6 +10771,10 @@
|
|
|
10500
10771
|
"type": "function_call",
|
|
10501
10772
|
"named": true
|
|
10502
10773
|
},
|
|
10774
|
+
{
|
|
10775
|
+
"type": "generalized_invocation",
|
|
10776
|
+
"named": true
|
|
10777
|
+
},
|
|
10503
10778
|
{
|
|
10504
10779
|
"type": "identifier",
|
|
10505
10780
|
"named": true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-sql",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "SQL grammars (SQLite, PostgreSQL, MySQL, and Oracle) for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mysql",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@vitest/browser-playwright": "5.0.5",
|
|
60
60
|
"@willbooster/oxlint-config": "1.4.9",
|
|
61
61
|
"@willbooster/wb": "24.3.3",
|
|
62
|
-
"@willbooster/web-tree-sitter": "
|
|
62
|
+
"@willbooster/web-tree-sitter": "27.0.0",
|
|
63
63
|
"lefthook": "2.2.3",
|
|
64
64
|
"oxlint": "1.95.0",
|
|
65
65
|
"oxlint-tsgolint": "7.0.2008",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"wrangler": "4.156.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@willbooster/web-tree-sitter": "^
|
|
72
|
+
"@willbooster/web-tree-sitter": "^26.3.0 || ^27.0.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"@willbooster/web-tree-sitter": {
|
|
@@ -5181,6 +5181,10 @@
|
|
|
5181
5181
|
"type": "function_call",
|
|
5182
5182
|
"named": true
|
|
5183
5183
|
},
|
|
5184
|
+
{
|
|
5185
|
+
"type": "join_clause",
|
|
5186
|
+
"named": true
|
|
5187
|
+
},
|
|
5184
5188
|
{
|
|
5185
5189
|
"type": "parenthesized_join",
|
|
5186
5190
|
"named": true
|
|
@@ -9531,6 +9535,10 @@
|
|
|
9531
9535
|
"type": "INOUT",
|
|
9532
9536
|
"named": false
|
|
9533
9537
|
},
|
|
9538
|
+
{
|
|
9539
|
+
"type": "INPUT",
|
|
9540
|
+
"named": false
|
|
9541
|
+
},
|
|
9534
9542
|
{
|
|
9535
9543
|
"type": "INSERT",
|
|
9536
9544
|
"named": false
|
package/sqlite/grammar.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
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 { commaSep, commaSep1, keyword,
|
|
10
|
+
import { commaSep, commaSep1, keyword, keywords } from '../common/common.mjs';
|
|
11
11
|
|
|
12
12
|
// The CLI injects the DSL before loading this grammar.
|
|
13
13
|
const { grammar, alias, choice, field, optional, prec, repeat, repeat1, reserved, seq, token } =
|
|
@@ -154,6 +154,7 @@ const triggerInsert = ($, head) =>
|
|
|
154
154
|
const triggerDelete = ($, target) => seq(keywords('DELETE FROM'), field('table', target), optional($.where_clause));
|
|
155
155
|
|
|
156
156
|
export default grammar({
|
|
157
|
+
caseInsensitiveKeywords: true,
|
|
157
158
|
name: 'sqlite',
|
|
158
159
|
|
|
159
160
|
// A byte order mark is white space anywhere.
|
|
@@ -174,12 +175,12 @@ export default grammar({
|
|
|
174
175
|
word: ($) => $.identifier,
|
|
175
176
|
|
|
176
177
|
reserved: {
|
|
177
|
-
global: () => RESERVED.map(
|
|
178
|
+
global: () => RESERVED.map(keyword),
|
|
178
179
|
// `ids` in parse.y: the alias that follows an expression or a table without `AS`, a type name, or a collation.
|
|
179
|
-
ids: () => [...RESERVED, ...JOIN_KEYWORDS, 'INDEXED'].map(
|
|
180
|
-
window_name: () => [...RESERVED, 'FILTER', 'INDEXED'].map(
|
|
180
|
+
ids: () => [...RESERVED, ...JOIN_KEYWORDS, 'INDEXED'].map(keyword),
|
|
181
|
+
window_name: () => [...RESERVED, 'FILTER', 'INDEXED'].map(keyword),
|
|
181
182
|
// `id` in parse.y: an identifier as a default value.
|
|
182
|
-
id: () => [...RESERVED, ...JOIN_KEYWORDS].map(
|
|
183
|
+
id: () => [...RESERVED, ...JOIN_KEYWORDS].map(keyword),
|
|
183
184
|
},
|
|
184
185
|
|
|
185
186
|
supertypes: ($) => [$._statement],
|
package/tree-sitter-mysql.wasm
CHANGED
|
Binary file
|
package/tree-sitter-oracle.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/tree-sitter-sqlite.wasm
CHANGED
|
Binary file
|