tree-sitter-postgres 19.0.0-beta.3 → 19.0.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-postgres",
3
- "version": "19.0.0-beta.3",
3
+ "version": "19.0.0-beta.4",
4
4
  "description": "PostgreSQL grammar for tree-sitter, generated from Postgres source",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,12 +50,18 @@ extern "C" {
50
50
  /// memory allocated for the array's contents.
51
51
  #define array_clear(self) ((self)->size = 0)
52
52
 
53
+ #ifdef __cplusplus
54
+ #define _array__cast(self, expr) (decltype((self)->contents))(expr)
55
+ #else
56
+ #define _array__cast(self, expr) (expr)
57
+ #endif
58
+
53
59
  /// Reserve `new_capacity` elements of space in the array. If `new_capacity` is
54
60
  /// less than the array's current capacity, this function has no effect.
55
- #define array_reserve(self, new_capacity) \
56
- ((self)->contents = _array__reserve( \
57
- (void *)(self)->contents, &(self)->capacity, \
58
- array_elem_size(self), new_capacity) \
61
+ #define array_reserve(self, new_capacity) \
62
+ ((self)->contents = _array__cast(self, _array__reserve( \
63
+ (void *)(self)->contents, &(self)->capacity, \
64
+ array_elem_size(self), new_capacity)) \
59
65
  )
60
66
 
61
67
  /// Free any memory allocated for this array. Note that this does not free any
@@ -71,10 +77,10 @@ extern "C" {
71
77
  /// Push a new `element` onto the end of the array.
72
78
  #define array_push(self, element) \
73
79
  do { \
74
- (self)->contents = _array__grow( \
80
+ (self)->contents = _array__cast(self, _array__grow( \
75
81
  (void *)(self)->contents, (self)->size, &(self)->capacity, \
76
82
  1, array_elem_size(self) \
77
- ); \
83
+ )); \
78
84
  (self)->contents[(self)->size++] = (element); \
79
85
  } while(0)
80
86
 
@@ -83,10 +89,10 @@ extern "C" {
83
89
  #define array_grow_by(self, count) \
84
90
  do { \
85
91
  if ((count) == 0) break; \
86
- (self)->contents = _array__grow( \
92
+ (self)->contents = _array__cast(self, _array__grow( \
87
93
  (self)->contents, (self)->size, &(self)->capacity, \
88
94
  count, array_elem_size(self) \
89
- ); \
95
+ )); \
90
96
  memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \
91
97
  (self)->size += (count); \
92
98
  } while (0)
@@ -98,26 +104,26 @@ extern "C" {
98
104
  /// Append `count` elements to the end of the array, reading their values from the
99
105
  /// `contents` pointer.
100
106
  #define array_extend(self, count, other_contents) \
101
- (self)->contents = _array__splice( \
107
+ ((self)->contents = _array__cast(self, _array__splice( \
102
108
  (void*)(self)->contents, &(self)->size, &(self)->capacity, \
103
109
  array_elem_size(self), (self)->size, 0, count, other_contents \
104
- )
110
+ )))
105
111
 
106
112
  /// Remove `old_count` elements from the array starting at the given `index`. At
107
113
  /// the same index, insert `new_count` new elements, reading their values from the
108
114
  /// `new_contents` pointer.
109
115
  #define array_splice(self, _index, old_count, new_count, new_contents) \
110
- (self)->contents = _array__splice( \
116
+ ((self)->contents = _array__cast(self, _array__splice( \
111
117
  (void *)(self)->contents, &(self)->size, &(self)->capacity, \
112
118
  array_elem_size(self), _index, old_count, new_count, new_contents \
113
- )
119
+ )))
114
120
 
115
121
  /// Insert one `element` into the array at the given `index`.
116
122
  #define array_insert(self, _index, element) \
117
- (self)->contents = _array__splice( \
123
+ ((self)->contents = _array__cast(self, _array__splice( \
118
124
  (void *)(self)->contents, &(self)->size, &(self)->capacity, \
119
125
  array_elem_size(self), _index, 0, 1, &(element) \
120
- )
126
+ )))
121
127
 
122
128
  /// Remove one element from the array at the given `index`.
123
129
  #define array_erase(self, _index) \
@@ -128,17 +134,17 @@ extern "C" {
128
134
 
129
135
  /// Assign the contents of one array to another, reallocating if necessary.
130
136
  #define array_assign(self, other) \
131
- (self)->contents = _array__assign( \
137
+ ((self)->contents = _array__cast(self, _array__assign( \
132
138
  (void *)(self)->contents, &(self)->size, &(self)->capacity, \
133
139
  (const void *)(other)->contents, (other)->size, array_elem_size(self) \
134
- )
140
+ )))
135
141
 
136
142
  /// Swap one array with another
137
143
  #define array_swap(self, other) \
138
144
  do { \
139
145
  void *_array_swap_tmp = (void *)(self)->contents; \
140
146
  (self)->contents = (other)->contents; \
141
- (other)->contents = _array_swap_tmp; \
147
+ (other)->contents = _array__cast(other, _array_swap_tmp); \
142
148
  _array__swap(&(self)->size, &(self)->capacity, \
143
149
  &(other)->size, &(other)->capacity); \
144
150
  } while (0)
@@ -36,7 +36,6 @@ module.exports = grammar({
36
36
  [$.utility_option_name, $.unreserved_keyword],
37
37
  [$.ConstDatetime, $.col_name_keyword],
38
38
  [$.simple_select, $.simple_select],
39
- [$.a_expr, $.a_expr],
40
39
  [$.target_el, $.target_el],
41
40
  [$.ConstDatetime, $.ConstDatetime],
42
41
  [$.table_ref, $.table_ref],
@@ -2221,11 +2220,11 @@ module.exports = grammar({
2221
2220
  seq($.merge_when_list, $.merge_when_clause)
2222
2221
  ),
2223
2222
  merge_when_clause: $ => choice(
2224
- seq($.merge_when_tgt_matched, $.opt_merge_when_condition, $.kw_then, $.merge_update),
2225
- seq($.merge_when_tgt_matched, $.opt_merge_when_condition, $.kw_then, $.merge_delete),
2226
- seq($.merge_when_tgt_not_matched, $.opt_merge_when_condition, $.kw_then, $.merge_insert),
2227
- seq($.merge_when_tgt_matched, $.opt_merge_when_condition, $.kw_then, $.kw_do, $.kw_nothing),
2228
- seq($.merge_when_tgt_not_matched, $.opt_merge_when_condition, $.kw_then, $.kw_do, $.kw_nothing)
2223
+ seq($.merge_when_tgt_matched, optional($.opt_merge_when_condition), $.kw_then, $.merge_update),
2224
+ seq($.merge_when_tgt_matched, optional($.opt_merge_when_condition), $.kw_then, $.merge_delete),
2225
+ seq($.merge_when_tgt_not_matched, optional($.opt_merge_when_condition), $.kw_then, $.merge_insert),
2226
+ seq($.merge_when_tgt_matched, optional($.opt_merge_when_condition), $.kw_then, $.kw_do, $.kw_nothing),
2227
+ seq($.merge_when_tgt_not_matched, optional($.opt_merge_when_condition), $.kw_then, $.kw_do, $.kw_nothing)
2229
2228
  ),
2230
2229
  merge_when_tgt_matched: $ => choice(
2231
2230
  seq($.kw_when, $.kw_matched),
@@ -4806,7 +4805,7 @@ module.exports = grammar({
4806
4805
  // ── String literals ──────────────────────────────────────────────────────────
4807
4806
 
4808
4807
  // Standard SQL string: 'hello' — doubled single-quote is the escape: 'it''s'
4809
- string_literal: _ => token(/'([^']|'')*'/),
4808
+ string_literal: _ => token(/'([^']|'')*'(([ \t\f\v]|--[^\n\r]*)*[\n\r]([ \t\n\r\f\v]+|--[^\n\r]*[\n\r])*'([^']|'')*')*/),
4810
4809
 
4811
4810
  // Escape string: E'...' (or e'...') — backslash escapes apply, so \' is an
4812
4811
  // escaped quote and does not terminate the string (unlike a standard
@@ -4814,7 +4813,7 @@ module.exports = grammar({
4814
4813
  // lexer prefers this over the bare E identifier by longest match. Content
4815
4814
  // is any non-quote/non-backslash char, a doubled quote, or a backslash
4816
4815
  // escape. ruleutils emits E'...' for any string containing backslashes.
4817
- escape_string_literal: _ => token(/[eE]'([^'\\]|''|\\.)*'/),
4816
+ escape_string_literal: _ => token(/[eE]'([^'\\]|''|\\.)*'(([ \t\f\v]|--[^\n\r]*)*[\n\r]([ \t\n\r\f\v]+|--[^\n\r]*[\n\r])*'([^'\\]|''|\\.)*')*/),
4818
4817
 
4819
4818
  // NOTE: N'...' and U&'...' prefix strings are still parsed as
4820
4819
  // function-call-like forms (identifier + string_literal).
@@ -4827,10 +4826,10 @@ module.exports = grammar({
4827
4826
  // strings in a single file.
4828
4827
 
4829
4828
  // Bit string: B'0101'
4830
- bit_string_literal: _ => token(/[bB]'[01]*'/),
4829
+ bit_string_literal: _ => token(/[bB]'[01]*'(([ \t\f\v]|--[^\n\r]*)*[\n\r]([ \t\n\r\f\v]+|--[^\n\r]*[\n\r])*'[01]*')*/),
4831
4830
 
4832
4831
  // Hex string: X'deadbeef'
4833
- hex_string_literal: _ => token(/[xX]'[0-9a-fA-F]*'/),
4832
+ hex_string_literal: _ => token(/[xX]'[0-9a-fA-F]*'(([ \t\f\v]|--[^\n\r]*)*[\n\r]([ \t\n\r\f\v]+|--[^\n\r]*[\n\r])*'[0-9a-fA-F]*')*/),
4834
4833
 
4835
4834
  // ── Operators ────────────────────────────────────────────────────────────────
4836
4835
 
@@ -35912,8 +35912,16 @@
35912
35912
  "name": "merge_when_tgt_matched"
35913
35913
  },
35914
35914
  {
35915
- "type": "SYMBOL",
35916
- "name": "opt_merge_when_condition"
35915
+ "type": "CHOICE",
35916
+ "members": [
35917
+ {
35918
+ "type": "SYMBOL",
35919
+ "name": "opt_merge_when_condition"
35920
+ },
35921
+ {
35922
+ "type": "BLANK"
35923
+ }
35924
+ ]
35917
35925
  },
35918
35926
  {
35919
35927
  "type": "SYMBOL",
@@ -35933,8 +35941,16 @@
35933
35941
  "name": "merge_when_tgt_matched"
35934
35942
  },
35935
35943
  {
35936
- "type": "SYMBOL",
35937
- "name": "opt_merge_when_condition"
35944
+ "type": "CHOICE",
35945
+ "members": [
35946
+ {
35947
+ "type": "SYMBOL",
35948
+ "name": "opt_merge_when_condition"
35949
+ },
35950
+ {
35951
+ "type": "BLANK"
35952
+ }
35953
+ ]
35938
35954
  },
35939
35955
  {
35940
35956
  "type": "SYMBOL",
@@ -35954,8 +35970,16 @@
35954
35970
  "name": "merge_when_tgt_not_matched"
35955
35971
  },
35956
35972
  {
35957
- "type": "SYMBOL",
35958
- "name": "opt_merge_when_condition"
35973
+ "type": "CHOICE",
35974
+ "members": [
35975
+ {
35976
+ "type": "SYMBOL",
35977
+ "name": "opt_merge_when_condition"
35978
+ },
35979
+ {
35980
+ "type": "BLANK"
35981
+ }
35982
+ ]
35959
35983
  },
35960
35984
  {
35961
35985
  "type": "SYMBOL",
@@ -35975,8 +35999,16 @@
35975
35999
  "name": "merge_when_tgt_matched"
35976
36000
  },
35977
36001
  {
35978
- "type": "SYMBOL",
35979
- "name": "opt_merge_when_condition"
36002
+ "type": "CHOICE",
36003
+ "members": [
36004
+ {
36005
+ "type": "SYMBOL",
36006
+ "name": "opt_merge_when_condition"
36007
+ },
36008
+ {
36009
+ "type": "BLANK"
36010
+ }
36011
+ ]
35980
36012
  },
35981
36013
  {
35982
36014
  "type": "SYMBOL",
@@ -36000,8 +36032,16 @@
36000
36032
  "name": "merge_when_tgt_not_matched"
36001
36033
  },
36002
36034
  {
36003
- "type": "SYMBOL",
36004
- "name": "opt_merge_when_condition"
36035
+ "type": "CHOICE",
36036
+ "members": [
36037
+ {
36038
+ "type": "SYMBOL",
36039
+ "name": "opt_merge_when_condition"
36040
+ },
36041
+ {
36042
+ "type": "BLANK"
36043
+ }
36044
+ ]
36005
36045
  },
36006
36046
  {
36007
36047
  "type": "SYMBOL",
@@ -61760,28 +61800,28 @@
61760
61800
  "type": "TOKEN",
61761
61801
  "content": {
61762
61802
  "type": "PATTERN",
61763
- "value": "'([^']|'')*'"
61803
+ "value": "'([^']|'')*'(([ \\t\\f\\v]|--[^\\n\\r]*)*[\\n\\r]([ \\t\\n\\r\\f\\v]+|--[^\\n\\r]*[\\n\\r])*'([^']|'')*')*"
61764
61804
  }
61765
61805
  },
61766
61806
  "escape_string_literal": {
61767
61807
  "type": "TOKEN",
61768
61808
  "content": {
61769
61809
  "type": "PATTERN",
61770
- "value": "[eE]'([^'\\\\]|''|\\\\.)*'"
61810
+ "value": "[eE]'([^'\\\\]|''|\\\\.)*'(([ \\t\\f\\v]|--[^\\n\\r]*)*[\\n\\r]([ \\t\\n\\r\\f\\v]+|--[^\\n\\r]*[\\n\\r])*'([^'\\\\]|''|\\\\.)*')*"
61771
61811
  }
61772
61812
  },
61773
61813
  "bit_string_literal": {
61774
61814
  "type": "TOKEN",
61775
61815
  "content": {
61776
61816
  "type": "PATTERN",
61777
- "value": "[bB]'[01]*'"
61817
+ "value": "[bB]'[01]*'(([ \\t\\f\\v]|--[^\\n\\r]*)*[\\n\\r]([ \\t\\n\\r\\f\\v]+|--[^\\n\\r]*[\\n\\r])*'[01]*')*"
61778
61818
  }
61779
61819
  },
61780
61820
  "hex_string_literal": {
61781
61821
  "type": "TOKEN",
61782
61822
  "content": {
61783
61823
  "type": "PATTERN",
61784
- "value": "[xX]'[0-9a-fA-F]*'"
61824
+ "value": "[xX]'[0-9a-fA-F]*'(([ \\t\\f\\v]|--[^\\n\\r]*)*[\\n\\r]([ \\t\\n\\r\\f\\v]+|--[^\\n\\r]*[\\n\\r])*'[0-9a-fA-F]*')*"
61785
61825
  }
61786
61826
  },
61787
61827
  "operator": {
@@ -61840,10 +61880,6 @@
61840
61880
  "simple_select",
61841
61881
  "simple_select"
61842
61882
  ],
61843
- [
61844
- "a_expr",
61845
- "a_expr"
61846
- ],
61847
61883
  [
61848
61884
  "target_el",
61849
61885
  "target_el"
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/postgres/src/parser.c
3
- size: 97677172 bytes
4
- sha256: 94821b789d8b271b926f146cfa8abb6c6e9256d66b5c136ba0720e493343c43c
3
+ size: 97664793 bytes
4
+ sha256: a9090d5082ae5c23892d05aa59e61476f9bd39ad634228f2046024debdf815b5
@@ -50,12 +50,18 @@ extern "C" {
50
50
  /// memory allocated for the array's contents.
51
51
  #define array_clear(self) ((self)->size = 0)
52
52
 
53
+ #ifdef __cplusplus
54
+ #define _array__cast(self, expr) (decltype((self)->contents))(expr)
55
+ #else
56
+ #define _array__cast(self, expr) (expr)
57
+ #endif
58
+
53
59
  /// Reserve `new_capacity` elements of space in the array. If `new_capacity` is
54
60
  /// less than the array's current capacity, this function has no effect.
55
- #define array_reserve(self, new_capacity) \
56
- ((self)->contents = _array__reserve( \
57
- (void *)(self)->contents, &(self)->capacity, \
58
- array_elem_size(self), new_capacity) \
61
+ #define array_reserve(self, new_capacity) \
62
+ ((self)->contents = _array__cast(self, _array__reserve( \
63
+ (void *)(self)->contents, &(self)->capacity, \
64
+ array_elem_size(self), new_capacity)) \
59
65
  )
60
66
 
61
67
  /// Free any memory allocated for this array. Note that this does not free any
@@ -71,10 +77,10 @@ extern "C" {
71
77
  /// Push a new `element` onto the end of the array.
72
78
  #define array_push(self, element) \
73
79
  do { \
74
- (self)->contents = _array__grow( \
80
+ (self)->contents = _array__cast(self, _array__grow( \
75
81
  (void *)(self)->contents, (self)->size, &(self)->capacity, \
76
82
  1, array_elem_size(self) \
77
- ); \
83
+ )); \
78
84
  (self)->contents[(self)->size++] = (element); \
79
85
  } while(0)
80
86
 
@@ -83,10 +89,10 @@ extern "C" {
83
89
  #define array_grow_by(self, count) \
84
90
  do { \
85
91
  if ((count) == 0) break; \
86
- (self)->contents = _array__grow( \
92
+ (self)->contents = _array__cast(self, _array__grow( \
87
93
  (self)->contents, (self)->size, &(self)->capacity, \
88
94
  count, array_elem_size(self) \
89
- ); \
95
+ )); \
90
96
  memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \
91
97
  (self)->size += (count); \
92
98
  } while (0)
@@ -98,26 +104,26 @@ extern "C" {
98
104
  /// Append `count` elements to the end of the array, reading their values from the
99
105
  /// `contents` pointer.
100
106
  #define array_extend(self, count, other_contents) \
101
- (self)->contents = _array__splice( \
107
+ ((self)->contents = _array__cast(self, _array__splice( \
102
108
  (void*)(self)->contents, &(self)->size, &(self)->capacity, \
103
109
  array_elem_size(self), (self)->size, 0, count, other_contents \
104
- )
110
+ )))
105
111
 
106
112
  /// Remove `old_count` elements from the array starting at the given `index`. At
107
113
  /// the same index, insert `new_count` new elements, reading their values from the
108
114
  /// `new_contents` pointer.
109
115
  #define array_splice(self, _index, old_count, new_count, new_contents) \
110
- (self)->contents = _array__splice( \
116
+ ((self)->contents = _array__cast(self, _array__splice( \
111
117
  (void *)(self)->contents, &(self)->size, &(self)->capacity, \
112
118
  array_elem_size(self), _index, old_count, new_count, new_contents \
113
- )
119
+ )))
114
120
 
115
121
  /// Insert one `element` into the array at the given `index`.
116
122
  #define array_insert(self, _index, element) \
117
- (self)->contents = _array__splice( \
123
+ ((self)->contents = _array__cast(self, _array__splice( \
118
124
  (void *)(self)->contents, &(self)->size, &(self)->capacity, \
119
125
  array_elem_size(self), _index, 0, 1, &(element) \
120
- )
126
+ )))
121
127
 
122
128
  /// Remove one element from the array at the given `index`.
123
129
  #define array_erase(self, _index) \
@@ -128,17 +134,17 @@ extern "C" {
128
134
 
129
135
  /// Assign the contents of one array to another, reallocating if necessary.
130
136
  #define array_assign(self, other) \
131
- (self)->contents = _array__assign( \
137
+ ((self)->contents = _array__cast(self, _array__assign( \
132
138
  (void *)(self)->contents, &(self)->size, &(self)->capacity, \
133
139
  (const void *)(other)->contents, (other)->size, array_elem_size(self) \
134
- )
140
+ )))
135
141
 
136
142
  /// Swap one array with another
137
143
  #define array_swap(self, other) \
138
144
  do { \
139
145
  void *_array_swap_tmp = (void *)(self)->contents; \
140
146
  (self)->contents = (other)->contents; \
141
- (other)->contents = _array_swap_tmp; \
147
+ (other)->contents = _array__cast(other, _array_swap_tmp); \
142
148
  _array__swap(&(self)->size, &(self)->capacity, \
143
149
  &(other)->size, &(other)->capacity); \
144
150
  } while (0)
Binary file