tree-sitter-glsl-spec 1.0.0

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.
@@ -0,0 +1,112 @@
1
+ #ifndef TREE_SITTER_RUNTIME_H_
2
+ #define TREE_SITTER_RUNTIME_H_
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include <stdlib.h>
9
+ #include <stdbool.h>
10
+
11
+ typedef unsigned short TSSymbol;
12
+ typedef struct TSLanguage TSLanguage;
13
+ typedef struct TSDocument TSDocument;
14
+
15
+ typedef enum {
16
+ TSInputEncodingUTF8,
17
+ TSInputEncodingUTF16,
18
+ } TSInputEncoding;
19
+
20
+ typedef struct {
21
+ void *payload;
22
+ const char *(*read_fn)(void *payload, size_t *bytes_read);
23
+ int (*seek_fn)(void *payload, size_t character, size_t byte);
24
+ TSInputEncoding encoding;
25
+ } TSInput;
26
+
27
+ typedef enum {
28
+ TSDebugTypeParse,
29
+ TSDebugTypeLex,
30
+ } TSDebugType;
31
+
32
+ typedef struct {
33
+ void *payload;
34
+ void (*debug_fn)(void *payload, TSDebugType, const char *);
35
+ } TSDebugger;
36
+
37
+ typedef struct {
38
+ size_t position;
39
+ size_t chars_inserted;
40
+ size_t chars_removed;
41
+ } TSInputEdit;
42
+
43
+ typedef struct {
44
+ size_t row;
45
+ size_t column;
46
+ } TSPoint;
47
+
48
+ typedef struct {
49
+ const void *data;
50
+ size_t offset[3];
51
+ } TSNode;
52
+
53
+ typedef struct {
54
+ TSSymbol value;
55
+ bool done;
56
+ void *data;
57
+ } TSSymbolIterator;
58
+
59
+ size_t ts_node_start_char(TSNode);
60
+ size_t ts_node_start_byte(TSNode);
61
+ TSPoint ts_node_start_point(TSNode);
62
+ size_t ts_node_end_char(TSNode);
63
+ size_t ts_node_end_byte(TSNode);
64
+ TSPoint ts_node_end_point(TSNode);
65
+ TSSymbol ts_node_symbol(TSNode);
66
+ TSSymbolIterator ts_node_symbols(TSNode);
67
+ void ts_symbol_iterator_next(TSSymbolIterator *);
68
+ const char *ts_node_name(TSNode, const TSDocument *);
69
+ char *ts_node_string(TSNode, const TSDocument *);
70
+ bool ts_node_eq(TSNode, TSNode);
71
+ bool ts_node_is_named(TSNode);
72
+ bool ts_node_has_changes(TSNode);
73
+ TSNode ts_node_parent(TSNode);
74
+ TSNode ts_node_child(TSNode, size_t);
75
+ TSNode ts_node_named_child(TSNode, size_t);
76
+ size_t ts_node_child_count(TSNode);
77
+ size_t ts_node_named_child_count(TSNode);
78
+ TSNode ts_node_next_sibling(TSNode);
79
+ TSNode ts_node_next_named_sibling(TSNode);
80
+ TSNode ts_node_prev_sibling(TSNode);
81
+ TSNode ts_node_prev_named_sibling(TSNode);
82
+ TSNode ts_node_descendant_for_range(TSNode, size_t, size_t);
83
+ TSNode ts_node_named_descendant_for_range(TSNode, size_t, size_t);
84
+
85
+ TSDocument *ts_document_make();
86
+ void ts_document_free(TSDocument *);
87
+ const TSLanguage *ts_document_language(TSDocument *);
88
+ void ts_document_set_language(TSDocument *, const TSLanguage *);
89
+ TSInput ts_document_input(TSDocument *);
90
+ void ts_document_set_input(TSDocument *, TSInput);
91
+ void ts_document_set_input_string(TSDocument *, const char *);
92
+ TSDebugger ts_document_debugger(const TSDocument *);
93
+ void ts_document_set_debugger(TSDocument *, TSDebugger);
94
+ void ts_document_print_debugging_graphs(TSDocument *, bool);
95
+ void ts_document_edit(TSDocument *, TSInputEdit);
96
+ int ts_document_parse(TSDocument *);
97
+ void ts_document_invalidate(TSDocument *);
98
+ TSNode ts_document_root_node(const TSDocument *);
99
+ size_t ts_document_parse_count(const TSDocument *);
100
+
101
+ size_t ts_language_symbol_count(const TSLanguage *);
102
+ const char *ts_language_symbol_name(const TSLanguage *, TSSymbol);
103
+
104
+ #define ts_builtin_sym_error ((TSSymbol)-1)
105
+ #define ts_builtin_sym_end 0
106
+ #define ts_builtin_sym_start 1
107
+
108
+ #ifdef __cplusplus
109
+ }
110
+ #endif
111
+
112
+ #endif // TREE_SITTER_RUNTIME_H_