37 return self.context[0];
41 return (
TSPoint) {
self.context[1],
self.context[2]};
45 return self->context[3];
49 return *(
const Subtree *)
self.
id;
68 .structural_child_index = 0,
69 .alias_sequence = alias_sequence,
74 return self->child_index ==
self->parent.ptr->child_count;
85 if (self->alias_sequence) {
86 alias_symbol =
self->alias_sequence[
self->structural_child_index];
88 self->structural_child_index++;
90 if (self->child_index > 0) {
108 if (include_anonymous) {
122 bool include_anonymous
126 if (include_anonymous) {
139 bool include_anonymous
142 bool did_descend =
true;
144 while (did_descend) {
152 if (index == child_index) {
157 uint32_t grandchild_index = child_index - index;
159 if (grandchild_index < grandchild_count) {
162 child_index = grandchild_index;
165 index += grandchild_count;
194 bool earlier_node_is_relevant =
false;
198 bool earlier_child_is_relevant =
false;
199 bool found_child_containing_target =
false;
204 if (child.
id ==
self.id)
break;
205 if (
iterator.position.bytes > target_end_byte) {
206 found_child_containing_target =
true;
210 if (
iterator.position.bytes == target_end_byte &&
213 found_child_containing_target =
true;
218 earlier_child = child;
219 earlier_child_is_relevant =
true;
221 earlier_child = child;
222 earlier_child_is_relevant =
false;
226 if (found_child_containing_target) {
228 earlier_node = earlier_child;
229 earlier_node_is_relevant = earlier_child_is_relevant;
232 }
else if (earlier_child_is_relevant) {
233 return earlier_child;
235 node = earlier_child;
236 }
else if (earlier_node_is_relevant) {
251 bool later_node_is_relevant =
false;
255 bool later_child_is_relevant =
false;
261 if (
iterator.position.bytes < target_end_byte)
continue;
264 child_containing_target = child;
268 later_child_is_relevant =
true;
272 later_child_is_relevant =
false;
279 later_node = later_child;
280 later_node_is_relevant = later_child_is_relevant;
282 node = child_containing_target;
283 }
else if (later_child_is_relevant) {
287 }
else if (later_node_is_relevant) {
300 bool include_anonymous
303 bool did_descend =
true;
305 while (did_descend) {
330 bool include_anonymous
333 TSNode last_visible_node =
self;
335 bool did_descend =
true;
336 while (did_descend) {
346 if (node_end < range_end)
continue;
347 if (node_end <= range_start)
continue;
355 last_visible_node = node;
362 return last_visible_node;
369 bool include_anonymous
372 TSNode last_visible_node =
self;
374 bool did_descend =
true;
375 while (did_descend) {
385 if (
point_lt(node_end, range_end))
continue;
386 if (
point_lte(node_end, range_start))
continue;
394 last_visible_node = node;
401 return last_visible_node;
431 return self.tree == other.
tree &&
self.id == other.
id;
466 TSNode last_visible_node = node;
467 bool did_descend =
true;
468 while (did_descend) {
478 if (
iterator.position.bytes >= end_byte) {
481 last_visible_node = node;
489 return last_visible_node;
529 if (index < field_map->child_index)
continue;
536 if (field_map + 1 == field_map_end) {
545 if (result.
id)
return result;
582 if (
i->child_index == child_index) {
583 return self.tree->language->field_names[
i->field_id];
688 self->context[0] = start_byte;
689 self->context[1] = start_point.
row;
690 self->context[2] = start_point.
column;
const MCPhysReg * iterator
TSFieldId ts_language_field_id_for_name(const TSLanguage *, const char *, uint32_t)
const char * ts_language_symbol_name(const TSLanguage *, TSSymbol)
TSNode ts_tree_root_node(const TSTree *self)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
TSSymbol ts_language_public_symbol(const TSLanguage *self, TSSymbol symbol)
TSSymbolMetadata ts_language_symbol_metadata(const TSLanguage *self, TSSymbol symbol)
static void ts_language_field_map(const TSLanguage *self, uint32_t production_id, const TSFieldMapEntry **start, const TSFieldMapEntry **end)
static const TSSymbol * ts_language_alias_sequence(const TSLanguage *self, uint32_t production_id)
static Length length_zero(void)
static Length length_add(Length len1, Length len2)
bool ts_node_has_error(TSNode self)
static Subtree ts_node__subtree(TSNode self)
TSPoint ts_node_end_point(TSNode self)
bool ts_node_is_extra(TSNode self)
uint32_t ts_node_start_byte(TSNode self)
uint32_t ts_node_child_count(TSNode self)
TSNode ts_node_named_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end)
void ts_node_edit(TSNode *self, const TSInputEdit *edit)
TSNode ts_node_child(TSNode self, uint32_t child_index)
TSNode ts_node_child_by_field_name(TSNode self, const char *name, uint32_t name_length)
TSNode ts_node_next_named_sibling(TSNode self)
bool ts_node_is_missing(TSNode self)
static TSNode ts_node__prev_sibling(TSNode self, bool include_anonymous)
static TSNode ts_node__child(TSNode self, uint32_t child_index, bool include_anonymous)
TSNode ts_node_named_descendant_for_point_range(TSNode self, TSPoint start, TSPoint end)
static uint32_t ts_node__alias(const TSNode *self)
bool ts_node_has_changes(TSNode self)
TSNode ts_node_first_child_for_byte(TSNode self, uint32_t byte)
bool ts_node_is_named(TSNode self)
TSPoint ts_node_start_point(TSNode self)
TSNode ts_node_prev_sibling(TSNode self)
static TSNode ts_node__next_sibling(TSNode self, bool include_anonymous)
static bool ts_node_child_iterator_done(NodeChildIterator *self)
bool ts_node_is_null(TSNode self)
TSNode ts_node_child_by_field_id(TSNode self, TSFieldId field_id)
static bool ts_node__is_relevant(TSNode self, bool include_anonymous)
TSNode ts_node_prev_named_sibling(TSNode self)
static TSNode ts_node__descendant_for_byte_range(TSNode self, uint32_t range_start, uint32_t range_end, bool include_anonymous)
static bool ts_node_child_iterator_next(NodeChildIterator *self, TSNode *result)
const char * ts_node_type(TSNode self)
TSNode ts_node_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end)
static bool ts_subtree_has_trailing_empty_descendant(Subtree self, Subtree other)
static NodeChildIterator ts_node_iterate_children(const TSNode *node)
TSNode ts_node_descendant_for_point_range(TSNode self, TSPoint start, TSPoint end)
static TSNode ts_node__descendant_for_point_range(TSNode self, TSPoint range_start, TSPoint range_end, bool include_anonymous)
static uint32_t ts_node__relevant_child_count(TSNode self, bool include_anonymous)
char * ts_node_string(TSNode self)
TSNode ts_node_next_sibling(TSNode self)
TSNode ts_node_first_named_child_for_byte(TSNode self, uint32_t byte)
uint32_t ts_node_named_child_count(TSNode self)
uint32_t ts_node_end_byte(TSNode self)
const char * ts_node_field_name_for_child(TSNode self, uint32_t child_index)
static TSNode ts_node__first_child_for_byte(TSNode self, uint32_t goal, bool include_anonymous)
static TSNode ts_node__null(void)
TSNode ts_node_named_child(TSNode self, uint32_t child_index)
TSNode ts_node_new(const TSTree *tree, const Subtree *subtree, Length position, TSSymbol alias)
TSNode ts_node_parent(TSNode self)
bool ts_node_eq(TSNode self, TSNode other)
TSSymbol ts_node_symbol(TSNode self)
static TSPoint point_sub(TSPoint a, TSPoint b)
static bool point_lt(TSPoint a, TSPoint b)
static TSPoint point_add(TSPoint a, TSPoint b)
static bool point_lte(TSPoint a, TSPoint b)
const TSSymbol * alias_sequence
uint32_t structural_child_index
uint32_t visible_child_count
uint32_t named_child_count
const TSLanguage * language
char * ts_subtree_string(Subtree self, const TSLanguage *language, bool include_all)
#define ts_subtree_children(self)
static bool ts_subtree_visible(Subtree self)
static uint32_t ts_subtree_total_bytes(Subtree self)
static uint32_t ts_subtree_error_cost(Subtree self)
static bool ts_subtree_extra(Subtree self)
static bool ts_subtree_has_changes(Subtree self)
static bool ts_subtree_missing(Subtree self)
static Length ts_subtree_size(Subtree self)
static bool ts_subtree_named(Subtree self)
static uint32_t ts_subtree_child_count(Subtree self)
static Length ts_subtree_padding(Subtree self)
static TSSymbol ts_subtree_symbol(Subtree self)
const SubtreeHeapData * ptr