aboutsummaryrefslogtreecommitdiff
path: root/vendor/tree-sitter/lib/src/reduce_action.h
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2023-11-07 16:38:48 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2023-11-07 16:38:48 +0100
commitc0377818aa198a5b5d0d3c7697373c5b6828d5fa (patch)
tree8deb7109e9c996884a6a86ab46ec6190e793c532 /vendor/tree-sitter/lib/src/reduce_action.h
parentf9dcd08833afdfb3b4446cb842d3ecd4469c5638 (diff)
downloadcrep-c0377818aa198a5b5d0d3c7697373c5b6828d5fa.tar.gz
Added tree-sitter vendor library
Diffstat (limited to 'vendor/tree-sitter/lib/src/reduce_action.h')
-rw-r--r--vendor/tree-sitter/lib/src/reduce_action.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/tree-sitter/lib/src/reduce_action.h b/vendor/tree-sitter/lib/src/reduce_action.h
new file mode 100644
index 0000000..72aff08
--- /dev/null
+++ b/vendor/tree-sitter/lib/src/reduce_action.h
@@ -0,0 +1,34 @@
1#ifndef TREE_SITTER_REDUCE_ACTION_H_
2#define TREE_SITTER_REDUCE_ACTION_H_
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include "./array.h"
9#include "tree_sitter/api.h"
10
11typedef struct {
12 uint32_t count;
13 TSSymbol symbol;
14 int dynamic_precedence;
15 unsigned short production_id;
16} ReduceAction;
17
18typedef Array(ReduceAction) ReduceActionSet;
19
20static inline void ts_reduce_action_set_add(ReduceActionSet *self,
21 ReduceAction new_action) {
22 for (uint32_t i = 0; i < self->size; i++) {
23 ReduceAction action = self->contents[i];
24 if (action.symbol == new_action.symbol && action.count == new_action.count)
25 return;
26 }
27 array_push(self, new_action);
28}
29
30#ifdef __cplusplus
31}
32#endif
33
34#endif // TREE_SITTER_REDUCE_ACTION_H_