aboutsummaryrefslogtreecommitdiff
path: root/src/tree_sitter/tree.h
blob: 92a7e641798289633a1dae1f13380564145b1882 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef TREE_SITTER_TREE_H_
#define TREE_SITTER_TREE_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  const Subtree *child;
  const Subtree *parent;
  Length position;
  TSSymbol alias_symbol;
} ParentCacheEntry;

struct TSTree {
  Subtree root;
  const TSLanguage *language;
  ParentCacheEntry *parent_cache;
  uint32_t parent_cache_start;
  uint32_t parent_cache_size;
  TSRange *included_ranges;
  unsigned included_range_count;
};

TSTree *ts_tree_new(Subtree root, const TSLanguage *language, const TSRange *, unsigned);
TSNode ts_node_new(const TSTree *, const Subtree *, Length, TSSymbol);
TSNode ts_tree_get_cached_parent(const TSTree *, const TSNode *);
void ts_tree_set_cached_parent(const TSTree *, const TSNode *, const TSNode *);

#ifdef __cplusplus
}
#endif

#endif  // TREE_SITTER_TREE_H_