Hide TSTree, expose TSNode

This commit is contained in:
Max Brunsfeld 2014-07-17 23:29:11 -07:00
parent 02904085c2
commit b3385f20c8
13 changed files with 333 additions and 122 deletions

View file

@ -1,8 +1,18 @@
#ifndef RUNTIME_TREE_H_
#define RUNTIME_TREE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "tree_sitter/runtime.h"
typedef enum {
TSTreeOptionsHidden = 1,
TSTreeOptionsExtra = 2,
TSTreeOptionsWrapper = 4,
} TSTreeOptions;
struct TSTree {
TSSymbol symbol;
TSTreeOptions options;
@ -38,4 +48,19 @@ static inline int ts_tree_is_wrapper(const TSTree *tree) {
return (tree->options & TSTreeOptionsWrapper);
}
TSTree * ts_tree_make_leaf(TSSymbol symbol, size_t size, size_t offset, int is_hidden);
TSTree * ts_tree_make_node(TSSymbol symbol, size_t child_count, TSTree **children, int is_hidden);
TSTree * ts_tree_make_error(char lookahead_char, size_t expected_input_count, const TSSymbol *expected_inputs, size_t size, size_t offset);
void ts_tree_retain(TSTree *tree);
void ts_tree_release(TSTree *tree);
int ts_tree_equals(const TSTree *tree1, const TSTree *tree2);
char * ts_tree_string(const TSTree *tree, const char **names);
char * ts_tree_error_string(const TSTree *tree, const char **names);
TSTree ** ts_tree_children(const TSTree *tree, size_t *count);
size_t ts_tree_total_size(const TSTree *tree);
#ifdef __cplusplus
}
#endif
#endif // RUNTIME_TREE_H_