2014-06-26 08:52:42 -07:00
|
|
|
#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;
|
2014-07-16 18:38:06 -07:00
|
|
|
TSTreeOptions options;
|
2014-06-26 08:52:42 -07:00
|
|
|
size_t ref_count;
|
|
|
|
|
size_t offset;
|
|
|
|
|
size_t size;
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
2014-07-16 18:38:06 -07:00
|
|
|
size_t child_count;
|
|
|
|
|
struct TSTree **children;
|
|
|
|
|
};
|
2014-06-26 08:52:42 -07:00
|
|
|
struct {
|
|
|
|
|
size_t expected_input_count;
|
2014-06-28 18:53:32 -07:00
|
|
|
const TSSymbol *expected_inputs;
|
2014-07-16 18:38:06 -07:00
|
|
|
char lookahead_char;
|
|
|
|
|
};
|
|
|
|
|
};
|
2014-06-26 08:52:42 -07:00
|
|
|
};
|
|
|
|
|
|
2014-07-16 18:38:06 -07:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-26 08:52:42 -07:00
|
|
|
#endif // RUNTIME_TREE_H_
|