Add ts_tree_cursor_reset function
This commit is contained in:
parent
fa1f4aa86a
commit
af01846fd7
3 changed files with 12 additions and 6 deletions
|
|
@ -66,14 +66,18 @@ static inline bool ts_tree_cursor_child_iterator_next(ChildIterator *self,
|
|||
// TSTreeCursor - lifecycle
|
||||
|
||||
TSTreeCursor ts_tree_cursor_new(TSNode node) {
|
||||
TSTreeCursor self;
|
||||
TSTreeCursor self = {{0, 0}, NULL, NULL};
|
||||
ts_tree_cursor_init((TreeCursor *)&self, node);
|
||||
return self;
|
||||
}
|
||||
|
||||
void ts_tree_cursor_reset(TSTreeCursor *_self, TSNode node) {
|
||||
ts_tree_cursor_init((TreeCursor *)_self, node);
|
||||
}
|
||||
|
||||
void ts_tree_cursor_init(TreeCursor *self, TSNode node) {
|
||||
self->tree = node.tree;
|
||||
array_init(&self->stack);
|
||||
array_clear(&self->stack);
|
||||
array_push(&self->stack, ((TreeCursorEntry) {
|
||||
.subtree = (const Subtree *)node.id,
|
||||
.position = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue