tree-sitter/include/tree_sitter/parser/stack.h

35 lines
848 B
C
Raw Normal View History

#ifndef TREE_SITTER_PARSER_STACK_H_
#define TREE_SITTER_PARSER_STACK_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "tree_sitter/runtime.h"
2014-06-28 18:51:06 -07:00
typedef unsigned short TSStateId;
2014-05-09 15:37:30 -07:00
typedef struct {
size_t size;
struct {
2014-06-28 18:45:22 -07:00
TSTree *node;
2014-06-28 18:51:06 -07:00
TSStateId state;
int is_extra;
} *entries;
} ts_stack;
ts_stack ts_stack_make();
void ts_stack_delete(ts_stack *);
2014-06-28 18:53:32 -07:00
TSTree * ts_stack_reduce(ts_stack *stack, TSSymbol symbol, size_t immediate_child_count, const int *hidden_symbol_flags, int gather_extras);
void ts_stack_shrink(ts_stack *stack, size_t new_size);
2014-06-28 18:51:06 -07:00
void ts_stack_push(ts_stack *stack, TSStateId state, TSTree *node);
TSStateId ts_stack_top_state(const ts_stack *stack);
2014-06-28 18:45:22 -07:00
TSTree * ts_stack_top_node(const ts_stack *stack);
size_t ts_stack_right_position(const ts_stack *stack);
#ifdef __cplusplus
}
#endif
#endif