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 "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_