Rizin
unix-like reverse engineering framework and cli tools
tree.h File Reference

Go to the source code of this file.

Classes

struct  ParentCacheEntry
 
struct  TSTree
 

Functions

TSTreets_tree_new (Subtree root, const TSLanguage *language, const TSRange *, unsigned)
 
TSNode ts_node_new (const TSTree *, const Subtree *, Length, TSSymbol)
 

Function Documentation

◆ ts_node_new()

TSNode ts_node_new ( const TSTree tree,
const Subtree subtree,
Length  position,
TSSymbol  alias 
)

Definition at line 17 of file node.c.

22  {
23  return (TSNode) {
24  {position.bytes, position.extent.row, position.extent.column, alias},
25  subtree,
26  tree,
27  };
28 }
uint32_t bytes
Definition: length.h:10
TSPoint extent
Definition: length.h:11
Definition: api.h:92
uint32_t row
Definition: api.h:56
uint32_t column
Definition: api.h:57

References Length::bytes, TSPoint::column, Length::extent, and TSPoint::row.

Referenced by ts_node__null(), ts_node_child_iterator_next(), ts_tree_cursor_current_node(), ts_tree_cursor_parent_node(), and ts_tree_root_node().

◆ ts_tree_new()

TSTree* ts_tree_new ( Subtree  root,
const TSLanguage language,
const TSRange included_ranges,
unsigned  included_range_count 
)

Definition at line 8 of file tree.c.

11  {
12  TSTree *result = ts_malloc(sizeof(TSTree));
13  result->root = root;
14  result->language = language;
15  result->included_ranges = ts_calloc(included_range_count, sizeof(TSRange));
16  memcpy(result->included_ranges, included_ranges, included_range_count * sizeof(TSRange));
17  result->included_range_count = included_range_count;
18  return result;
19 }
#define ts_malloc
Definition: alloc.h:21
#define ts_calloc
Definition: alloc.h:24
int root
Definition: enough.c:226
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
Definition: api.h:60
Definition: tree.h:15
Subtree root
Definition: tree.h:16
TSRange * included_ranges
Definition: tree.h:18
unsigned included_range_count
Definition: tree.h:19
const TSLanguage * language
Definition: tree.h:17

References TSTree::included_range_count, TSTree::included_ranges, TSTree::language, memcpy(), TSTree::root, root, ts_calloc, and ts_malloc.

Referenced by ts_parser_parse(), and ts_tree_copy().