@gram-data/tree-sitter-gram 0.3.7 → 0.3.9
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/editors/zed/extension.toml +3 -3
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/darwin-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/linux-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/linux-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/win32-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/win32-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/src/parser.c +2 -2
- package/src/tree_sitter/array.h +68 -124
- package/tree-sitter-gram.wasm +0 -0
- package/tree-sitter.json +1 -1
- package/editors/zed/languages/gram/highlights.scm +0 -111
- package/editors/zed/languages/gram/indents.scm +0 -14
- package/editors/zed/languages/gram/injections.scm +0 -29
- package/editors/zed/languages/gram/locals.scm +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
id = "gram"
|
|
2
2
|
name = "Gram Language Support"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.9"
|
|
4
4
|
schema_version = 1
|
|
5
5
|
authors = ["Gram Data Contributors"]
|
|
6
6
|
description = "Support for Gram notation - composable data patterns"
|
|
@@ -12,5 +12,5 @@ capabilities = [
|
|
|
12
12
|
|
|
13
13
|
# path = "grammars/tree-sitter-gram"
|
|
14
14
|
[grammars.gram]
|
|
15
|
-
repository = "
|
|
16
|
-
rev = "
|
|
15
|
+
repository = "file:///Users/akollegger/Developer/gram-data/tree-sitter-gram"
|
|
16
|
+
rev = "v0.3.9"
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/parser.c
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Automatically @generated by tree-sitter */
|
|
1
|
+
/* Automatically @generated by tree-sitter v0.25.10 */
|
|
2
2
|
|
|
3
3
|
#include "tree_sitter/parser.h"
|
|
4
4
|
|
|
@@ -4368,7 +4368,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_gram(void) {
|
|
|
4368
4368
|
.metadata = {
|
|
4369
4369
|
.major_version = 0,
|
|
4370
4370
|
.minor_version = 3,
|
|
4371
|
-
.patch_version =
|
|
4371
|
+
.patch_version = 9,
|
|
4372
4372
|
},
|
|
4373
4373
|
};
|
|
4374
4374
|
return &language;
|
package/src/tree_sitter/array.h
CHANGED
|
@@ -52,91 +52,67 @@ extern "C" {
|
|
|
52
52
|
|
|
53
53
|
/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is
|
|
54
54
|
/// less than the array's current capacity, this function has no effect.
|
|
55
|
-
#define array_reserve(self, new_capacity)
|
|
56
|
-
((self)
|
|
57
|
-
(void *)(self)->contents, &(self)->capacity, \
|
|
58
|
-
array_elem_size(self), new_capacity) \
|
|
59
|
-
)
|
|
55
|
+
#define array_reserve(self, new_capacity) \
|
|
56
|
+
_array__reserve((Array *)(self), array_elem_size(self), new_capacity)
|
|
60
57
|
|
|
61
58
|
/// Free any memory allocated for this array. Note that this does not free any
|
|
62
59
|
/// memory allocated for the array's contents.
|
|
63
|
-
#define array_delete(self) _array__delete((
|
|
60
|
+
#define array_delete(self) _array__delete((Array *)(self))
|
|
64
61
|
|
|
65
62
|
/// Push a new `element` onto the end of the array.
|
|
66
|
-
#define array_push(self, element)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(void *)(self)->contents, (self)->size, &(self)->capacity, \
|
|
70
|
-
1, array_elem_size(self) \
|
|
71
|
-
); \
|
|
72
|
-
(self)->contents[(self)->size++] = (element); \
|
|
73
|
-
} while(0)
|
|
63
|
+
#define array_push(self, element) \
|
|
64
|
+
(_array__grow((Array *)(self), 1, array_elem_size(self)), \
|
|
65
|
+
(self)->contents[(self)->size++] = (element))
|
|
74
66
|
|
|
75
67
|
/// Increase the array's size by `count` elements.
|
|
76
68
|
/// New elements are zero-initialized.
|
|
77
|
-
#define array_grow_by(self, count)
|
|
78
|
-
do {
|
|
79
|
-
if ((count) == 0) break;
|
|
80
|
-
(self)
|
|
81
|
-
(self)->contents, (self)->size, &(self)->capacity, \
|
|
82
|
-
count, array_elem_size(self) \
|
|
83
|
-
); \
|
|
69
|
+
#define array_grow_by(self, count) \
|
|
70
|
+
do { \
|
|
71
|
+
if ((count) == 0) break; \
|
|
72
|
+
_array__grow((Array *)(self), count, array_elem_size(self)); \
|
|
84
73
|
memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \
|
|
85
|
-
(self)->size += (count);
|
|
74
|
+
(self)->size += (count); \
|
|
86
75
|
} while (0)
|
|
87
76
|
|
|
88
77
|
/// Append all elements from one array to the end of another.
|
|
89
|
-
#define array_push_all(self, other)
|
|
78
|
+
#define array_push_all(self, other) \
|
|
90
79
|
array_extend((self), (other)->size, (other)->contents)
|
|
91
80
|
|
|
92
81
|
/// Append `count` elements to the end of the array, reading their values from the
|
|
93
82
|
/// `contents` pointer.
|
|
94
|
-
#define array_extend(self, count,
|
|
95
|
-
|
|
96
|
-
(
|
|
97
|
-
|
|
83
|
+
#define array_extend(self, count, contents) \
|
|
84
|
+
_array__splice( \
|
|
85
|
+
(Array *)(self), array_elem_size(self), (self)->size, \
|
|
86
|
+
0, count, contents \
|
|
98
87
|
)
|
|
99
88
|
|
|
100
89
|
/// Remove `old_count` elements from the array starting at the given `index`. At
|
|
101
90
|
/// the same index, insert `new_count` new elements, reading their values from the
|
|
102
91
|
/// `new_contents` pointer.
|
|
103
|
-
#define array_splice(self, _index, old_count, new_count, new_contents)
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
92
|
+
#define array_splice(self, _index, old_count, new_count, new_contents) \
|
|
93
|
+
_array__splice( \
|
|
94
|
+
(Array *)(self), array_elem_size(self), _index, \
|
|
95
|
+
old_count, new_count, new_contents \
|
|
107
96
|
)
|
|
108
97
|
|
|
109
98
|
/// Insert one `element` into the array at the given `index`.
|
|
110
|
-
#define array_insert(self, _index, element)
|
|
111
|
-
(self)
|
|
112
|
-
(void *)(self)->contents, &(self)->size, &(self)->capacity, \
|
|
113
|
-
array_elem_size(self), _index, 0, 1, &(element) \
|
|
114
|
-
)
|
|
99
|
+
#define array_insert(self, _index, element) \
|
|
100
|
+
_array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element))
|
|
115
101
|
|
|
116
102
|
/// Remove one element from the array at the given `index`.
|
|
117
103
|
#define array_erase(self, _index) \
|
|
118
|
-
_array__erase((
|
|
104
|
+
_array__erase((Array *)(self), array_elem_size(self), _index)
|
|
119
105
|
|
|
120
106
|
/// Pop the last element off the array, returning the element by value.
|
|
121
107
|
#define array_pop(self) ((self)->contents[--(self)->size])
|
|
122
108
|
|
|
123
109
|
/// Assign the contents of one array to another, reallocating if necessary.
|
|
124
|
-
#define array_assign(self, other)
|
|
125
|
-
(self)
|
|
126
|
-
(void *)(self)->contents, &(self)->size, &(self)->capacity, \
|
|
127
|
-
(const void *)(other)->contents, (other)->size, array_elem_size(self) \
|
|
128
|
-
)
|
|
110
|
+
#define array_assign(self, other) \
|
|
111
|
+
_array__assign((Array *)(self), (const Array *)(other), array_elem_size(self))
|
|
129
112
|
|
|
130
113
|
/// Swap one array with another
|
|
131
|
-
#define array_swap(self, other)
|
|
132
|
-
|
|
133
|
-
struct Swap swapped_contents = _array__swap( \
|
|
134
|
-
(void *)(self)->contents, &(self)->size, &(self)->capacity, \
|
|
135
|
-
(void *)(other)->contents, &(other)->size, &(other)->capacity \
|
|
136
|
-
); \
|
|
137
|
-
(self)->contents = swapped_contents.self_contents; \
|
|
138
|
-
(other)->contents = swapped_contents.other_contents; \
|
|
139
|
-
} while (0)
|
|
114
|
+
#define array_swap(self, other) \
|
|
115
|
+
_array__swap((Array *)(self), (Array *)(other))
|
|
140
116
|
|
|
141
117
|
/// Get the size of the array contents
|
|
142
118
|
#define array_elem_size(self) (sizeof *(self)->contents)
|
|
@@ -181,112 +157,82 @@ extern "C" {
|
|
|
181
157
|
|
|
182
158
|
// Private
|
|
183
159
|
|
|
184
|
-
|
|
185
|
-
// are passed to the various `_array__*` functions below to address strict aliasing
|
|
186
|
-
// violations that arises when the _entire_ `Array` struct is passed as `Array(void)*`.
|
|
187
|
-
//
|
|
188
|
-
// The `Array` type itself was not altered as a solution in order to avoid breakage
|
|
189
|
-
// with existing consumers (in particular, parsers with external scanners).
|
|
160
|
+
typedef Array(void) Array;
|
|
190
161
|
|
|
191
162
|
/// This is not what you're looking for, see `array_delete`.
|
|
192
|
-
static inline void _array__delete(
|
|
193
|
-
if (contents)
|
|
194
|
-
|
|
163
|
+
static inline void _array__delete(Array *self) {
|
|
164
|
+
if (self->contents) {
|
|
165
|
+
ts_free(self->contents);
|
|
166
|
+
self->contents = NULL;
|
|
167
|
+
self->size = 0;
|
|
168
|
+
self->capacity = 0;
|
|
169
|
+
}
|
|
195
170
|
}
|
|
196
171
|
|
|
197
172
|
/// This is not what you're looking for, see `array_erase`.
|
|
198
|
-
static inline void _array__erase(
|
|
199
|
-
|
|
200
|
-
assert(index <
|
|
201
|
-
char *contents = (char *)
|
|
173
|
+
static inline void _array__erase(Array *self, size_t element_size,
|
|
174
|
+
uint32_t index) {
|
|
175
|
+
assert(index < self->size);
|
|
176
|
+
char *contents = (char *)self->contents;
|
|
202
177
|
memmove(contents + index * element_size, contents + (index + 1) * element_size,
|
|
203
|
-
(
|
|
204
|
-
|
|
178
|
+
(self->size - index - 1) * element_size);
|
|
179
|
+
self->size--;
|
|
205
180
|
}
|
|
206
181
|
|
|
207
182
|
/// This is not what you're looking for, see `array_reserve`.
|
|
208
|
-
static inline void
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (contents) {
|
|
213
|
-
new_contents = ts_realloc(contents, new_capacity * element_size);
|
|
183
|
+
static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) {
|
|
184
|
+
if (new_capacity > self->capacity) {
|
|
185
|
+
if (self->contents) {
|
|
186
|
+
self->contents = ts_realloc(self->contents, new_capacity * element_size);
|
|
214
187
|
} else {
|
|
215
|
-
|
|
188
|
+
self->contents = ts_malloc(new_capacity * element_size);
|
|
216
189
|
}
|
|
217
|
-
|
|
190
|
+
self->capacity = new_capacity;
|
|
218
191
|
}
|
|
219
|
-
return new_contents;
|
|
220
192
|
}
|
|
221
193
|
|
|
222
194
|
/// This is not what you're looking for, see `array_assign`.
|
|
223
|
-
static inline void
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
memcpy(new_contents, other_contents, *self_size * element_size);
|
|
228
|
-
return new_contents;
|
|
195
|
+
static inline void _array__assign(Array *self, const Array *other, size_t element_size) {
|
|
196
|
+
_array__reserve(self, element_size, other->size);
|
|
197
|
+
self->size = other->size;
|
|
198
|
+
memcpy(self->contents, other->contents, self->size * element_size);
|
|
229
199
|
}
|
|
230
200
|
|
|
231
|
-
struct Swap {
|
|
232
|
-
void *self_contents;
|
|
233
|
-
void *other_contents;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
201
|
/// This is not what you're looking for, see `array_swap`.
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
uint32_t new_self_size = *other_size;
|
|
242
|
-
uint32_t new_self_capacity = *other_capacity;
|
|
243
|
-
|
|
244
|
-
void *new_other_contents = self_contents;
|
|
245
|
-
*other_size = *self_size;
|
|
246
|
-
*other_capacity = *self_capacity;
|
|
247
|
-
|
|
248
|
-
*self_size = new_self_size;
|
|
249
|
-
*self_capacity = new_self_capacity;
|
|
250
|
-
|
|
251
|
-
struct Swap out = {
|
|
252
|
-
.self_contents = new_self_contents,
|
|
253
|
-
.other_contents = new_other_contents,
|
|
254
|
-
};
|
|
255
|
-
return out;
|
|
202
|
+
static inline void _array__swap(Array *self, Array *other) {
|
|
203
|
+
Array swap = *other;
|
|
204
|
+
*other = *self;
|
|
205
|
+
*self = swap;
|
|
256
206
|
}
|
|
257
207
|
|
|
258
208
|
/// This is not what you're looking for, see `array_push` or `array_grow_by`.
|
|
259
|
-
static inline void
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (new_size > *capacity) {
|
|
264
|
-
uint32_t new_capacity = *capacity * 2;
|
|
209
|
+
static inline void _array__grow(Array *self, uint32_t count, size_t element_size) {
|
|
210
|
+
uint32_t new_size = self->size + count;
|
|
211
|
+
if (new_size > self->capacity) {
|
|
212
|
+
uint32_t new_capacity = self->capacity * 2;
|
|
265
213
|
if (new_capacity < 8) new_capacity = 8;
|
|
266
214
|
if (new_capacity < new_size) new_capacity = new_size;
|
|
267
|
-
|
|
215
|
+
_array__reserve(self, element_size, new_capacity);
|
|
268
216
|
}
|
|
269
|
-
return new_contents;
|
|
270
217
|
}
|
|
271
218
|
|
|
272
219
|
/// This is not what you're looking for, see `array_splice`.
|
|
273
|
-
static inline void
|
|
274
|
-
size_t element_size,
|
|
220
|
+
static inline void _array__splice(Array *self, size_t element_size,
|
|
275
221
|
uint32_t index, uint32_t old_count,
|
|
276
222
|
uint32_t new_count, const void *elements) {
|
|
277
|
-
uint32_t new_size =
|
|
223
|
+
uint32_t new_size = self->size + new_count - old_count;
|
|
278
224
|
uint32_t old_end = index + old_count;
|
|
279
225
|
uint32_t new_end = index + new_count;
|
|
280
|
-
assert(old_end <=
|
|
226
|
+
assert(old_end <= self->size);
|
|
281
227
|
|
|
282
|
-
|
|
228
|
+
_array__reserve(self, element_size, new_size);
|
|
283
229
|
|
|
284
|
-
char *contents = (char *)
|
|
285
|
-
if (
|
|
230
|
+
char *contents = (char *)self->contents;
|
|
231
|
+
if (self->size > old_end) {
|
|
286
232
|
memmove(
|
|
287
233
|
contents + new_end * element_size,
|
|
288
234
|
contents + old_end * element_size,
|
|
289
|
-
(
|
|
235
|
+
(self->size - old_end) * element_size
|
|
290
236
|
);
|
|
291
237
|
}
|
|
292
238
|
if (new_count > 0) {
|
|
@@ -304,9 +250,7 @@ static inline void *_array__splice(void *self_contents, uint32_t *size, uint32_t
|
|
|
304
250
|
);
|
|
305
251
|
}
|
|
306
252
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return new_contents;
|
|
253
|
+
self->size += new_count - old_count;
|
|
310
254
|
}
|
|
311
255
|
|
|
312
256
|
/// A binary search routine, based on Rust's `std::slice::binary_search_by`.
|
package/tree-sitter-gram.wasm
CHANGED
|
Binary file
|
package/tree-sitter.json
CHANGED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
; Strings
|
|
2
|
-
(string_literal) @string
|
|
3
|
-
(string_content) @string
|
|
4
|
-
|
|
5
|
-
; Numbers
|
|
6
|
-
(integer) @number
|
|
7
|
-
(decimal) @number
|
|
8
|
-
(hexadecimal) @number
|
|
9
|
-
(octal) @number
|
|
10
|
-
(measurement) @number
|
|
11
|
-
|
|
12
|
-
; Boolean literals
|
|
13
|
-
(boolean_literal) @boolean
|
|
14
|
-
|
|
15
|
-
; Comment (FR-003)
|
|
16
|
-
(comment) @comment
|
|
17
|
-
|
|
18
|
-
; Tagged-string tag distinct from content (FR-002)
|
|
19
|
-
(tagged_string tag: (symbol) @attribute)
|
|
20
|
-
|
|
21
|
-
; Reference identifier: pattern_reference (FR-001)
|
|
22
|
-
(pattern_reference identifier: (_) @variable)
|
|
23
|
-
|
|
24
|
-
; Symbols and identifiers (generic; definition/reference/tag captured above)
|
|
25
|
-
(symbol) @variable
|
|
26
|
-
|
|
27
|
-
; Definition-like identifiers and labels (FR-001): @type
|
|
28
|
-
; These must come AFTER generic symbol rule to take priority
|
|
29
|
-
|
|
30
|
-
; Labels (symbols and quoted names in labels nodes)
|
|
31
|
-
(labels (symbol) @type)
|
|
32
|
-
(labels (quoted_name) @type)
|
|
33
|
-
|
|
34
|
-
; Annotation identifiers and labels
|
|
35
|
-
(identified_annotation identifier: (_) @type)
|
|
36
|
-
(identified_annotation labels: (labels (symbol) @type))
|
|
37
|
-
(identified_annotation labels: (labels (quoted_name) @type))
|
|
38
|
-
|
|
39
|
-
; Subject, node, and relationship pattern definitions (FR-001): @type
|
|
40
|
-
; subject/node subject is _subject (use wildcard _ as it may be hidden in some runtimes)
|
|
41
|
-
(subject_pattern subject: (_ identifier: (_) @type))
|
|
42
|
-
(subject_pattern subject: (_ labels: (labels (symbol) @type)))
|
|
43
|
-
(subject_pattern subject: (_ labels: (labels (quoted_name) @type)))
|
|
44
|
-
(node_pattern subject: (_ identifier: (_) @type))
|
|
45
|
-
(node_pattern subject: (_ labels: (labels (symbol) @type)))
|
|
46
|
-
(node_pattern subject: (_ labels: (labels (quoted_name) @type)))
|
|
47
|
-
(relationship_pattern left: (node_pattern subject: (_ identifier: (_) @type)))
|
|
48
|
-
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @type))))
|
|
49
|
-
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (quoted_name) @type))))
|
|
50
|
-
(relationship_pattern right: (node_pattern subject: (_ identifier: (_) @type)))
|
|
51
|
-
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @type))))
|
|
52
|
-
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (quoted_name) @type))))
|
|
53
|
-
; Arrow kind: subject is inside optional brackets on the arrow
|
|
54
|
-
(relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @type)))
|
|
55
|
-
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
56
|
-
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
57
|
-
(relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @type)))
|
|
58
|
-
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
59
|
-
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
60
|
-
(relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @type)))
|
|
61
|
-
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
62
|
-
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
63
|
-
(relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @type)))
|
|
64
|
-
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
65
|
-
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
66
|
-
|
|
67
|
-
; Keywords and operators
|
|
68
|
-
[
|
|
69
|
-
"@"
|
|
70
|
-
"|"
|
|
71
|
-
":"
|
|
72
|
-
"::"
|
|
73
|
-
] @operator
|
|
74
|
-
|
|
75
|
-
; Subject Patterns and delimiters
|
|
76
|
-
[
|
|
77
|
-
"["
|
|
78
|
-
"]"
|
|
79
|
-
"("
|
|
80
|
-
")"
|
|
81
|
-
"{"
|
|
82
|
-
"}"
|
|
83
|
-
] @punctuation.bracket
|
|
84
|
-
|
|
85
|
-
; Comma separator
|
|
86
|
-
[
|
|
87
|
-
","
|
|
88
|
-
] @punctuation.delimiter
|
|
89
|
-
|
|
90
|
-
; Field names in records and maps
|
|
91
|
-
(record_property key: (symbol) @property)
|
|
92
|
-
(record_property key: (quoted_name) @property)
|
|
93
|
-
(record_property key: (double_quoted_name) @property)
|
|
94
|
-
(map_entry key: (symbol) @property)
|
|
95
|
-
(map_entry key: (quoted_name) @property)
|
|
96
|
-
(map_entry key: (double_quoted_name) @property)
|
|
97
|
-
|
|
98
|
-
; Annotation keys (property-style) and headers (identified/label-style)
|
|
99
|
-
(property_annotation key: (symbol) @attribute)
|
|
100
|
-
|
|
101
|
-
; Relationship arrows (special highlighting for graph syntax)
|
|
102
|
-
(relationship_pattern) @keyword
|
|
103
|
-
|
|
104
|
-
; Arrow operators in relationships
|
|
105
|
-
(right_arrow) @operator
|
|
106
|
-
(left_arrow) @operator
|
|
107
|
-
(undirected_arrow) @operator
|
|
108
|
-
(bidirectional_arrow) @operator
|
|
109
|
-
|
|
110
|
-
; Error highlighting
|
|
111
|
-
(ERROR) @error
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
; Indentation: 2 spaces per level for brackets and multi-line structures
|
|
2
|
-
; FR-007 — specs/004-editor-improvements/contracts/indents.md
|
|
3
|
-
|
|
4
|
-
; Record {}
|
|
5
|
-
"{" @indent
|
|
6
|
-
"}" @indent.end
|
|
7
|
-
|
|
8
|
-
; Subject pattern []
|
|
9
|
-
"[" @indent
|
|
10
|
-
"]" @indent.end
|
|
11
|
-
|
|
12
|
-
; Node pattern ()
|
|
13
|
-
"(" @indent
|
|
14
|
-
")" @indent.end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
; Language injection for tagged strings: tag`content` and ```tag\ncontent\n```
|
|
2
|
-
;
|
|
3
|
-
; The tag symbol is used as the injection language so that downstream and editors
|
|
4
|
-
; can support arbitrary tags without changing the grammar. Well-known tags (md, ts,
|
|
5
|
-
; date, datetime, time, sql, json, html, etc.) are documented in docs/tagged-strings-and-injections.md.
|
|
6
|
-
;
|
|
7
|
-
; Overrides below map tags that do not match common parser names. The final
|
|
8
|
-
; rule uses the tag's text as the language name for all other tags (e.g. "sql",
|
|
9
|
-
; "json", "html" often match parser names).
|
|
10
|
-
|
|
11
|
-
; md -> markdown
|
|
12
|
-
(tagged_string
|
|
13
|
-
tag: (symbol) @_tag
|
|
14
|
-
content: (string_content) @injection.content)
|
|
15
|
-
(#eq? @_tag "md")
|
|
16
|
-
(#set! injection.language "markdown")
|
|
17
|
-
|
|
18
|
-
; ts -> typescript
|
|
19
|
-
(tagged_string
|
|
20
|
-
tag: (symbol) @_tag
|
|
21
|
-
content: (string_content) @injection.content)
|
|
22
|
-
(#eq? @_tag "ts")
|
|
23
|
-
(#set! injection.language "typescript")
|
|
24
|
-
|
|
25
|
-
; Dynamic: use tag text as language name for all other tags (sql, json, html, etc.)
|
|
26
|
-
; Editors may map additional tags (e.g. date, datetime, time) to parsers or leave as plain.
|
|
27
|
-
(tagged_string
|
|
28
|
-
tag: (symbol) @injection.language
|
|
29
|
-
content: (string_content) @injection.content)
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
; Locals: go to definition and highlight references (file scope)
|
|
2
|
-
; FR-005, FR-006 — specs/004-editor-improvements/contracts/locals.md
|
|
3
|
-
|
|
4
|
-
; File scope: all definitions and references in one scope
|
|
5
|
-
(gram_pattern) @local.scope
|
|
6
|
-
|
|
7
|
-
; Definitions: identifiers that define a pattern or annotation
|
|
8
|
-
(subject_pattern subject: (_ identifier: (_) @local.definition))
|
|
9
|
-
(subject_pattern subject: (_ labels: (labels (symbol) @local.definition)))
|
|
10
|
-
(subject_pattern subject: (_ labels: (labels (quoted_name) @local.definition)))
|
|
11
|
-
(node_pattern subject: (_ identifier: (_) @local.definition))
|
|
12
|
-
(node_pattern subject: (_ labels: (labels (symbol) @local.definition)))
|
|
13
|
-
(node_pattern subject: (_ labels: (labels (quoted_name) @local.definition)))
|
|
14
|
-
(relationship_pattern left: (node_pattern subject: (_ identifier: (_) @local.definition)))
|
|
15
|
-
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
|
|
16
|
-
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
17
|
-
(relationship_pattern right: (node_pattern subject: (_ identifier: (_) @local.definition)))
|
|
18
|
-
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
|
|
19
|
-
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
20
|
-
(relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @local.definition)))
|
|
21
|
-
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
22
|
-
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
23
|
-
(relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @local.definition)))
|
|
24
|
-
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
25
|
-
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
26
|
-
(relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @local.definition)))
|
|
27
|
-
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
28
|
-
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
29
|
-
(relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @local.definition)))
|
|
30
|
-
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
31
|
-
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
32
|
-
(identified_annotation identifier: (_) @local.definition)
|
|
33
|
-
(identified_annotation labels: (labels (symbol) @local.definition))
|
|
34
|
-
(identified_annotation labels: (labels (quoted_name) @local.definition))
|
|
35
|
-
|
|
36
|
-
; References: pattern_reference identifier
|
|
37
|
-
(pattern_reference identifier: (_) @local.reference)
|