tree-sitter-muttrc 0.0.3 → 0.0.5
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/binding.gyp +20 -15
- package/bindings/node/binding.cc +14 -22
- package/bindings/node/index.d.ts +28 -0
- package/bindings/node/index.js +3 -15
- package/grammar.js +2 -4
- package/package.json +35 -10
- package/src/grammar.json +16 -17
- package/src/node-types.json +0 -4
- package/src/parser.c +9402 -10224
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +290 -0
- package/src/tree_sitter/parser.h +11 -5
- package/.cmake-format.yaml +0 -2
- package/.cmakelintrc +0 -1
- package/.github/FUNDING.yml +0 -6
- package/.github/workflows/main.yml +0 -152
- package/.gitlint +0 -5
- package/.pre-commit-config.yaml +0 -112
- package/.yamllint.yaml +0 -8
- package/CMakeLists.txt +0 -43
- package/Cargo.toml +0 -26
- package/__init__.py.in +0 -33
- package/bindings/python/tree_sitter_muttrc/__main__.py +0 -60
- package/bindings/python/tree_sitter_muttrc/py.typed +0 -0
- package/bindings/rust/build.rs +0 -40
- package/bindings/rust/lib.rs +0 -52
- package/pyproject.toml +0 -123
- package/queries/highlights.scm +0 -53
- package/queries/injections.scm +0 -8
- package/requirements/colorize.txt +0 -3
- package/requirements/dev.txt +0 -4
- package/requirements.txt +0 -3
- package/scripts/build.sh +0 -8
- package/templates/class.txt +0 -2
- package/templates/def.txt +0 -12
- package/templates/noarg.txt +0 -1
- package/test/corpus/example.txt +0 -82
- package/tests/neomuttrc +0 -18
- package/tests/test___init__.py +0 -22
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#ifndef TREE_SITTER_ALLOC_H_
|
|
2
|
+
#define TREE_SITTER_ALLOC_H_
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#include <stdbool.h>
|
|
9
|
+
#include <stdio.h>
|
|
10
|
+
#include <stdlib.h>
|
|
11
|
+
|
|
12
|
+
// Allow clients to override allocation functions
|
|
13
|
+
#ifdef TREE_SITTER_REUSE_ALLOCATOR
|
|
14
|
+
|
|
15
|
+
extern void *(*ts_current_malloc)(size_t);
|
|
16
|
+
extern void *(*ts_current_calloc)(size_t, size_t);
|
|
17
|
+
extern void *(*ts_current_realloc)(void *, size_t);
|
|
18
|
+
extern void (*ts_current_free)(void *);
|
|
19
|
+
|
|
20
|
+
#ifndef ts_malloc
|
|
21
|
+
#define ts_malloc ts_current_malloc
|
|
22
|
+
#endif
|
|
23
|
+
#ifndef ts_calloc
|
|
24
|
+
#define ts_calloc ts_current_calloc
|
|
25
|
+
#endif
|
|
26
|
+
#ifndef ts_realloc
|
|
27
|
+
#define ts_realloc ts_current_realloc
|
|
28
|
+
#endif
|
|
29
|
+
#ifndef ts_free
|
|
30
|
+
#define ts_free ts_current_free
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#else
|
|
34
|
+
|
|
35
|
+
#ifndef ts_malloc
|
|
36
|
+
#define ts_malloc malloc
|
|
37
|
+
#endif
|
|
38
|
+
#ifndef ts_calloc
|
|
39
|
+
#define ts_calloc calloc
|
|
40
|
+
#endif
|
|
41
|
+
#ifndef ts_realloc
|
|
42
|
+
#define ts_realloc realloc
|
|
43
|
+
#endif
|
|
44
|
+
#ifndef ts_free
|
|
45
|
+
#define ts_free free
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#ifdef __cplusplus
|
|
51
|
+
}
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
#endif // TREE_SITTER_ALLOC_H_
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
#ifndef TREE_SITTER_ARRAY_H_
|
|
2
|
+
#define TREE_SITTER_ARRAY_H_
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#include "./alloc.h"
|
|
9
|
+
|
|
10
|
+
#include <assert.h>
|
|
11
|
+
#include <stdbool.h>
|
|
12
|
+
#include <stdint.h>
|
|
13
|
+
#include <stdlib.h>
|
|
14
|
+
#include <string.h>
|
|
15
|
+
|
|
16
|
+
#ifdef _MSC_VER
|
|
17
|
+
#pragma warning(disable : 4101)
|
|
18
|
+
#elif defined(__GNUC__) || defined(__clang__)
|
|
19
|
+
#pragma GCC diagnostic push
|
|
20
|
+
#pragma GCC diagnostic ignored "-Wunused-variable"
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#define Array(T) \
|
|
24
|
+
struct { \
|
|
25
|
+
T *contents; \
|
|
26
|
+
uint32_t size; \
|
|
27
|
+
uint32_t capacity; \
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Initialize an array.
|
|
31
|
+
#define array_init(self) \
|
|
32
|
+
((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL)
|
|
33
|
+
|
|
34
|
+
/// Create an empty array.
|
|
35
|
+
#define array_new() \
|
|
36
|
+
{ NULL, 0, 0 }
|
|
37
|
+
|
|
38
|
+
/// Get a pointer to the element at a given `index` in the array.
|
|
39
|
+
#define array_get(self, _index) \
|
|
40
|
+
(assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index])
|
|
41
|
+
|
|
42
|
+
/// Get a pointer to the first element in the array.
|
|
43
|
+
#define array_front(self) array_get(self, 0)
|
|
44
|
+
|
|
45
|
+
/// Get a pointer to the last element in the array.
|
|
46
|
+
#define array_back(self) array_get(self, (self)->size - 1)
|
|
47
|
+
|
|
48
|
+
/// Clear the array, setting its size to zero. Note that this does not free any
|
|
49
|
+
/// memory allocated for the array's contents.
|
|
50
|
+
#define array_clear(self) ((self)->size = 0)
|
|
51
|
+
|
|
52
|
+
/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is
|
|
53
|
+
/// less than the array's current capacity, this function has no effect.
|
|
54
|
+
#define array_reserve(self, new_capacity) \
|
|
55
|
+
_array__reserve((Array *)(self), array_elem_size(self), new_capacity)
|
|
56
|
+
|
|
57
|
+
/// Free any memory allocated for this array. Note that this does not free any
|
|
58
|
+
/// memory allocated for the array's contents.
|
|
59
|
+
#define array_delete(self) _array__delete((Array *)(self))
|
|
60
|
+
|
|
61
|
+
/// Push a new `element` onto the end of the array.
|
|
62
|
+
#define array_push(self, element) \
|
|
63
|
+
(_array__grow((Array *)(self), 1, array_elem_size(self)), \
|
|
64
|
+
(self)->contents[(self)->size++] = (element))
|
|
65
|
+
|
|
66
|
+
/// Increase the array's size by `count` elements.
|
|
67
|
+
/// New elements are zero-initialized.
|
|
68
|
+
#define array_grow_by(self, count) \
|
|
69
|
+
do { \
|
|
70
|
+
if ((count) == 0) break; \
|
|
71
|
+
_array__grow((Array *)(self), count, array_elem_size(self)); \
|
|
72
|
+
memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \
|
|
73
|
+
(self)->size += (count); \
|
|
74
|
+
} while (0)
|
|
75
|
+
|
|
76
|
+
/// Append all elements from one array to the end of another.
|
|
77
|
+
#define array_push_all(self, other) \
|
|
78
|
+
array_extend((self), (other)->size, (other)->contents)
|
|
79
|
+
|
|
80
|
+
/// Append `count` elements to the end of the array, reading their values from the
|
|
81
|
+
/// `contents` pointer.
|
|
82
|
+
#define array_extend(self, count, contents) \
|
|
83
|
+
_array__splice( \
|
|
84
|
+
(Array *)(self), array_elem_size(self), (self)->size, \
|
|
85
|
+
0, count, contents \
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
/// Remove `old_count` elements from the array starting at the given `index`. At
|
|
89
|
+
/// the same index, insert `new_count` new elements, reading their values from the
|
|
90
|
+
/// `new_contents` pointer.
|
|
91
|
+
#define array_splice(self, _index, old_count, new_count, new_contents) \
|
|
92
|
+
_array__splice( \
|
|
93
|
+
(Array *)(self), array_elem_size(self), _index, \
|
|
94
|
+
old_count, new_count, new_contents \
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
/// Insert one `element` into the array at the given `index`.
|
|
98
|
+
#define array_insert(self, _index, element) \
|
|
99
|
+
_array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element))
|
|
100
|
+
|
|
101
|
+
/// Remove one element from the array at the given `index`.
|
|
102
|
+
#define array_erase(self, _index) \
|
|
103
|
+
_array__erase((Array *)(self), array_elem_size(self), _index)
|
|
104
|
+
|
|
105
|
+
/// Pop the last element off the array, returning the element by value.
|
|
106
|
+
#define array_pop(self) ((self)->contents[--(self)->size])
|
|
107
|
+
|
|
108
|
+
/// Assign the contents of one array to another, reallocating if necessary.
|
|
109
|
+
#define array_assign(self, other) \
|
|
110
|
+
_array__assign((Array *)(self), (const Array *)(other), array_elem_size(self))
|
|
111
|
+
|
|
112
|
+
/// Swap one array with another
|
|
113
|
+
#define array_swap(self, other) \
|
|
114
|
+
_array__swap((Array *)(self), (Array *)(other))
|
|
115
|
+
|
|
116
|
+
/// Get the size of the array contents
|
|
117
|
+
#define array_elem_size(self) (sizeof *(self)->contents)
|
|
118
|
+
|
|
119
|
+
/// Search a sorted array for a given `needle` value, using the given `compare`
|
|
120
|
+
/// callback to determine the order.
|
|
121
|
+
///
|
|
122
|
+
/// If an existing element is found to be equal to `needle`, then the `index`
|
|
123
|
+
/// out-parameter is set to the existing value's index, and the `exists`
|
|
124
|
+
/// out-parameter is set to true. Otherwise, `index` is set to an index where
|
|
125
|
+
/// `needle` should be inserted in order to preserve the sorting, and `exists`
|
|
126
|
+
/// is set to false.
|
|
127
|
+
#define array_search_sorted_with(self, compare, needle, _index, _exists) \
|
|
128
|
+
_array__search_sorted(self, 0, compare, , needle, _index, _exists)
|
|
129
|
+
|
|
130
|
+
/// Search a sorted array for a given `needle` value, using integer comparisons
|
|
131
|
+
/// of a given struct field (specified with a leading dot) to determine the order.
|
|
132
|
+
///
|
|
133
|
+
/// See also `array_search_sorted_with`.
|
|
134
|
+
#define array_search_sorted_by(self, field, needle, _index, _exists) \
|
|
135
|
+
_array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists)
|
|
136
|
+
|
|
137
|
+
/// Insert a given `value` into a sorted array, using the given `compare`
|
|
138
|
+
/// callback to determine the order.
|
|
139
|
+
#define array_insert_sorted_with(self, compare, value) \
|
|
140
|
+
do { \
|
|
141
|
+
unsigned _index, _exists; \
|
|
142
|
+
array_search_sorted_with(self, compare, &(value), &_index, &_exists); \
|
|
143
|
+
if (!_exists) array_insert(self, _index, value); \
|
|
144
|
+
} while (0)
|
|
145
|
+
|
|
146
|
+
/// Insert a given `value` into a sorted array, using integer comparisons of
|
|
147
|
+
/// a given struct field (specified with a leading dot) to determine the order.
|
|
148
|
+
///
|
|
149
|
+
/// See also `array_search_sorted_by`.
|
|
150
|
+
#define array_insert_sorted_by(self, field, value) \
|
|
151
|
+
do { \
|
|
152
|
+
unsigned _index, _exists; \
|
|
153
|
+
array_search_sorted_by(self, field, (value) field, &_index, &_exists); \
|
|
154
|
+
if (!_exists) array_insert(self, _index, value); \
|
|
155
|
+
} while (0)
|
|
156
|
+
|
|
157
|
+
// Private
|
|
158
|
+
|
|
159
|
+
typedef Array(void) Array;
|
|
160
|
+
|
|
161
|
+
/// This is not what you're looking for, see `array_delete`.
|
|
162
|
+
static inline void _array__delete(Array *self) {
|
|
163
|
+
if (self->contents) {
|
|
164
|
+
ts_free(self->contents);
|
|
165
|
+
self->contents = NULL;
|
|
166
|
+
self->size = 0;
|
|
167
|
+
self->capacity = 0;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// This is not what you're looking for, see `array_erase`.
|
|
172
|
+
static inline void _array__erase(Array *self, size_t element_size,
|
|
173
|
+
uint32_t index) {
|
|
174
|
+
assert(index < self->size);
|
|
175
|
+
char *contents = (char *)self->contents;
|
|
176
|
+
memmove(contents + index * element_size, contents + (index + 1) * element_size,
|
|
177
|
+
(self->size - index - 1) * element_size);
|
|
178
|
+
self->size--;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/// This is not what you're looking for, see `array_reserve`.
|
|
182
|
+
static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) {
|
|
183
|
+
if (new_capacity > self->capacity) {
|
|
184
|
+
if (self->contents) {
|
|
185
|
+
self->contents = ts_realloc(self->contents, new_capacity * element_size);
|
|
186
|
+
} else {
|
|
187
|
+
self->contents = ts_malloc(new_capacity * element_size);
|
|
188
|
+
}
|
|
189
|
+
self->capacity = new_capacity;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/// This is not what you're looking for, see `array_assign`.
|
|
194
|
+
static inline void _array__assign(Array *self, const Array *other, size_t element_size) {
|
|
195
|
+
_array__reserve(self, element_size, other->size);
|
|
196
|
+
self->size = other->size;
|
|
197
|
+
memcpy(self->contents, other->contents, self->size * element_size);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/// This is not what you're looking for, see `array_swap`.
|
|
201
|
+
static inline void _array__swap(Array *self, Array *other) {
|
|
202
|
+
Array swap = *other;
|
|
203
|
+
*other = *self;
|
|
204
|
+
*self = swap;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/// This is not what you're looking for, see `array_push` or `array_grow_by`.
|
|
208
|
+
static inline void _array__grow(Array *self, uint32_t count, size_t element_size) {
|
|
209
|
+
uint32_t new_size = self->size + count;
|
|
210
|
+
if (new_size > self->capacity) {
|
|
211
|
+
uint32_t new_capacity = self->capacity * 2;
|
|
212
|
+
if (new_capacity < 8) new_capacity = 8;
|
|
213
|
+
if (new_capacity < new_size) new_capacity = new_size;
|
|
214
|
+
_array__reserve(self, element_size, new_capacity);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/// This is not what you're looking for, see `array_splice`.
|
|
219
|
+
static inline void _array__splice(Array *self, size_t element_size,
|
|
220
|
+
uint32_t index, uint32_t old_count,
|
|
221
|
+
uint32_t new_count, const void *elements) {
|
|
222
|
+
uint32_t new_size = self->size + new_count - old_count;
|
|
223
|
+
uint32_t old_end = index + old_count;
|
|
224
|
+
uint32_t new_end = index + new_count;
|
|
225
|
+
assert(old_end <= self->size);
|
|
226
|
+
|
|
227
|
+
_array__reserve(self, element_size, new_size);
|
|
228
|
+
|
|
229
|
+
char *contents = (char *)self->contents;
|
|
230
|
+
if (self->size > old_end) {
|
|
231
|
+
memmove(
|
|
232
|
+
contents + new_end * element_size,
|
|
233
|
+
contents + old_end * element_size,
|
|
234
|
+
(self->size - old_end) * element_size
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
if (new_count > 0) {
|
|
238
|
+
if (elements) {
|
|
239
|
+
memcpy(
|
|
240
|
+
(contents + index * element_size),
|
|
241
|
+
elements,
|
|
242
|
+
new_count * element_size
|
|
243
|
+
);
|
|
244
|
+
} else {
|
|
245
|
+
memset(
|
|
246
|
+
(contents + index * element_size),
|
|
247
|
+
0,
|
|
248
|
+
new_count * element_size
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
self->size += new_count - old_count;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/// A binary search routine, based on Rust's `std::slice::binary_search_by`.
|
|
256
|
+
/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`.
|
|
257
|
+
#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \
|
|
258
|
+
do { \
|
|
259
|
+
*(_index) = start; \
|
|
260
|
+
*(_exists) = false; \
|
|
261
|
+
uint32_t size = (self)->size - *(_index); \
|
|
262
|
+
if (size == 0) break; \
|
|
263
|
+
int comparison; \
|
|
264
|
+
while (size > 1) { \
|
|
265
|
+
uint32_t half_size = size / 2; \
|
|
266
|
+
uint32_t mid_index = *(_index) + half_size; \
|
|
267
|
+
comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \
|
|
268
|
+
if (comparison <= 0) *(_index) = mid_index; \
|
|
269
|
+
size -= half_size; \
|
|
270
|
+
} \
|
|
271
|
+
comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \
|
|
272
|
+
if (comparison == 0) *(_exists) = true; \
|
|
273
|
+
else if (comparison < 0) *(_index) += 1; \
|
|
274
|
+
} while (0)
|
|
275
|
+
|
|
276
|
+
/// Helper macro for the `_sorted_by` routines below. This takes the left (existing)
|
|
277
|
+
/// parameter by reference in order to work with the generic sorting function above.
|
|
278
|
+
#define _compare_int(a, b) ((int)*(a) - (int)(b))
|
|
279
|
+
|
|
280
|
+
#ifdef _MSC_VER
|
|
281
|
+
#pragma warning(default : 4101)
|
|
282
|
+
#elif defined(__GNUC__) || defined(__clang__)
|
|
283
|
+
#pragma GCC diagnostic pop
|
|
284
|
+
#endif
|
|
285
|
+
|
|
286
|
+
#ifdef __cplusplus
|
|
287
|
+
}
|
|
288
|
+
#endif
|
|
289
|
+
|
|
290
|
+
#endif // TREE_SITTER_ARRAY_H_
|
package/src/tree_sitter/parser.h
CHANGED
|
@@ -13,9 +13,8 @@ extern "C" {
|
|
|
13
13
|
#define ts_builtin_sym_end 0
|
|
14
14
|
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
|
15
15
|
|
|
16
|
-
typedef uint16_t TSStateId;
|
|
17
|
-
|
|
18
16
|
#ifndef TREE_SITTER_API_H_
|
|
17
|
+
typedef uint16_t TSStateId;
|
|
19
18
|
typedef uint16_t TSSymbol;
|
|
20
19
|
typedef uint16_t TSFieldId;
|
|
21
20
|
typedef struct TSLanguage TSLanguage;
|
|
@@ -130,9 +129,16 @@ struct TSLanguage {
|
|
|
130
129
|
* Lexer Macros
|
|
131
130
|
*/
|
|
132
131
|
|
|
132
|
+
#ifdef _MSC_VER
|
|
133
|
+
#define UNUSED __pragma(warning(suppress : 4101))
|
|
134
|
+
#else
|
|
135
|
+
#define UNUSED __attribute__((unused))
|
|
136
|
+
#endif
|
|
137
|
+
|
|
133
138
|
#define START_LEXER() \
|
|
134
139
|
bool result = false; \
|
|
135
140
|
bool skip = false; \
|
|
141
|
+
UNUSED \
|
|
136
142
|
bool eof = false; \
|
|
137
143
|
int32_t lookahead; \
|
|
138
144
|
goto start; \
|
|
@@ -166,7 +172,7 @@ struct TSLanguage {
|
|
|
166
172
|
* Parse Table Macros
|
|
167
173
|
*/
|
|
168
174
|
|
|
169
|
-
#define SMALL_STATE(id) id - LARGE_STATE_COUNT
|
|
175
|
+
#define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT)
|
|
170
176
|
|
|
171
177
|
#define STATE(id) id
|
|
172
178
|
|
|
@@ -176,7 +182,7 @@ struct TSLanguage {
|
|
|
176
182
|
{{ \
|
|
177
183
|
.shift = { \
|
|
178
184
|
.type = TSParseActionTypeShift, \
|
|
179
|
-
.state = state_value
|
|
185
|
+
.state = (state_value) \
|
|
180
186
|
} \
|
|
181
187
|
}}
|
|
182
188
|
|
|
@@ -184,7 +190,7 @@ struct TSLanguage {
|
|
|
184
190
|
{{ \
|
|
185
191
|
.shift = { \
|
|
186
192
|
.type = TSParseActionTypeShift, \
|
|
187
|
-
.state = state_value,
|
|
193
|
+
.state = (state_value), \
|
|
188
194
|
.repetition = true \
|
|
189
195
|
} \
|
|
190
196
|
}}
|
package/.cmake-format.yaml
DELETED
package/.cmakelintrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
filter=-whitespace/indent,-linelength,-readability/wonkycase
|
package/.github/FUNDING.yml
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
patreon: user?u=83975719
|
|
3
|
-
custom:
|
|
4
|
-
- "https://user-images.githubusercontent.com/32936898/199681341-1c5cfa61-4411-4b67-b268-7cd87c5867bb.png"
|
|
5
|
-
- "https://user-images.githubusercontent.com/32936898/199681363-1094a0be-85ca-49cf-a410-19b3d7965120.png"
|
|
6
|
-
- "https://user-images.githubusercontent.com/32936898/199681368-c34c2be7-e0d8-43ea-8c2c-d3e865da6aeb.png"
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
"on":
|
|
3
|
-
push:
|
|
4
|
-
paths-ignore:
|
|
5
|
-
- "**.md"
|
|
6
|
-
pull_request:
|
|
7
|
-
paths-ignore:
|
|
8
|
-
- "**.md"
|
|
9
|
-
workflow_dispatch:
|
|
10
|
-
|
|
11
|
-
# https://github.com/softprops/action-gh-release/issues/236
|
|
12
|
-
permissions:
|
|
13
|
-
contents: write
|
|
14
|
-
|
|
15
|
-
env:
|
|
16
|
-
CMAKE_GENERATOR: Ninja
|
|
17
|
-
PYTHONUTF8: "1"
|
|
18
|
-
python-version: 3.x
|
|
19
|
-
cache: pip
|
|
20
|
-
|
|
21
|
-
jobs:
|
|
22
|
-
test:
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v4
|
|
26
|
-
- uses: actions/setup-node@v4
|
|
27
|
-
with:
|
|
28
|
-
node-version: latest
|
|
29
|
-
registry-url: https://registry.npmjs.org
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: |
|
|
32
|
-
npm install
|
|
33
|
-
- name: Test
|
|
34
|
-
run: |
|
|
35
|
-
npm test
|
|
36
|
-
|
|
37
|
-
deploy-npm:
|
|
38
|
-
runs-on: ubuntu-latest
|
|
39
|
-
needs: test
|
|
40
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
41
|
-
steps:
|
|
42
|
-
- uses: actions/checkout@v4
|
|
43
|
-
- uses: actions/setup-node@v4
|
|
44
|
-
with:
|
|
45
|
-
node-version: latest
|
|
46
|
-
registry-url: https://registry.npmjs.org
|
|
47
|
-
- name: Publish
|
|
48
|
-
env:
|
|
49
|
-
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
|
50
|
-
run: |
|
|
51
|
-
npm publish
|
|
52
|
-
|
|
53
|
-
deploy-cargo:
|
|
54
|
-
runs-on: ubuntu-latest
|
|
55
|
-
needs: test
|
|
56
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
57
|
-
steps:
|
|
58
|
-
- uses: actions/checkout@v4
|
|
59
|
-
- uses: ructions/toolchain@v1
|
|
60
|
-
with:
|
|
61
|
-
toolchain: nightly
|
|
62
|
-
- name: Publish
|
|
63
|
-
run: |
|
|
64
|
-
cargo publish --token ${{secrets.CARGO_TOKEN}}
|
|
65
|
-
|
|
66
|
-
build-wheels-and-test:
|
|
67
|
-
needs: test
|
|
68
|
-
strategy:
|
|
69
|
-
fail-fast: false
|
|
70
|
-
matrix:
|
|
71
|
-
include:
|
|
72
|
-
- runs-on: ubuntu-latest
|
|
73
|
-
skip: "manylinux"
|
|
74
|
-
- runs-on: ubuntu-latest
|
|
75
|
-
skip: "musllinux"
|
|
76
|
-
- runs-on: macos-latest
|
|
77
|
-
skip: ""
|
|
78
|
-
- runs-on: windows-latest
|
|
79
|
-
skip: ""
|
|
80
|
-
runs-on: ${{matrix.runs-on}}
|
|
81
|
-
steps:
|
|
82
|
-
- uses: actions/checkout@v4
|
|
83
|
-
- uses: docker/setup-qemu-action@v3
|
|
84
|
-
if: runner.os == 'Linux'
|
|
85
|
-
- uses: pypa/cibuildwheel@v2.16
|
|
86
|
-
env:
|
|
87
|
-
CIBW_SKIP: "*-${{matrix.skip}}_*"
|
|
88
|
-
- uses: actions/upload-artifact@v4
|
|
89
|
-
with:
|
|
90
|
-
name: artifact-${{matrix.runs-on}}-${{matrix.skip}}
|
|
91
|
-
path: |
|
|
92
|
-
wheelhouse/*.whl
|
|
93
|
-
|
|
94
|
-
build:
|
|
95
|
-
needs:
|
|
96
|
-
- build-wheels-and-test
|
|
97
|
-
runs-on: ubuntu-latest
|
|
98
|
-
steps:
|
|
99
|
-
- uses: actions/checkout@v4
|
|
100
|
-
- uses: actions/setup-python@v4
|
|
101
|
-
with:
|
|
102
|
-
python-version: ${{env.python-version}}
|
|
103
|
-
cache: ${{env.cache}}
|
|
104
|
-
- name: Install dependencies
|
|
105
|
-
run: |
|
|
106
|
-
pip install build
|
|
107
|
-
- name: Build sdist
|
|
108
|
-
run: python -m build -s
|
|
109
|
-
- uses: actions/upload-artifact@v4
|
|
110
|
-
if: "! startsWith(github.ref, 'refs/tags/')"
|
|
111
|
-
with:
|
|
112
|
-
name: artifact-sdist
|
|
113
|
-
path: |
|
|
114
|
-
dist/*
|
|
115
|
-
- uses: actions/download-artifact@v4
|
|
116
|
-
with:
|
|
117
|
-
pattern: artifact-*
|
|
118
|
-
merge-multiple: true
|
|
119
|
-
path: dist
|
|
120
|
-
- uses: softprops/action-gh-release@v1
|
|
121
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
122
|
-
with:
|
|
123
|
-
# body_path: build/CHANGELOG.md
|
|
124
|
-
files: |
|
|
125
|
-
dist/*
|
|
126
|
-
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
127
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
128
|
-
with:
|
|
129
|
-
password: ${{secrets.PYPI_API_TOKEN}}
|
|
130
|
-
|
|
131
|
-
deploy-aur:
|
|
132
|
-
needs: build
|
|
133
|
-
runs-on: ubuntu-latest
|
|
134
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
135
|
-
steps:
|
|
136
|
-
- uses: Freed-Wu/update-aur-package@v1.0.11
|
|
137
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
138
|
-
with:
|
|
139
|
-
package_name: python-tree-sitter-muttrc
|
|
140
|
-
ssh_private_key: ${{secrets.AUR_SSH_PRIVATE_KEY}}
|
|
141
|
-
|
|
142
|
-
deploy-nur:
|
|
143
|
-
needs: build
|
|
144
|
-
runs-on: ubuntu-latest
|
|
145
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
146
|
-
steps:
|
|
147
|
-
- name: Trigger Workflow
|
|
148
|
-
run: >
|
|
149
|
-
curl -X POST -d '{"ref": "main"}'
|
|
150
|
-
-H "Accept: application/vnd.github.v3+json"
|
|
151
|
-
-H "Authorization: Bearer ${{secrets.GH_TOKEN}}"
|
|
152
|
-
https://api.github.com/repos/Freed-Wu/nur-packages/actions/workflows/version.yml/dispatches
|
package/.gitlint
DELETED
package/.pre-commit-config.yaml
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
exclude: ^(templates|src)/.*
|
|
3
|
-
|
|
4
|
-
repos:
|
|
5
|
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
-
rev: v4.5.0
|
|
7
|
-
hooks:
|
|
8
|
-
- id: check-added-large-files
|
|
9
|
-
- id: fix-byte-order-marker
|
|
10
|
-
- id: check-case-conflict
|
|
11
|
-
- id: check-shebang-scripts-are-executable
|
|
12
|
-
- id: check-merge-conflict
|
|
13
|
-
- id: trailing-whitespace
|
|
14
|
-
- id: mixed-line-ending
|
|
15
|
-
- id: end-of-file-fixer
|
|
16
|
-
- id: detect-private-key
|
|
17
|
-
- id: check-symlinks
|
|
18
|
-
- id: check-ast
|
|
19
|
-
- id: debug-statements
|
|
20
|
-
- id: requirements-txt-fixer
|
|
21
|
-
- id: check-xml
|
|
22
|
-
- id: check-yaml
|
|
23
|
-
- id: check-toml
|
|
24
|
-
- id: check-json
|
|
25
|
-
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
|
26
|
-
rev: v1.5.4
|
|
27
|
-
hooks:
|
|
28
|
-
- id: remove-crlf
|
|
29
|
-
- repo: https://github.com/codespell-project/codespell
|
|
30
|
-
rev: v2.2.6
|
|
31
|
-
hooks:
|
|
32
|
-
- id: codespell
|
|
33
|
-
additional_dependencies:
|
|
34
|
-
- tomli
|
|
35
|
-
- repo: https://github.com/jorisroovers/gitlint
|
|
36
|
-
rev: v0.19.1
|
|
37
|
-
hooks:
|
|
38
|
-
- id: gitlint
|
|
39
|
-
args:
|
|
40
|
-
- --msg-filename
|
|
41
|
-
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
|
|
42
|
-
rev: 2.7.3
|
|
43
|
-
hooks:
|
|
44
|
-
- id: editorconfig-checker
|
|
45
|
-
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
|
46
|
-
rev: 3.0.0
|
|
47
|
-
hooks:
|
|
48
|
-
- id: check-mailmap
|
|
49
|
-
# https://github.com/koalaman/shellcheck/issues/2909
|
|
50
|
-
- id: shellcheck
|
|
51
|
-
exclude_types:
|
|
52
|
-
- zsh
|
|
53
|
-
- repo: https://github.com/rhysd/actionlint
|
|
54
|
-
rev: v1.6.26
|
|
55
|
-
hooks:
|
|
56
|
-
- id: actionlint
|
|
57
|
-
- repo: https://github.com/adrienverge/yamllint
|
|
58
|
-
rev: v1.34.0
|
|
59
|
-
hooks:
|
|
60
|
-
- id: yamllint
|
|
61
|
-
- repo: https://github.com/executablebooks/mdformat
|
|
62
|
-
rev: 0.7.17
|
|
63
|
-
hooks:
|
|
64
|
-
- id: mdformat
|
|
65
|
-
additional_dependencies:
|
|
66
|
-
- mdformat-pyproject
|
|
67
|
-
- mdformat-gfm
|
|
68
|
-
- mdformat-myst
|
|
69
|
-
- mdformat-toc
|
|
70
|
-
- mdformat-deflist
|
|
71
|
-
- mdformat-beautysh
|
|
72
|
-
- mdformat-ruff
|
|
73
|
-
- ruff
|
|
74
|
-
- mdformat-config
|
|
75
|
-
- mdformat-web
|
|
76
|
-
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
|
77
|
-
rev: v0.12.1
|
|
78
|
-
hooks:
|
|
79
|
-
- id: markdownlint-cli2
|
|
80
|
-
additional_dependencies:
|
|
81
|
-
- markdown-it-texmath
|
|
82
|
-
- repo: https://github.com/scop/pre-commit-shfmt
|
|
83
|
-
rev: v3.8.0-1
|
|
84
|
-
hooks:
|
|
85
|
-
- id: shfmt
|
|
86
|
-
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
87
|
-
rev: v0.2.1
|
|
88
|
-
hooks:
|
|
89
|
-
- id: ruff
|
|
90
|
-
- id: ruff-format
|
|
91
|
-
- repo: https://github.com/kumaraditya303/mirrors-pyright
|
|
92
|
-
rev: v1.1.350
|
|
93
|
-
hooks:
|
|
94
|
-
- id: pyright
|
|
95
|
-
- repo: https://github.com/cmake-lint/cmake-lint
|
|
96
|
-
rev: 1.4.2
|
|
97
|
-
hooks:
|
|
98
|
-
- id: cmakelint
|
|
99
|
-
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
|
100
|
-
rev: v0.6.13
|
|
101
|
-
hooks:
|
|
102
|
-
- id: cmake-format
|
|
103
|
-
additional_dependencies:
|
|
104
|
-
- pyyaml
|
|
105
|
-
- id: cmake-lint
|
|
106
|
-
additional_dependencies:
|
|
107
|
-
- pyyaml
|
|
108
|
-
|
|
109
|
-
ci:
|
|
110
|
-
skip:
|
|
111
|
-
- shellcheck
|
|
112
|
-
- pyright
|