@reteps/tree-sitter-htmlmustache 0.0.18
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/LICENSE +21 -0
- package/README.md +105 -0
- package/binding.gyp +30 -0
- package/bindings/node/binding.cc +19 -0
- package/bindings/node/binding_test.js +9 -0
- package/bindings/node/index.d.ts +27 -0
- package/bindings/node/index.js +13 -0
- package/cli/out/check.js +210 -0
- package/grammar.js +426 -0
- package/package.json +82 -0
- package/queries/highlights.scm +30 -0
- package/queries/injections.scm +7 -0
- package/src/custom_raw_tags.h +3 -0
- package/src/grammar.json +1417 -0
- package/src/mustache_tag.h +29 -0
- package/src/node-types.json +972 -0
- package/src/parser.c +10469 -0
- package/src/parser.o +0 -0
- package/src/scanner.c +640 -0
- package/src/scanner.o +0 -0
- package/src/tag.h +390 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +286 -0
- package/tree-sitter-htmlmustache.wasm +0 -0
- package/tree-sitter.json +36 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#include "tree_sitter/array.h"
|
|
2
|
+
#include <string.h>
|
|
3
|
+
|
|
4
|
+
// typedef Array(char) String;
|
|
5
|
+
|
|
6
|
+
typedef struct {
|
|
7
|
+
String tag_name;
|
|
8
|
+
unsigned html_tag_stack_size;
|
|
9
|
+
} MustacheTag;
|
|
10
|
+
|
|
11
|
+
static inline void mustache_tag_free(MustacheTag *tag) { array_delete(&tag->tag_name); }
|
|
12
|
+
|
|
13
|
+
static inline MustacheTag mustache_tag_new() {
|
|
14
|
+
MustacheTag tag;
|
|
15
|
+
tag.tag_name = (String) array_new();
|
|
16
|
+
tag.html_tag_stack_size = 0;
|
|
17
|
+
return tag;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static inline bool mustache_tag_eq(const MustacheTag *self, const MustacheTag *other) {
|
|
21
|
+
if (self->tag_name.size != other->tag_name.size) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (memcmp(self->tag_name.contents, other->tag_name.contents,
|
|
25
|
+
self->tag_name.size) != 0) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|