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/postgres/grammar.js
CHANGED
|
@@ -42,6 +42,7 @@ module.exports = grammar({
|
|
|
42
42
|
[$.table_ref, $.table_ref],
|
|
43
43
|
[$.OptTempTableName, $.unreserved_keyword],
|
|
44
44
|
[$.func_table, $.func_table],
|
|
45
|
+
[$.copy_generic_opt_elem, $.unreserved_keyword],
|
|
45
46
|
],
|
|
46
47
|
|
|
47
48
|
rules: {
|
|
@@ -92,7 +93,6 @@ module.exports = grammar({
|
|
|
92
93
|
$.CallStmt,
|
|
93
94
|
$.CheckPointStmt,
|
|
94
95
|
$.ClosePortalStmt,
|
|
95
|
-
$.ClusterStmt,
|
|
96
96
|
$.CommentStmt,
|
|
97
97
|
$.ConstraintsSetStmt,
|
|
98
98
|
$.CopyStmt,
|
|
@@ -166,6 +166,7 @@ module.exports = grammar({
|
|
|
166
166
|
$.RemoveFuncStmt,
|
|
167
167
|
$.RemoveOperStmt,
|
|
168
168
|
$.RenameStmt,
|
|
169
|
+
$.RepackStmt,
|
|
169
170
|
$.RevokeStmt,
|
|
170
171
|
$.RevokeRoleStmt,
|
|
171
172
|
$.RuleStmt,
|
|
@@ -179,15 +180,32 @@ module.exports = grammar({
|
|
|
179
180
|
$.VariableResetStmt,
|
|
180
181
|
$.VariableSetStmt,
|
|
181
182
|
$.VariableShowStmt,
|
|
182
|
-
$.ViewStmt
|
|
183
|
+
$.ViewStmt,
|
|
184
|
+
$.WaitStmt
|
|
183
185
|
),
|
|
184
186
|
opt_single_name: $ => $.ColId,
|
|
185
187
|
opt_qualified_name: $ => $.any_name,
|
|
186
188
|
opt_concurrently: $ => $.kw_concurrently,
|
|
189
|
+
opt_usingindex: $ => seq($.kw_using, $.kw_index),
|
|
187
190
|
opt_drop_behavior: $ => choice(
|
|
188
191
|
$.kw_cascade,
|
|
189
192
|
$.kw_restrict
|
|
190
193
|
),
|
|
194
|
+
opt_utility_option_list: $ => prec.left(20, prec.dynamic(20, seq('(', $.utility_option_list, ')'))),
|
|
195
|
+
utility_option_list: $ => choice(
|
|
196
|
+
$.utility_option_elem,
|
|
197
|
+
seq($.utility_option_list, ',', $.utility_option_elem)
|
|
198
|
+
),
|
|
199
|
+
utility_option_elem: $ => seq($.utility_option_name, optional($.utility_option_arg)),
|
|
200
|
+
utility_option_name: $ => choice(
|
|
201
|
+
$.NonReservedWord,
|
|
202
|
+
$.analyze_keyword,
|
|
203
|
+
$.kw_format
|
|
204
|
+
),
|
|
205
|
+
utility_option_arg: $ => choice(
|
|
206
|
+
$.opt_boolean_or_string,
|
|
207
|
+
$.NumericOnly
|
|
208
|
+
),
|
|
191
209
|
CallStmt: $ => seq($.kw_call, $.func_application),
|
|
192
210
|
CreateRoleStmt: $ => seq($.kw_create, $.kw_role, $.RoleId, optional($.opt_with), optional($.OptRoleList)),
|
|
193
211
|
opt_with: $ => choice(
|
|
@@ -269,6 +287,8 @@ module.exports = grammar({
|
|
|
269
287
|
generic_set: $ => choice(
|
|
270
288
|
seq($.var_name, $.kw_to, $.var_list),
|
|
271
289
|
prec.left(7, prec.dynamic(7, seq($.var_name, '=', $.var_list))),
|
|
290
|
+
seq($.var_name, $.kw_to, $.kw_null),
|
|
291
|
+
prec.left(7, prec.dynamic(7, seq($.var_name, '=', $.kw_null))),
|
|
272
292
|
seq($.var_name, $.kw_to, $.kw_default),
|
|
273
293
|
prec.left(7, prec.dynamic(7, seq($.var_name, '=', $.kw_default)))
|
|
274
294
|
),
|
|
@@ -361,7 +381,7 @@ module.exports = grammar({
|
|
|
361
381
|
$.kw_deferred,
|
|
362
382
|
$.kw_immediate
|
|
363
383
|
),
|
|
364
|
-
CheckPointStmt: $ => $.kw_checkpoint,
|
|
384
|
+
CheckPointStmt: $ => seq($.kw_checkpoint, optional($.opt_utility_option_list)),
|
|
365
385
|
DiscardStmt: $ => choice(
|
|
366
386
|
seq($.kw_discard, $.kw_all),
|
|
367
387
|
seq($.kw_discard, $.kw_temp),
|
|
@@ -559,6 +579,7 @@ module.exports = grammar({
|
|
|
559
579
|
seq($.kw_delimiter, optional($.opt_as), $.Sconst),
|
|
560
580
|
seq($.kw_null, optional($.opt_as), $.Sconst),
|
|
561
581
|
$.kw_csv,
|
|
582
|
+
$.kw_json,
|
|
562
583
|
$.kw_header,
|
|
563
584
|
seq($.kw_quote, optional($.opt_as), $.Sconst),
|
|
564
585
|
prec.left(9, prec.dynamic(9, seq($.kw_escape, optional($.opt_as), $.Sconst))),
|
|
@@ -577,7 +598,10 @@ module.exports = grammar({
|
|
|
577
598
|
$.copy_generic_opt_elem,
|
|
578
599
|
seq($.copy_generic_opt_list, ',', $.copy_generic_opt_elem)
|
|
579
600
|
),
|
|
580
|
-
copy_generic_opt_elem: $ =>
|
|
601
|
+
copy_generic_opt_elem: $ => choice(
|
|
602
|
+
seq($.ColLabel, optional($.copy_generic_opt_arg)),
|
|
603
|
+
seq($.kw_format, optional($.copy_generic_opt_arg))
|
|
604
|
+
),
|
|
581
605
|
copy_generic_opt_arg: $ => choice(
|
|
582
606
|
$.opt_boolean_or_string,
|
|
583
607
|
$.NumericOnly,
|
|
@@ -915,7 +939,9 @@ module.exports = grammar({
|
|
|
915
939
|
seq($.kw_handler, $.handler_name),
|
|
916
940
|
seq($.kw_no, $.kw_handler),
|
|
917
941
|
seq($.kw_validator, $.handler_name),
|
|
918
|
-
seq($.kw_no, $.kw_validator)
|
|
942
|
+
seq($.kw_no, $.kw_validator),
|
|
943
|
+
seq($.kw_connection, $.handler_name),
|
|
944
|
+
seq($.kw_no, $.kw_connection)
|
|
919
945
|
),
|
|
920
946
|
fdw_options: $ => choice(
|
|
921
947
|
$.fdw_option,
|
|
@@ -1309,13 +1335,13 @@ module.exports = grammar({
|
|
|
1309
1335
|
fetch_args: $ => choice(
|
|
1310
1336
|
$.cursor_name,
|
|
1311
1337
|
seq($.from_in, $.cursor_name),
|
|
1338
|
+
seq($.SignedIconst, optional($.opt_from_in), $.cursor_name),
|
|
1312
1339
|
seq($.kw_next, optional($.opt_from_in), $.cursor_name),
|
|
1313
1340
|
seq($.kw_prior, optional($.opt_from_in), $.cursor_name),
|
|
1314
1341
|
seq($.kw_first, optional($.opt_from_in), $.cursor_name),
|
|
1315
1342
|
seq($.kw_last, optional($.opt_from_in), $.cursor_name),
|
|
1316
1343
|
seq($.kw_absolute, $.SignedIconst, optional($.opt_from_in), $.cursor_name),
|
|
1317
1344
|
seq($.kw_relative, $.SignedIconst, optional($.opt_from_in), $.cursor_name),
|
|
1318
|
-
seq($.SignedIconst, optional($.opt_from_in), $.cursor_name),
|
|
1319
1345
|
seq($.kw_all, optional($.opt_from_in), $.cursor_name),
|
|
1320
1346
|
seq($.kw_forward, optional($.opt_from_in), $.cursor_name),
|
|
1321
1347
|
seq($.kw_forward, $.SignedIconst, optional($.opt_from_in), $.cursor_name),
|
|
@@ -1670,9 +1696,9 @@ module.exports = grammar({
|
|
|
1670
1696
|
),
|
|
1671
1697
|
DropTransformStmt: $ => seq($.kw_drop, $.kw_transform, optional($.opt_if_exists), $.kw_for, $.Typename, $.kw_language, $.name, optional($.opt_drop_behavior)),
|
|
1672
1698
|
ReindexStmt: $ => choice(
|
|
1673
|
-
seq($.kw_reindex, optional($.
|
|
1674
|
-
seq($.kw_reindex, optional($.
|
|
1675
|
-
seq($.kw_reindex, optional($.
|
|
1699
|
+
seq($.kw_reindex, optional($.opt_utility_option_list), $.reindex_target_relation, optional($.opt_concurrently), $.qualified_name),
|
|
1700
|
+
seq($.kw_reindex, optional($.opt_utility_option_list), $.kw_schema, optional($.opt_concurrently), $.name),
|
|
1701
|
+
seq($.kw_reindex, optional($.opt_utility_option_list), $.reindex_target_all, optional($.opt_concurrently), optional($.opt_single_name))
|
|
1676
1702
|
),
|
|
1677
1703
|
reindex_target_relation: $ => choice(
|
|
1678
1704
|
$.kw_index,
|
|
@@ -1682,7 +1708,6 @@ module.exports = grammar({
|
|
|
1682
1708
|
$.kw_system,
|
|
1683
1709
|
$.kw_database
|
|
1684
1710
|
),
|
|
1685
|
-
opt_reindex_option_list: $ => prec.left(20, prec.dynamic(20, seq('(', $.utility_option_list, ')'))),
|
|
1686
1711
|
AlterTblSpcStmt: $ => choice(
|
|
1687
1712
|
prec.left(11, prec.dynamic(11, seq($.kw_alter, $.kw_tablespace, $.name, $.kw_set, $.reloptions))),
|
|
1688
1713
|
seq($.kw_alter, $.kw_tablespace, $.name, $.kw_reset, $.reloptions)
|
|
@@ -1830,7 +1855,7 @@ module.exports = grammar({
|
|
|
1830
1855
|
),
|
|
1831
1856
|
CreatePublicationStmt: $ => choice(
|
|
1832
1857
|
seq($.kw_create, $.kw_publication, $.name, optional($.opt_definition)),
|
|
1833
|
-
seq($.kw_create, $.kw_publication, $.name, $.kw_for, $.
|
|
1858
|
+
seq($.kw_create, $.kw_publication, $.name, $.kw_for, $.pub_all_obj_type_list, optional($.opt_definition)),
|
|
1834
1859
|
seq($.kw_create, $.kw_publication, $.name, $.kw_for, $.pub_obj_list, optional($.opt_definition))
|
|
1835
1860
|
),
|
|
1836
1861
|
PublicationObjSpec: $ => choice(
|
|
@@ -1846,17 +1871,37 @@ module.exports = grammar({
|
|
|
1846
1871
|
$.PublicationObjSpec,
|
|
1847
1872
|
seq($.pub_obj_list, ',', $.PublicationObjSpec)
|
|
1848
1873
|
),
|
|
1874
|
+
opt_pub_except_clause: $ => prec.left(1, prec.dynamic(1, seq($.kw_except, '(', $.kw_table, $.pub_except_obj_list, ')'))),
|
|
1875
|
+
PublicationAllObjSpec: $ => choice(
|
|
1876
|
+
seq($.kw_all, $.kw_tables, optional($.opt_pub_except_clause)),
|
|
1877
|
+
seq($.kw_all, $.kw_sequences)
|
|
1878
|
+
),
|
|
1879
|
+
pub_all_obj_type_list: $ => choice(
|
|
1880
|
+
$.PublicationAllObjSpec,
|
|
1881
|
+
seq($.pub_all_obj_type_list, ',', $.PublicationAllObjSpec)
|
|
1882
|
+
),
|
|
1883
|
+
PublicationExceptObjSpec: $ => $.relation_expr,
|
|
1884
|
+
pub_except_obj_list: $ => choice(
|
|
1885
|
+
$.PublicationExceptObjSpec,
|
|
1886
|
+
seq($.pub_except_obj_list, ',', optional($.opt_table), $.PublicationExceptObjSpec)
|
|
1887
|
+
),
|
|
1849
1888
|
AlterPublicationStmt: $ => choice(
|
|
1850
1889
|
prec.left(11, prec.dynamic(11, seq($.kw_alter, $.kw_publication, $.name, $.kw_set, $.definition))),
|
|
1851
1890
|
seq($.kw_alter, $.kw_publication, $.name, $.kw_add, $.pub_obj_list),
|
|
1852
1891
|
prec.left(11, prec.dynamic(11, seq($.kw_alter, $.kw_publication, $.name, $.kw_set, $.pub_obj_list))),
|
|
1892
|
+
prec.left(11, prec.dynamic(11, seq($.kw_alter, $.kw_publication, $.name, $.kw_set, $.pub_all_obj_type_list))),
|
|
1853
1893
|
seq($.kw_alter, $.kw_publication, $.name, $.kw_drop, $.pub_obj_list)
|
|
1854
1894
|
),
|
|
1855
|
-
CreateSubscriptionStmt: $ =>
|
|
1895
|
+
CreateSubscriptionStmt: $ => choice(
|
|
1896
|
+
seq($.kw_create, $.kw_subscription, $.name, $.kw_connection, $.Sconst, $.kw_publication, $.name_list, optional($.opt_definition)),
|
|
1897
|
+
seq($.kw_create, $.kw_subscription, $.name, $.kw_server, $.name, $.kw_publication, $.name_list, optional($.opt_definition))
|
|
1898
|
+
),
|
|
1856
1899
|
AlterSubscriptionStmt: $ => choice(
|
|
1857
1900
|
prec.left(11, prec.dynamic(11, seq($.kw_alter, $.kw_subscription, $.name, $.kw_set, $.definition))),
|
|
1858
1901
|
seq($.kw_alter, $.kw_subscription, $.name, $.kw_connection, $.Sconst),
|
|
1902
|
+
seq($.kw_alter, $.kw_subscription, $.name, $.kw_server, $.name),
|
|
1859
1903
|
seq($.kw_alter, $.kw_subscription, $.name, $.kw_refresh, $.kw_publication, optional($.opt_definition)),
|
|
1904
|
+
seq($.kw_alter, $.kw_subscription, $.name, $.kw_refresh, $.kw_sequences),
|
|
1860
1905
|
seq($.kw_alter, $.kw_subscription, $.name, $.kw_add, $.kw_publication, $.name_list, optional($.opt_definition)),
|
|
1861
1906
|
seq($.kw_alter, $.kw_subscription, $.name, $.kw_drop, $.kw_publication, $.name_list, optional($.opt_definition)),
|
|
1862
1907
|
prec.left(11, prec.dynamic(11, seq($.kw_alter, $.kw_subscription, $.name, $.kw_set, $.kw_publication, $.name_list, optional($.opt_definition)))),
|
|
@@ -2023,11 +2068,14 @@ module.exports = grammar({
|
|
|
2023
2068
|
$.kw_with
|
|
2024
2069
|
),
|
|
2025
2070
|
CreateConversionStmt: $ => seq($.kw_create, optional($.opt_default), $.kw_conversion, $.any_name, $.kw_for, $.Sconst, $.kw_to, $.Sconst, $.kw_from, $.any_name),
|
|
2026
|
-
|
|
2071
|
+
RepackStmt: $ => choice(
|
|
2072
|
+
seq($.kw_repack, optional($.opt_utility_option_list), $.qualified_name, optional($.opt_name_list), $.kw_using, $.kw_index, $.name),
|
|
2073
|
+
seq($.kw_repack, optional($.opt_utility_option_list), $.qualified_name, optional($.opt_name_list), optional($.opt_usingindex)),
|
|
2074
|
+
seq($.kw_repack, optional($.opt_utility_option_list), optional($.opt_usingindex)),
|
|
2027
2075
|
prec.left(20, prec.dynamic(20, seq($.kw_cluster, '(', $.utility_option_list, ')', $.qualified_name, optional($.cluster_index_specification)))),
|
|
2028
|
-
|
|
2076
|
+
seq($.kw_cluster, optional($.opt_utility_option_list)),
|
|
2029
2077
|
seq($.kw_cluster, optional($.opt_verbose), $.qualified_name, optional($.cluster_index_specification)),
|
|
2030
|
-
seq($.kw_cluster,
|
|
2078
|
+
seq($.kw_cluster, $.kw_verbose),
|
|
2031
2079
|
seq($.kw_cluster, optional($.opt_verbose), $.name, $.kw_on, $.qualified_name)
|
|
2032
2080
|
),
|
|
2033
2081
|
cluster_index_specification: $ => seq($.kw_using, $.name),
|
|
@@ -2036,27 +2084,13 @@ module.exports = grammar({
|
|
|
2036
2084
|
prec.left(20, prec.dynamic(20, seq($.kw_vacuum, '(', $.utility_option_list, ')', optional($.opt_vacuum_relation_list))))
|
|
2037
2085
|
),
|
|
2038
2086
|
AnalyzeStmt: $ => choice(
|
|
2039
|
-
seq($.analyze_keyword, optional($.
|
|
2040
|
-
|
|
2041
|
-
),
|
|
2042
|
-
utility_option_list: $ => choice(
|
|
2043
|
-
$.utility_option_elem,
|
|
2044
|
-
seq($.utility_option_list, ',', $.utility_option_elem)
|
|
2087
|
+
seq($.analyze_keyword, optional($.opt_utility_option_list), optional($.opt_vacuum_relation_list)),
|
|
2088
|
+
seq($.analyze_keyword, $.kw_verbose, optional($.opt_vacuum_relation_list))
|
|
2045
2089
|
),
|
|
2046
2090
|
analyze_keyword: $ => choice(
|
|
2047
2091
|
$.kw_analyze,
|
|
2048
2092
|
$.kw_analyse
|
|
2049
2093
|
),
|
|
2050
|
-
utility_option_elem: $ => seq($.utility_option_name, optional($.utility_option_arg)),
|
|
2051
|
-
utility_option_name: $ => choice(
|
|
2052
|
-
$.NonReservedWord,
|
|
2053
|
-
$.analyze_keyword,
|
|
2054
|
-
$.kw_format
|
|
2055
|
-
),
|
|
2056
|
-
utility_option_arg: $ => choice(
|
|
2057
|
-
$.opt_boolean_or_string,
|
|
2058
|
-
$.NumericOnly
|
|
2059
|
-
),
|
|
2060
2094
|
opt_analyze: $ => $.analyze_keyword,
|
|
2061
2095
|
opt_verbose: $ => $.kw_verbose,
|
|
2062
2096
|
opt_full: $ => prec.left(23, prec.dynamic(23, $.kw_full)),
|
|
@@ -2129,6 +2163,7 @@ module.exports = grammar({
|
|
|
2129
2163
|
),
|
|
2130
2164
|
insert_column_item: $ => seq($.ColId, optional($.opt_indirection)),
|
|
2131
2165
|
opt_on_conflict: $ => choice(
|
|
2166
|
+
seq($.kw_on, $.kw_conflict, optional($.opt_conf_expr), $.kw_do, $.kw_select, optional($.opt_for_locking_strength), optional($.where_clause)),
|
|
2132
2167
|
prec.left(11, prec.dynamic(11, seq($.kw_on, $.kw_conflict, optional($.opt_conf_expr), $.kw_do, $.kw_update, $.kw_set, $.set_clause_list, optional($.where_clause)))),
|
|
2133
2168
|
seq($.kw_on, $.kw_conflict, optional($.opt_conf_expr), $.kw_do, $.kw_nothing)
|
|
2134
2169
|
),
|
|
@@ -2388,6 +2423,7 @@ module.exports = grammar({
|
|
|
2388
2423
|
seq($.kw_for, $.kw_share),
|
|
2389
2424
|
seq($.kw_for, $.kw_key, $.kw_share)
|
|
2390
2425
|
),
|
|
2426
|
+
opt_for_locking_strength: $ => $.for_locking_strength,
|
|
2391
2427
|
locked_rels_list: $ => seq($.kw_of, $.qualified_name_list),
|
|
2392
2428
|
values_clause: $ => choice(
|
|
2393
2429
|
prec.left(20, prec.dynamic(20, seq($.kw_values, '(', $.expr_list, ')'))),
|
|
@@ -2657,15 +2693,15 @@ module.exports = grammar({
|
|
|
2657
2693
|
prec.left(15, prec.dynamic(15, seq($.a_expr_prec, '^', $.a_expr_prec))),
|
|
2658
2694
|
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '<', $.a_expr_prec))),
|
|
2659
2695
|
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '>', $.a_expr_prec))),
|
|
2660
|
-
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '=', $.a_expr_prec)))
|
|
2696
|
+
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '=', $.a_expr_prec))),
|
|
2697
|
+
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '<=', $.a_expr_prec))),
|
|
2698
|
+
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '>=', $.a_expr_prec))),
|
|
2699
|
+
prec.left(7, prec.dynamic(7, seq($.a_expr_prec, '<>', $.a_expr_prec)))
|
|
2661
2700
|
),
|
|
2662
2701
|
a_expr: $ => choice(
|
|
2663
2702
|
alias($.a_expr_prec, $.a_expr),
|
|
2664
2703
|
prec.left(16, prec.dynamic(16, seq($.a_expr, $.kw_at, $.kw_time, $.kw_zone, $.a_expr))),
|
|
2665
2704
|
prec.left(16, prec.dynamic(16, seq($.a_expr, $.kw_at, $.kw_local))),
|
|
2666
|
-
prec.left(7, prec.dynamic(7, seq($.a_expr, '<=', $.a_expr))),
|
|
2667
|
-
prec.left(7, prec.dynamic(7, seq($.a_expr, '>=', $.a_expr))),
|
|
2668
|
-
prec.left(7, prec.dynamic(7, seq($.a_expr, '<>', $.a_expr))),
|
|
2669
2705
|
prec.left(12, prec.dynamic(12, seq($.a_expr, $.qual_Op, $.a_expr))),
|
|
2670
2706
|
prec.left(12, prec.dynamic(12, seq($.qual_Op, $.a_expr))),
|
|
2671
2707
|
prec.left(4, prec.dynamic(4, seq($.a_expr, $.kw_and, $.a_expr))),
|
|
@@ -2731,13 +2767,13 @@ module.exports = grammar({
|
|
|
2731
2767
|
prec.left(15, prec.dynamic(15, seq($.b_expr_prec, '^', $.b_expr_prec))),
|
|
2732
2768
|
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '<', $.b_expr_prec))),
|
|
2733
2769
|
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '>', $.b_expr_prec))),
|
|
2734
|
-
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '=', $.b_expr_prec)))
|
|
2770
|
+
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '=', $.b_expr_prec))),
|
|
2771
|
+
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '<=', $.b_expr_prec))),
|
|
2772
|
+
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '>=', $.b_expr_prec))),
|
|
2773
|
+
prec.left(7, prec.dynamic(7, seq($.b_expr_prec, '<>', $.b_expr_prec)))
|
|
2735
2774
|
),
|
|
2736
2775
|
b_expr: $ => choice(
|
|
2737
2776
|
alias($.b_expr_prec, $.b_expr),
|
|
2738
|
-
prec.left(7, prec.dynamic(7, seq($.b_expr, '<=', $.b_expr))),
|
|
2739
|
-
prec.left(7, prec.dynamic(7, seq($.b_expr, '>=', $.b_expr))),
|
|
2740
|
-
prec.left(7, prec.dynamic(7, seq($.b_expr, '<>', $.b_expr))),
|
|
2741
2777
|
prec.left(12, prec.dynamic(12, seq($.b_expr, $.qual_Op, $.b_expr))),
|
|
2742
2778
|
prec.left(12, prec.dynamic(12, seq($.qual_Op, $.b_expr))),
|
|
2743
2779
|
prec.left(6, prec.dynamic(6, seq($.b_expr, $.kw_is, $.kw_distinct, $.kw_from, $.b_expr))),
|
|
@@ -2771,7 +2807,7 @@ module.exports = grammar({
|
|
|
2771
2807
|
prec.left(20, prec.dynamic(20, seq($.func_name, '(', '*', ')')))
|
|
2772
2808
|
),
|
|
2773
2809
|
func_expr: $ => choice(
|
|
2774
|
-
seq($.func_application, optional($.within_group_clause), optional($.filter_clause), optional($.over_clause)),
|
|
2810
|
+
seq($.func_application, optional($.within_group_clause), optional($.filter_clause), optional($.null_treatment), optional($.over_clause)),
|
|
2775
2811
|
seq($.json_aggregate_func, optional($.filter_clause), optional($.over_clause)),
|
|
2776
2812
|
$.func_expr_common_subexpr
|
|
2777
2813
|
),
|
|
@@ -2822,7 +2858,7 @@ module.exports = grammar({
|
|
|
2822
2858
|
prec.left(20, prec.dynamic(20, seq($.kw_xmlelement, '(', $.kw_name, $.ColLabel, ',', $.expr_list, ')'))),
|
|
2823
2859
|
prec.left(20, prec.dynamic(20, seq($.kw_xmlelement, '(', $.kw_name, $.ColLabel, ',', $.xml_attributes, ',', $.expr_list, ')'))),
|
|
2824
2860
|
prec.left(20, prec.dynamic(20, seq($.kw_xmlexists, '(', $.c_expr, $.xmlexists_argument, ')'))),
|
|
2825
|
-
prec.left(20, prec.dynamic(20, seq($.kw_xmlforest, '(', $.
|
|
2861
|
+
prec.left(20, prec.dynamic(20, seq($.kw_xmlforest, '(', $.labeled_expr_list, ')'))),
|
|
2826
2862
|
prec.left(20, prec.dynamic(20, seq($.kw_xmlparse, '(', $.document_or_content, $.a_expr, optional($.xml_whitespace_option), ')'))),
|
|
2827
2863
|
prec.left(20, prec.dynamic(20, seq($.kw_xmlpi, '(', $.kw_name, $.ColLabel, ')'))),
|
|
2828
2864
|
prec.left(20, prec.dynamic(20, seq($.kw_xmlpi, '(', $.kw_name, $.ColLabel, ',', $.a_expr, ')'))),
|
|
@@ -2851,12 +2887,12 @@ module.exports = grammar({
|
|
|
2851
2887
|
seq(',', $.kw_standalone, $.kw_no),
|
|
2852
2888
|
prec.left(11, prec.dynamic(11, seq(',', $.kw_standalone, $.kw_no, $.kw_value)))
|
|
2853
2889
|
),
|
|
2854
|
-
xml_attributes: $ => prec.left(20, prec.dynamic(20, seq($.kw_xmlattributes, '(', $.
|
|
2855
|
-
|
|
2856
|
-
$.
|
|
2857
|
-
seq($.
|
|
2890
|
+
xml_attributes: $ => prec.left(20, prec.dynamic(20, seq($.kw_xmlattributes, '(', $.labeled_expr_list, ')'))),
|
|
2891
|
+
labeled_expr_list: $ => choice(
|
|
2892
|
+
$.labeled_expr,
|
|
2893
|
+
seq($.labeled_expr_list, ',', $.labeled_expr)
|
|
2858
2894
|
),
|
|
2859
|
-
|
|
2895
|
+
labeled_expr: $ => choice(
|
|
2860
2896
|
seq($.a_expr, $.kw_as, $.ColLabel),
|
|
2861
2897
|
$.a_expr
|
|
2862
2898
|
),
|
|
@@ -2882,8 +2918,14 @@ module.exports = grammar({
|
|
|
2882
2918
|
seq($.kw_by, $.kw_ref),
|
|
2883
2919
|
prec.left(11, prec.dynamic(11, seq($.kw_by, $.kw_value)))
|
|
2884
2920
|
),
|
|
2921
|
+
WaitStmt: $ => seq($.kw_wait, $.kw_for, $.kw_lsn, $.Sconst, optional($.opt_wait_with_clause)),
|
|
2922
|
+
opt_wait_with_clause: $ => prec.left(11, prec.dynamic(11, seq($.kw_with, '(', $.utility_option_list, ')'))),
|
|
2885
2923
|
within_group_clause: $ => prec.left(20, prec.dynamic(20, seq($.kw_within, $.kw_group, '(', $.sort_clause, ')'))),
|
|
2886
2924
|
filter_clause: $ => prec.left(20, prec.dynamic(20, seq($.kw_filter, '(', $.kw_where, $.a_expr, ')'))),
|
|
2925
|
+
null_treatment: $ => choice(
|
|
2926
|
+
seq($.kw_ignore, $.kw_nulls),
|
|
2927
|
+
seq($.kw_respect, $.kw_nulls)
|
|
2928
|
+
),
|
|
2887
2929
|
window_clause: $ => seq($.kw_window, $.window_definition_list),
|
|
2888
2930
|
window_definition_list: $ => choice(
|
|
2889
2931
|
$.window_definition,
|
|
@@ -3478,6 +3520,7 @@ module.exports = grammar({
|
|
|
3478
3520
|
$.kw_lock,
|
|
3479
3521
|
$.kw_locked,
|
|
3480
3522
|
$.kw_logged,
|
|
3523
|
+
$.kw_lsn,
|
|
3481
3524
|
$.kw_mapping,
|
|
3482
3525
|
$.kw_match,
|
|
3483
3526
|
$.kw_matched,
|
|
@@ -3574,6 +3617,7 @@ module.exports = grammar({
|
|
|
3574
3617
|
$.kw_relative,
|
|
3575
3618
|
$.kw_release,
|
|
3576
3619
|
$.kw_rename,
|
|
3620
|
+
$.kw_repack,
|
|
3577
3621
|
$.kw_repeatable,
|
|
3578
3622
|
$.kw_replace,
|
|
3579
3623
|
$.kw_replica,
|
|
@@ -3689,6 +3733,7 @@ module.exports = grammar({
|
|
|
3689
3733
|
$.kw_views,
|
|
3690
3734
|
$.kw_virtual,
|
|
3691
3735
|
$.kw_volatile,
|
|
3736
|
+
$.kw_wait,
|
|
3692
3737
|
$.kw_when,
|
|
3693
3738
|
$.kw_whitespace,
|
|
3694
3739
|
$.kw_work,
|
|
@@ -3829,6 +3874,7 @@ module.exports = grammar({
|
|
|
3829
3874
|
$.kw_hour,
|
|
3830
3875
|
$.kw_identity,
|
|
3831
3876
|
$.kw_if,
|
|
3877
|
+
$.kw_ignore,
|
|
3832
3878
|
$.kw_immediate,
|
|
3833
3879
|
$.kw_immutable,
|
|
3834
3880
|
$.kw_implicit,
|
|
@@ -3864,6 +3910,7 @@ module.exports = grammar({
|
|
|
3864
3910
|
$.kw_lock,
|
|
3865
3911
|
$.kw_locked,
|
|
3866
3912
|
$.kw_logged,
|
|
3913
|
+
$.kw_lsn,
|
|
3867
3914
|
$.kw_mapping,
|
|
3868
3915
|
$.kw_match,
|
|
3869
3916
|
$.kw_matched,
|
|
@@ -3943,10 +3990,12 @@ module.exports = grammar({
|
|
|
3943
3990
|
$.kw_relative,
|
|
3944
3991
|
$.kw_release,
|
|
3945
3992
|
$.kw_rename,
|
|
3993
|
+
$.kw_repack,
|
|
3946
3994
|
$.kw_repeatable,
|
|
3947
3995
|
$.kw_replace,
|
|
3948
3996
|
$.kw_replica,
|
|
3949
3997
|
$.kw_reset,
|
|
3998
|
+
$.kw_respect,
|
|
3950
3999
|
$.kw_restart,
|
|
3951
4000
|
$.kw_restrict,
|
|
3952
4001
|
$.kw_return,
|
|
@@ -4033,6 +4082,7 @@ module.exports = grammar({
|
|
|
4033
4082
|
$.kw_views,
|
|
4034
4083
|
$.kw_virtual,
|
|
4035
4084
|
$.kw_volatile,
|
|
4085
|
+
$.kw_wait,
|
|
4036
4086
|
$.kw_whitespace,
|
|
4037
4087
|
$.kw_within,
|
|
4038
4088
|
$.kw_without,
|
|
@@ -4398,6 +4448,7 @@ module.exports = grammar({
|
|
|
4398
4448
|
kw_hour: _ => token(prec(1, /[hH][oO][uU][rR]/)),
|
|
4399
4449
|
kw_identity: _ => token(prec(1, /[iI][dD][eE][nN][tT][iI][tT][yY]/)),
|
|
4400
4450
|
kw_if: _ => token(prec(1, /[iI][fF]/)),
|
|
4451
|
+
kw_ignore: _ => token(prec(1, /[iI][gG][nN][oO][rR][eE]/)),
|
|
4401
4452
|
kw_ilike: _ => token(prec(1, /[iI][lL][iI][kK][eE]/)),
|
|
4402
4453
|
kw_immediate: _ => token(prec(1, /[iI][mM][mM][eE][dD][iI][aA][tT][eE]/)),
|
|
4403
4454
|
kw_immutable: _ => token(prec(1, /[iI][mM][mM][uU][tT][aA][bB][lL][eE]/)),
|
|
@@ -4465,6 +4516,7 @@ module.exports = grammar({
|
|
|
4465
4516
|
kw_lock: _ => token(prec(1, /[lL][oO][cC][kK]/)),
|
|
4466
4517
|
kw_locked: _ => token(prec(1, /[lL][oO][cC][kK][eE][dD]/)),
|
|
4467
4518
|
kw_logged: _ => token(prec(1, /[lL][oO][gG][gG][eE][dD]/)),
|
|
4519
|
+
kw_lsn: _ => token(prec(1, /[lL][sS][nN]/)),
|
|
4468
4520
|
kw_mapping: _ => token(prec(1, /[mM][aA][pP][pP][iI][nN][gG]/)),
|
|
4469
4521
|
kw_match: _ => token(prec(1, /[mM][aA][tT][cC][hH]/)),
|
|
4470
4522
|
kw_matched: _ => token(prec(1, /[mM][aA][tT][cC][hH][eE][dD]/)),
|
|
@@ -4570,10 +4622,12 @@ module.exports = grammar({
|
|
|
4570
4622
|
kw_relative: _ => token(prec(1, /[rR][eE][lL][aA][tT][iI][vV][eE]/)),
|
|
4571
4623
|
kw_release: _ => token(prec(1, /[rR][eE][lL][eE][aA][sS][eE]/)),
|
|
4572
4624
|
kw_rename: _ => token(prec(1, /[rR][eE][nN][aA][mM][eE]/)),
|
|
4625
|
+
kw_repack: _ => token(prec(1, /[rR][eE][pP][aA][cC][kK]/)),
|
|
4573
4626
|
kw_repeatable: _ => token(prec(1, /[rR][eE][pP][eE][aA][tT][aA][bB][lL][eE]/)),
|
|
4574
4627
|
kw_replace: _ => token(prec(1, /[rR][eE][pP][lL][aA][cC][eE]/)),
|
|
4575
4628
|
kw_replica: _ => token(prec(1, /[rR][eE][pP][lL][iI][cC][aA]/)),
|
|
4576
4629
|
kw_reset: _ => token(prec(1, /[rR][eE][sS][eE][tT]/)),
|
|
4630
|
+
kw_respect: _ => token(prec(1, /[rR][eE][sS][pP][eE][cC][tT]/)),
|
|
4577
4631
|
kw_restart: _ => token(prec(1, /[rR][eE][sS][tT][aA][rR][tT]/)),
|
|
4578
4632
|
kw_restrict: _ => token(prec(1, /[rR][eE][sS][tT][rR][iI][cC][tT]/)),
|
|
4579
4633
|
kw_return: _ => token(prec(1, /[rR][eE][tT][uU][rR][nN]/)),
|
|
@@ -4690,6 +4744,7 @@ module.exports = grammar({
|
|
|
4690
4744
|
kw_views: _ => token(prec(1, /[vV][iI][eE][wW][sS]/)),
|
|
4691
4745
|
kw_virtual: _ => token(prec(1, /[vV][iI][rR][tT][uU][aA][lL]/)),
|
|
4692
4746
|
kw_volatile: _ => token(prec(1, /[vV][oO][lL][aA][tT][iI][lL][eE]/)),
|
|
4747
|
+
kw_wait: _ => token(prec(1, /[wW][aA][iI][tT]/)),
|
|
4693
4748
|
kw_when: _ => token(prec(1, /[wW][hH][eE][nN]/)),
|
|
4694
4749
|
kw_where: _ => token(prec(1, /[wW][hH][eE][rR][eE]/)),
|
|
4695
4750
|
kw_whitespace: _ => token(prec(1, /[wW][hH][iI][tT][eE][sS][pP][aA][cC][eE]/)),
|
|
@@ -4780,9 +4835,17 @@ module.exports = grammar({
|
|
|
4780
4835
|
// ── Operators ────────────────────────────────────────────────────────────────
|
|
4781
4836
|
|
|
4782
4837
|
// Custom and built-in multi-character operators.
|
|
4783
|
-
// The specific compound operators (::, .., :=, =>, <=, >=, <>) are
|
|
4784
|
-
// as string literals in the grammar rules and take priority.
|
|
4785
|
-
|
|
4838
|
+
// The specific compound operators (::, .., :=, =>, <=, >=, <>) are
|
|
4839
|
+
// matched as string literals in the grammar rules and take priority.
|
|
4840
|
+
// Implements scan.l's trailing +/- rule: an operator may only end in
|
|
4841
|
+
// + or - if it also contains one of ~ ! @ # ^ & | ? — otherwise the
|
|
4842
|
+
// trailing +/- lexes as a separate token, so "a<-1" is "a < -1". Bare
|
|
4843
|
+
// + and - are intentionally not matched; the grammar uses them as
|
|
4844
|
+
// literals.
|
|
4845
|
+
operator: _ => token(choice(
|
|
4846
|
+
/[~!@#^&|?+\-*/%<>=]*[~!@#^&|?][~!@#^&|?+\-*/%<>=]*/,
|
|
4847
|
+
/[+\-*/%<>=]*[*/%<>=]/
|
|
4848
|
+
)),
|
|
4786
4849
|
|
|
4787
4850
|
// ── Comments ─────────────────────────────────────────────────────────────────
|
|
4788
4851
|
|