tree-sitter-postgres 1.2.4 → 19.0.0-beta.3
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 +4 -4
- package/package.json +2 -2
- package/plpgsql/grammar.js +5 -5
- package/plpgsql/src/grammar.json +30 -30
- package/plpgsql/src/node-types.json +8 -0
- package/plpgsql/src/parser.c +11906 -11727
- package/postgres/grammar.js +112 -49
- package/postgres/src/grammar.json +1238 -468
- package/postgres/src/node-types.json +450 -108
- package/postgres/src/parser.c +2 -2
- package/prebuilds/darwin-arm64/tree-sitter-postgres.node +0 -0
- package/prebuilds/darwin-x64/tree-sitter-postgres.node +0 -0
- package/prebuilds/linux-arm64/tree-sitter-postgres.node +0 -0
- package/prebuilds/linux-x64/tree-sitter-postgres.node +0 -0
- package/prebuilds/win32-arm64/tree-sitter-postgres.node +0 -0
- package/prebuilds/win32-x64/tree-sitter-postgres.node +0 -0
- package/tree-sitter-postgres.wasm +0 -0
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ A [tree-sitter](https://tree-sitter.github.io/) grammar for PostgreSQL, generate
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Current as of PostgreSQL
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
7
|
+
- **Current as of PostgreSQL 19** (generated from `REL_19_STABLE` @ `b368bdd2301`, post-beta 3, with the reverted beta features removed)
|
|
8
|
+
- **743 grammar rules** covering the full PostgreSQL SQL syntax
|
|
9
|
+
- **499 case-insensitive keywords** across all four PG keyword categories
|
|
10
10
|
- **Correct operator precedence** — `1 + 2 * 3` parses as `1 + (2 * 3)`
|
|
11
11
|
- **PL/pgSQL support** via a separate grammar with language injection
|
|
12
12
|
- **Generated, not hand-written** — regenerate for any PostgreSQL version
|
|
@@ -38,7 +38,7 @@ cd postgres && npx tree-sitter generate
|
|
|
38
38
|
| File | Source |
|
|
39
39
|
| ----------------------------- | -------------------------------------------- |
|
|
40
40
|
| `src/backend/parser/gram.y` | Bison grammar (733 rules, 3236 alternatives) |
|
|
41
|
-
| `src/include/parser/kwlist.h` | Keyword definitions (
|
|
41
|
+
| `src/include/parser/kwlist.h` | Keyword definitions (511 keywords) |
|
|
42
42
|
|
|
43
43
|
### Generator scripts
|
|
44
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-postgres",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0-beta.3",
|
|
4
4
|
"description": "PostgreSQL grammar for tree-sitter, generated from Postgres source",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"node-gyp": "^13.0.0",
|
|
49
49
|
"prebuildify": "^6.0.1",
|
|
50
|
-
"tree-sitter-cli": "^0.
|
|
50
|
+
"tree-sitter-cli": "^0.27.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"install": "node-gyp-build",
|
package/plpgsql/grammar.js
CHANGED
|
@@ -606,7 +606,6 @@ module.exports = grammar({
|
|
|
606
606
|
$.kw_declare,
|
|
607
607
|
$.kw_else,
|
|
608
608
|
$.kw_end,
|
|
609
|
-
$.kw_execute,
|
|
610
609
|
$.kw_for,
|
|
611
610
|
$.kw_foreach,
|
|
612
611
|
$.kw_from,
|
|
@@ -617,7 +616,6 @@ module.exports = grammar({
|
|
|
617
616
|
$.kw_not,
|
|
618
617
|
$.kw_null,
|
|
619
618
|
$.kw_or,
|
|
620
|
-
$.kw_strict,
|
|
621
619
|
$.kw_then,
|
|
622
620
|
$.kw_to,
|
|
623
621
|
$.kw_using,
|
|
@@ -656,6 +654,7 @@ module.exports = grammar({
|
|
|
656
654
|
$.kw_errcode,
|
|
657
655
|
$.kw_error,
|
|
658
656
|
$.kw_exception,
|
|
657
|
+
$.kw_execute,
|
|
659
658
|
$.kw_exit,
|
|
660
659
|
$.kw_fetch,
|
|
661
660
|
$.kw_first,
|
|
@@ -701,6 +700,7 @@ module.exports = grammar({
|
|
|
701
700
|
$.kw_slice,
|
|
702
701
|
$.kw_sqlstate,
|
|
703
702
|
$.kw_stacked,
|
|
703
|
+
$.kw_strict,
|
|
704
704
|
$.kw_table,
|
|
705
705
|
$.kw_table_name,
|
|
706
706
|
$.kw_type,
|
|
@@ -719,7 +719,6 @@ module.exports = grammar({
|
|
|
719
719
|
kw_declare: _ => token(prec(1, /[dD][eE][cC][lL][aA][rR][eE]/)),
|
|
720
720
|
kw_else: _ => token(prec(1, /[eE][lL][sS][eE]/)),
|
|
721
721
|
kw_end: _ => token(prec(1, /[eE][nN][dD]/)),
|
|
722
|
-
kw_execute: _ => token(prec(1, /[eE][xX][eE][cC][uU][tT][eE]/)),
|
|
723
722
|
kw_for: _ => token(prec(1, /[fF][oO][rR]/)),
|
|
724
723
|
kw_foreach: _ => token(prec(1, /[fF][oO][rR][eE][aA][cC][hH]/)),
|
|
725
724
|
kw_from: _ => token(prec(1, /[fF][rR][oO][mM]/)),
|
|
@@ -730,7 +729,6 @@ module.exports = grammar({
|
|
|
730
729
|
kw_not: _ => token(prec(1, /[nN][oO][tT]/)),
|
|
731
730
|
kw_null: _ => token(prec(1, /[nN][uU][lL][lL]/)),
|
|
732
731
|
kw_or: _ => token(prec(1, /[oO][rR]/)),
|
|
733
|
-
kw_strict: _ => token(prec(1, /[sS][tT][rR][iI][cC][tT]/)),
|
|
734
732
|
kw_then: _ => token(prec(1, /[tT][hH][eE][nN]/)),
|
|
735
733
|
kw_to: _ => token(prec(1, /[tT][oO]/)),
|
|
736
734
|
kw_using: _ => token(prec(1, /[uU][sS][iI][nN][gG]/)),
|
|
@@ -766,6 +764,7 @@ module.exports = grammar({
|
|
|
766
764
|
kw_errcode: _ => token(prec(1, /[eE][rR][rR][cC][oO][dD][eE]/)),
|
|
767
765
|
kw_error: _ => token(prec(1, /[eE][rR][rR][oO][rR]/)),
|
|
768
766
|
kw_exception: _ => token(prec(1, /[eE][xX][cC][eE][pP][tT][iI][oO][nN]/)),
|
|
767
|
+
kw_execute: _ => token(prec(1, /[eE][xX][eE][cC][uU][tT][eE]/)),
|
|
769
768
|
kw_exit: _ => token(prec(1, /[eE][xX][iI][tT]/)),
|
|
770
769
|
kw_fetch: _ => token(prec(1, /[fF][eE][tT][cC][hH]/)),
|
|
771
770
|
kw_first: _ => token(prec(1, /[fF][iI][rR][sS][tT]/)),
|
|
@@ -811,6 +810,7 @@ module.exports = grammar({
|
|
|
811
810
|
kw_slice: _ => token(prec(1, /[sS][lL][iI][cC][eE]/)),
|
|
812
811
|
kw_sqlstate: _ => token(prec(1, /[sS][qQ][lL][sS][tT][aA][tT][eE]/)),
|
|
813
812
|
kw_stacked: _ => token(prec(1, /[sS][tT][aA][cC][kK][eE][dD]/)),
|
|
813
|
+
kw_strict: _ => token(prec(1, /[sS][tT][rR][iI][cC][tT]/)),
|
|
814
814
|
kw_table: _ => token(prec(1, /[tT][aA][bB][lL][eE]/)),
|
|
815
815
|
kw_table_name: _ => token(prec(1, /[tT][aA][bB][lL][eE]_[nN][aA][mM][eE]/)),
|
|
816
816
|
kw_type: _ => token(prec(1, /[tT][yY][pP][eE]/)),
|
|
@@ -826,7 +826,7 @@ module.exports = grammar({
|
|
|
826
826
|
|
|
827
827
|
identifier: _ => token(prec(0, /[a-zA-Z_\u0080-\u00ff][a-zA-Z0-9_$\u0080-\u00ff]*/)),
|
|
828
828
|
|
|
829
|
-
// Positional parameter reference ($1, $2, ...)
|
|
829
|
+
// Positional parameter reference ($1, $2, ...) — used as an ALIAS target.
|
|
830
830
|
param: _ => token(/\$[0-9]+/),
|
|
831
831
|
|
|
832
832
|
integer_literal: _ => token(/[0-9](_?[0-9])*/),
|
package/plpgsql/src/grammar.json
CHANGED
|
@@ -2978,10 +2978,6 @@
|
|
|
2978
2978
|
"type": "SYMBOL",
|
|
2979
2979
|
"name": "kw_end"
|
|
2980
2980
|
},
|
|
2981
|
-
{
|
|
2982
|
-
"type": "SYMBOL",
|
|
2983
|
-
"name": "kw_execute"
|
|
2984
|
-
},
|
|
2985
2981
|
{
|
|
2986
2982
|
"type": "SYMBOL",
|
|
2987
2983
|
"name": "kw_for"
|
|
@@ -3022,10 +3018,6 @@
|
|
|
3022
3018
|
"type": "SYMBOL",
|
|
3023
3019
|
"name": "kw_or"
|
|
3024
3020
|
},
|
|
3025
|
-
{
|
|
3026
|
-
"type": "SYMBOL",
|
|
3027
|
-
"name": "kw_strict"
|
|
3028
|
-
},
|
|
3029
3021
|
{
|
|
3030
3022
|
"type": "SYMBOL",
|
|
3031
3023
|
"name": "kw_then"
|
|
@@ -3171,6 +3163,10 @@
|
|
|
3171
3163
|
"type": "SYMBOL",
|
|
3172
3164
|
"name": "kw_exception"
|
|
3173
3165
|
},
|
|
3166
|
+
{
|
|
3167
|
+
"type": "SYMBOL",
|
|
3168
|
+
"name": "kw_execute"
|
|
3169
|
+
},
|
|
3174
3170
|
{
|
|
3175
3171
|
"type": "SYMBOL",
|
|
3176
3172
|
"name": "kw_exit"
|
|
@@ -3351,6 +3347,10 @@
|
|
|
3351
3347
|
"type": "SYMBOL",
|
|
3352
3348
|
"name": "kw_stacked"
|
|
3353
3349
|
},
|
|
3350
|
+
{
|
|
3351
|
+
"type": "SYMBOL",
|
|
3352
|
+
"name": "kw_strict"
|
|
3353
|
+
},
|
|
3354
3354
|
{
|
|
3355
3355
|
"type": "SYMBOL",
|
|
3356
3356
|
"name": "kw_table"
|
|
@@ -3458,17 +3458,6 @@
|
|
|
3458
3458
|
}
|
|
3459
3459
|
}
|
|
3460
3460
|
},
|
|
3461
|
-
"kw_execute": {
|
|
3462
|
-
"type": "TOKEN",
|
|
3463
|
-
"content": {
|
|
3464
|
-
"type": "PREC",
|
|
3465
|
-
"value": 1,
|
|
3466
|
-
"content": {
|
|
3467
|
-
"type": "PATTERN",
|
|
3468
|
-
"value": "[eE][xX][eE][cC][uU][tT][eE]"
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
},
|
|
3472
3461
|
"kw_for": {
|
|
3473
3462
|
"type": "TOKEN",
|
|
3474
3463
|
"content": {
|
|
@@ -3579,17 +3568,6 @@
|
|
|
3579
3568
|
}
|
|
3580
3569
|
}
|
|
3581
3570
|
},
|
|
3582
|
-
"kw_strict": {
|
|
3583
|
-
"type": "TOKEN",
|
|
3584
|
-
"content": {
|
|
3585
|
-
"type": "PREC",
|
|
3586
|
-
"value": 1,
|
|
3587
|
-
"content": {
|
|
3588
|
-
"type": "PATTERN",
|
|
3589
|
-
"value": "[sS][tT][rR][iI][cC][tT]"
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
},
|
|
3593
3571
|
"kw_then": {
|
|
3594
3572
|
"type": "TOKEN",
|
|
3595
3573
|
"content": {
|
|
@@ -3984,6 +3962,17 @@
|
|
|
3984
3962
|
}
|
|
3985
3963
|
}
|
|
3986
3964
|
},
|
|
3965
|
+
"kw_execute": {
|
|
3966
|
+
"type": "TOKEN",
|
|
3967
|
+
"content": {
|
|
3968
|
+
"type": "PREC",
|
|
3969
|
+
"value": 1,
|
|
3970
|
+
"content": {
|
|
3971
|
+
"type": "PATTERN",
|
|
3972
|
+
"value": "[eE][xX][eE][cC][uU][tT][eE]"
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
},
|
|
3987
3976
|
"kw_exit": {
|
|
3988
3977
|
"type": "TOKEN",
|
|
3989
3978
|
"content": {
|
|
@@ -4479,6 +4468,17 @@
|
|
|
4479
4468
|
}
|
|
4480
4469
|
}
|
|
4481
4470
|
},
|
|
4471
|
+
"kw_strict": {
|
|
4472
|
+
"type": "TOKEN",
|
|
4473
|
+
"content": {
|
|
4474
|
+
"type": "PREC",
|
|
4475
|
+
"value": 1,
|
|
4476
|
+
"content": {
|
|
4477
|
+
"type": "PATTERN",
|
|
4478
|
+
"value": "[sS][tT][rR][iI][cC][tT]"
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
},
|
|
4482
4482
|
"kw_table": {
|
|
4483
4483
|
"type": "TOKEN",
|
|
4484
4484
|
"content": {
|
|
@@ -1954,6 +1954,10 @@
|
|
|
1954
1954
|
"type": "kw_exception",
|
|
1955
1955
|
"named": true
|
|
1956
1956
|
},
|
|
1957
|
+
{
|
|
1958
|
+
"type": "kw_execute",
|
|
1959
|
+
"named": true
|
|
1960
|
+
},
|
|
1957
1961
|
{
|
|
1958
1962
|
"type": "kw_exit",
|
|
1959
1963
|
"named": true
|
|
@@ -2134,6 +2138,10 @@
|
|
|
2134
2138
|
"type": "kw_stacked",
|
|
2135
2139
|
"named": true
|
|
2136
2140
|
},
|
|
2141
|
+
{
|
|
2142
|
+
"type": "kw_strict",
|
|
2143
|
+
"named": true
|
|
2144
|
+
},
|
|
2137
2145
|
{
|
|
2138
2146
|
"type": "kw_table",
|
|
2139
2147
|
"named": true
|