tree-sitter/src/runtime/tree.h

42 lines
964 B
C
Raw Normal View History

#ifndef RUNTIME_TREE_H_
#define RUNTIME_TREE_H_
#include "tree_sitter/runtime.h"
2014-06-28 18:45:22 -07:00
struct TSTree {
2014-06-28 18:53:32 -07:00
TSSymbol symbol;
TSTreeOptions options;
size_t ref_count;
size_t offset;
size_t size;
union {
struct {
size_t child_count;
struct TSTree **children;
};
struct {
size_t expected_input_count;
2014-06-28 18:53:32 -07:00
const TSSymbol *expected_inputs;
char lookahead_char;
};
};
};
static inline int ts_tree_is_extra(const TSTree *tree) {
return (tree->options & TSTreeOptionsExtra);
}
static inline int ts_tree_is_visible(const TSTree *tree) {
return !(tree->options & TSTreeOptionsHidden);
}
static inline void ts_tree_set_extra(TSTree *tree) {
tree->options = (TSTreeOptions)(tree->options | TSTreeOptionsExtra);
}
static inline int ts_tree_is_wrapper(const TSTree *tree) {
return (tree->options & TSTreeOptionsWrapper);
}
#endif // RUNTIME_TREE_H_