2019-01-10 15:22:39 -08:00
|
|
|
#ifndef TREE_SITTER_REDUCE_ACTION_H_
|
|
|
|
|
#define TREE_SITTER_REDUCE_ACTION_H_
|
2016-05-09 14:31:44 -07:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-04 17:33:34 -08:00
|
|
|
#include "./array.h"
|
2019-01-10 15:22:39 -08:00
|
|
|
#include "tree_sitter/api.h"
|
2016-05-09 14:31:44 -07:00
|
|
|
|
|
|
|
|
typedef struct {
|
2016-11-14 12:15:24 -08:00
|
|
|
uint32_t count;
|
2016-05-09 14:31:44 -07:00
|
|
|
TSSymbol symbol;
|
2017-07-06 15:20:11 -07:00
|
|
|
int dynamic_precedence;
|
2019-02-12 11:06:18 -08:00
|
|
|
unsigned short production_id;
|
2016-05-09 14:31:44 -07:00
|
|
|
} ReduceAction;
|
|
|
|
|
|
|
|
|
|
typedef Array(ReduceAction) ReduceActionSet;
|
|
|
|
|
|
2016-11-04 09:18:38 -07:00
|
|
|
static inline void ts_reduce_action_set_add(ReduceActionSet *self,
|
2016-05-09 14:31:44 -07:00
|
|
|
ReduceAction new_action) {
|
2016-11-14 12:15:24 -08:00
|
|
|
for (uint32_t i = 0; i < self->size; i++) {
|
2016-05-09 14:31:44 -07:00
|
|
|
ReduceAction action = self->contents[i];
|
|
|
|
|
if (action.symbol == new_action.symbol && action.count == new_action.count)
|
2016-11-04 09:18:38 -07:00
|
|
|
return;
|
2016-05-09 14:31:44 -07:00
|
|
|
}
|
2016-11-04 09:18:38 -07:00
|
|
|
array_push(self, new_action);
|
2016-05-09 14:31:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-10 15:22:39 -08:00
|
|
|
#endif // TREE_SITTER_REDUCE_ACTION_H_
|