Rizin
unix-like reverse engineering framework and cli tools
node.c
Go to the documentation of this file.
1 #include <stdbool.h>
2 #include "./subtree.h"
3 #include "./tree.h"
4 #include "./language.h"
5 
6 typedef struct {
8  const TSTree *tree;
14 
15 // TSNode - constructors
16 
18  const TSTree *tree,
19  const Subtree *subtree,
20  Length position,
21  TSSymbol alias
22 ) {
23  return (TSNode) {
24  {position.bytes, position.extent.row, position.extent.column, alias},
25  subtree,
26  tree,
27  };
28 }
29 
30 static inline TSNode ts_node__null(void) {
31  return ts_node_new(NULL, NULL, length_zero(), 0);
32 }
33 
34 // TSNode - accessors
35 
37  return self.context[0];
38 }
39 
41  return (TSPoint) {self.context[1], self.context[2]};
42 }
43 
44 static inline uint32_t ts_node__alias(const TSNode *self) {
45  return self->context[3];
46 }
47 
48 static inline Subtree ts_node__subtree(TSNode self) {
49  return *(const Subtree *)self.id;
50 }
51 
52 // NodeChildIterator
53 
55  Subtree subtree = ts_node__subtree(*node);
56  if (ts_subtree_child_count(subtree) == 0) {
57  return (NodeChildIterator) {NULL_SUBTREE, node->tree, length_zero(), 0, 0, NULL};
58  }
59  const TSSymbol *alias_sequence = ts_language_alias_sequence(
60  node->tree->language,
61  subtree.ptr->production_id
62  );
63  return (NodeChildIterator) {
64  .tree = node->tree,
65  .parent = subtree,
66  .position = {ts_node_start_byte(*node), ts_node_start_point(*node)},
67  .child_index = 0,
68  .structural_child_index = 0,
69  .alias_sequence = alias_sequence,
70  };
71 }
72 
74  return self->child_index == self->parent.ptr->child_count;
75 }
76 
77 static inline bool ts_node_child_iterator_next(
78  NodeChildIterator *self,
79  TSNode *result
80 ) {
81  if (!self->parent.ptr || ts_node_child_iterator_done(self)) return false;
82  const Subtree *child = &ts_subtree_children(self->parent)[self->child_index];
83  TSSymbol alias_symbol = 0;
84  if (!ts_subtree_extra(*child)) {
85  if (self->alias_sequence) {
86  alias_symbol = self->alias_sequence[self->structural_child_index];
87  }
88  self->structural_child_index++;
89  }
90  if (self->child_index > 0) {
91  self->position = length_add(self->position, ts_subtree_padding(*child));
92  }
93  *result = ts_node_new(
94  self->tree,
95  child,
96  self->position,
97  alias_symbol
98  );
99  self->position = length_add(self->position, ts_subtree_size(*child));
100  self->child_index++;
101  return true;
102 }
103 
104 // TSNode - private
105 
106 static inline bool ts_node__is_relevant(TSNode self, bool include_anonymous) {
107  Subtree tree = ts_node__subtree(self);
108  if (include_anonymous) {
109  return ts_subtree_visible(tree) || ts_node__alias(&self);
110  } else {
111  TSSymbol alias = ts_node__alias(&self);
112  if (alias) {
113  return ts_language_symbol_metadata(self.tree->language, alias).named;
114  } else {
115  return ts_subtree_visible(tree) && ts_subtree_named(tree);
116  }
117  }
118 }
119 
121  TSNode self,
122  bool include_anonymous
123 ) {
124  Subtree tree = ts_node__subtree(self);
125  if (ts_subtree_child_count(tree) > 0) {
126  if (include_anonymous) {
127  return tree.ptr->visible_child_count;
128  } else {
129  return tree.ptr->named_child_count;
130  }
131  } else {
132  return 0;
133  }
134 }
135 
136 static inline TSNode ts_node__child(
137  TSNode self,
138  uint32_t child_index,
139  bool include_anonymous
140 ) {
141  TSNode result = self;
142  bool did_descend = true;
143 
144  while (did_descend) {
145  did_descend = false;
146 
147  TSNode child;
148  uint32_t index = 0;
150  while (ts_node_child_iterator_next(&iterator, &child)) {
151  if (ts_node__is_relevant(child, include_anonymous)) {
152  if (index == child_index) {
153  return child;
154  }
155  index++;
156  } else {
157  uint32_t grandchild_index = child_index - index;
158  uint32_t grandchild_count = ts_node__relevant_child_count(child, include_anonymous);
159  if (grandchild_index < grandchild_count) {
160  did_descend = true;
161  result = child;
162  child_index = grandchild_index;
163  break;
164  }
165  index += grandchild_count;
166  }
167  }
168  }
169 
170  return ts_node__null();
171 }
172 
174  Subtree self,
175  Subtree other
176 ) {
177  for (unsigned i = ts_subtree_child_count(self) - 1; i + 1 > 0; i--) {
178  Subtree child = ts_subtree_children(self)[i];
179  if (ts_subtree_total_bytes(child) > 0) break;
180  if (child.ptr == other.ptr || ts_subtree_has_trailing_empty_descendant(child, other)) {
181  return true;
182  }
183  }
184  return false;
185 }
186 
187 static inline TSNode ts_node__prev_sibling(TSNode self, bool include_anonymous) {
188  Subtree self_subtree = ts_node__subtree(self);
189  bool self_is_empty = ts_subtree_total_bytes(self_subtree) == 0;
190  uint32_t target_end_byte = ts_node_end_byte(self);
191 
192  TSNode node = ts_node_parent(self);
193  TSNode earlier_node = ts_node__null();
194  bool earlier_node_is_relevant = false;
195 
196  while (!ts_node_is_null(node)) {
197  TSNode earlier_child = ts_node__null();
198  bool earlier_child_is_relevant = false;
199  bool found_child_containing_target = false;
200 
201  TSNode child;
203  while (ts_node_child_iterator_next(&iterator, &child)) {
204  if (child.id == self.id) break;
205  if (iterator.position.bytes > target_end_byte) {
206  found_child_containing_target = true;
207  break;
208  }
209 
210  if (iterator.position.bytes == target_end_byte &&
211  (!self_is_empty ||
213  found_child_containing_target = true;
214  break;
215  }
216 
217  if (ts_node__is_relevant(child, include_anonymous)) {
218  earlier_child = child;
219  earlier_child_is_relevant = true;
220  } else if (ts_node__relevant_child_count(child, include_anonymous) > 0) {
221  earlier_child = child;
222  earlier_child_is_relevant = false;
223  }
224  }
225 
226  if (found_child_containing_target) {
227  if (!ts_node_is_null(earlier_child)) {
228  earlier_node = earlier_child;
229  earlier_node_is_relevant = earlier_child_is_relevant;
230  }
231  node = child;
232  } else if (earlier_child_is_relevant) {
233  return earlier_child;
234  } else if (!ts_node_is_null(earlier_child)) {
235  node = earlier_child;
236  } else if (earlier_node_is_relevant) {
237  return earlier_node;
238  } else {
239  node = earlier_node;
240  }
241  }
242 
243  return ts_node__null();
244 }
245 
246 static inline TSNode ts_node__next_sibling(TSNode self, bool include_anonymous) {
247  uint32_t target_end_byte = ts_node_end_byte(self);
248 
249  TSNode node = ts_node_parent(self);
250  TSNode later_node = ts_node__null();
251  bool later_node_is_relevant = false;
252 
253  while (!ts_node_is_null(node)) {
254  TSNode later_child = ts_node__null();
255  bool later_child_is_relevant = false;
256  TSNode child_containing_target = ts_node__null();
257 
258  TSNode child;
260  while (ts_node_child_iterator_next(&iterator, &child)) {
261  if (iterator.position.bytes < target_end_byte) continue;
262  if (ts_node_start_byte(child) <= ts_node_start_byte(self)) {
263  if (ts_node__subtree(child).ptr != ts_node__subtree(self).ptr) {
264  child_containing_target = child;
265  }
266  } else if (ts_node__is_relevant(child, include_anonymous)) {
267  later_child = child;
268  later_child_is_relevant = true;
269  break;
270  } else if (ts_node__relevant_child_count(child, include_anonymous) > 0) {
271  later_child = child;
272  later_child_is_relevant = false;
273  break;
274  }
275  }
276 
277  if (!ts_node_is_null(child_containing_target)) {
278  if (!ts_node_is_null(later_child)) {
279  later_node = later_child;
280  later_node_is_relevant = later_child_is_relevant;
281  }
282  node = child_containing_target;
283  } else if (later_child_is_relevant) {
284  return later_child;
285  } else if (!ts_node_is_null(later_child)) {
286  node = later_child;
287  } else if (later_node_is_relevant) {
288  return later_node;
289  } else {
290  node = later_node;
291  }
292  }
293 
294  return ts_node__null();
295 }
296 
298  TSNode self,
299  uint32_t goal,
300  bool include_anonymous
301 ) {
302  TSNode node = self;
303  bool did_descend = true;
304 
305  while (did_descend) {
306  did_descend = false;
307 
308  TSNode child;
310  while (ts_node_child_iterator_next(&iterator, &child)) {
311  if (ts_node_end_byte(child) > goal) {
312  if (ts_node__is_relevant(child, include_anonymous)) {
313  return child;
314  } else if (ts_node_child_count(child) > 0) {
315  did_descend = true;
316  node = child;
317  break;
318  }
319  }
320  }
321  }
322 
323  return ts_node__null();
324 }
325 
327  TSNode self,
328  uint32_t range_start,
329  uint32_t range_end,
330  bool include_anonymous
331 ) {
332  TSNode node = self;
333  TSNode last_visible_node = self;
334 
335  bool did_descend = true;
336  while (did_descend) {
337  did_descend = false;
338 
339  TSNode child;
341  while (ts_node_child_iterator_next(&iterator, &child)) {
342  uint32_t node_end = iterator.position.bytes;
343 
344  // The end of this node must extend far enough forward to touch
345  // the end of the range and exceed the start of the range.
346  if (node_end < range_end) continue;
347  if (node_end <= range_start) continue;
348 
349  // The start of this node must extend far enough backward to
350  // touch the start of the range.
351  if (range_start < ts_node_start_byte(child)) break;
352 
353  node = child;
354  if (ts_node__is_relevant(node, include_anonymous)) {
355  last_visible_node = node;
356  }
357  did_descend = true;
358  break;
359  }
360  }
361 
362  return last_visible_node;
363 }
364 
366  TSNode self,
367  TSPoint range_start,
368  TSPoint range_end,
369  bool include_anonymous
370 ) {
371  TSNode node = self;
372  TSNode last_visible_node = self;
373 
374  bool did_descend = true;
375  while (did_descend) {
376  did_descend = false;
377 
378  TSNode child;
380  while (ts_node_child_iterator_next(&iterator, &child)) {
381  TSPoint node_end = iterator.position.extent;
382 
383  // The end of this node must extend far enough forward to touch
384  // the end of the range and exceed the start of the range.
385  if (point_lt(node_end, range_end)) continue;
386  if (point_lte(node_end, range_start)) continue;
387 
388  // The start of this node must extend far enough backward to
389  // touch the start of the range.
390  if (point_lt(range_start, ts_node_start_point(child))) break;
391 
392  node = child;
393  if (ts_node__is_relevant(node, include_anonymous)) {
394  last_visible_node = node;
395  }
396  did_descend = true;
397  break;
398  }
399  }
400 
401  return last_visible_node;
402 }
403 
404 // TSNode - public
405 
408 }
409 
411  return point_add(ts_node_start_point(self), ts_subtree_size(ts_node__subtree(self)).extent);
412 }
413 
415  TSSymbol symbol = ts_node__alias(&self);
416  if (!symbol) symbol = ts_subtree_symbol(ts_node__subtree(self));
417  return ts_language_public_symbol(self.tree->language, symbol);
418 }
419 
420 const char *ts_node_type(TSNode self) {
421  TSSymbol symbol = ts_node__alias(&self);
422  if (!symbol) symbol = ts_subtree_symbol(ts_node__subtree(self));
423  return ts_language_symbol_name(self.tree->language, symbol);
424 }
425 
426 char *ts_node_string(TSNode self) {
427  return ts_subtree_string(ts_node__subtree(self), self.tree->language, false);
428 }
429 
430 bool ts_node_eq(TSNode self, TSNode other) {
431  return self.tree == other.tree && self.id == other.id;
432 }
433 
435  return self.id == 0;
436 }
437 
439  return ts_subtree_extra(ts_node__subtree(self));
440 }
441 
443  TSSymbol alias = ts_node__alias(&self);
444  return alias
445  ? ts_language_symbol_metadata(self.tree->language, alias).named
447 }
448 
450  return ts_subtree_missing(ts_node__subtree(self));
451 }
452 
455 }
456 
458  return ts_subtree_error_cost(ts_node__subtree(self)) > 0;
459 }
460 
462  TSNode node = ts_tree_root_node(self.tree);
463  uint32_t end_byte = ts_node_end_byte(self);
464  if (node.id == self.id) return ts_node__null();
465 
466  TSNode last_visible_node = node;
467  bool did_descend = true;
468  while (did_descend) {
469  did_descend = false;
470 
471  TSNode child;
473  while (ts_node_child_iterator_next(&iterator, &child)) {
474  if (
475  ts_node_start_byte(child) > ts_node_start_byte(self) ||
476  child.id == self.id
477  ) break;
478  if (iterator.position.bytes >= end_byte) {
479  node = child;
480  if (ts_node__is_relevant(child, true)) {
481  last_visible_node = node;
482  }
483  did_descend = true;
484  break;
485  }
486  }
487  }
488 
489  return last_visible_node;
490 }
491 
492 TSNode ts_node_child(TSNode self, uint32_t child_index) {
493  return ts_node__child(self, child_index, true);
494 }
495 
497  return ts_node__child(self, child_index, false);
498 }
499 
501 recur:
502  if (!field_id || ts_node_child_count(self) == 0) return ts_node__null();
503 
504  const TSFieldMapEntry *field_map, *field_map_end;
506  self.tree->language,
507  ts_node__subtree(self).ptr->production_id,
508  &field_map,
509  &field_map_end
510  );
511  if (field_map == field_map_end) return ts_node__null();
512 
513  // The field mappings are sorted by their field id. Scan all
514  // the mappings to find the ones for the given field id.
515  while (field_map->field_id < field_id) {
516  field_map++;
517  if (field_map == field_map_end) return ts_node__null();
518  }
519  while (field_map_end[-1].field_id > field_id) {
520  field_map_end--;
521  if (field_map == field_map_end) return ts_node__null();
522  }
523 
524  TSNode child;
526  while (ts_node_child_iterator_next(&iterator, &child)) {
527  if (!ts_subtree_extra(ts_node__subtree(child))) {
528  uint32_t index = iterator.structural_child_index - 1;
529  if (index < field_map->child_index) continue;
530 
531  // Hidden nodes' fields are "inherited" by their visible parent.
532  if (field_map->inherited) {
533 
534  // If this is the *last* possible child node for this field,
535  // then perform a tail call to avoid recursion.
536  if (field_map + 1 == field_map_end) {
537  self = child;
538  goto recur;
539  }
540 
541  // Otherwise, descend into this child, but if it doesn't contain
542  // the field, continue searching subsequent children.
543  else {
544  TSNode result = ts_node_child_by_field_id(child, field_id);
545  if (result.id) return result;
546  field_map++;
547  if (field_map == field_map_end) return ts_node__null();
548  }
549  }
550 
551  else if (ts_node__is_relevant(child, true)) {
552  return child;
553  }
554 
555  // If the field refers to a hidden node with visible children,
556  // return the first visible child.
557  else if (ts_node_child_count(child) > 0 ) {
558  return ts_node_child(child, 0);
559  }
560 
561  // Otherwise, continue searching subsequent children.
562  else {
563  field_map++;
564  if (field_map == field_map_end) return ts_node__null();
565  }
566  }
567  }
568 
569  return ts_node__null();
570 }
571 
572 const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index) {
573  const TSFieldMapEntry *field_map_start = NULL, *field_map_end = NULL;
575  self.tree->language,
576  ts_node__subtree(self).ptr->production_id,
577  &field_map_start,
578  &field_map_end
579  );
580 
581  for (const TSFieldMapEntry *i = field_map_start; i < field_map_end; i++) {
582  if (i->child_index == child_index) {
583  return self.tree->language->field_names[i->field_id];
584  }
585  }
586  return NULL;
587 }
588 
590  TSNode self,
591  const char *name,
592  uint32_t name_length
593 ) {
595  self.tree->language,
596  name,
597  name_length
598  );
599  return ts_node_child_by_field_id(self, field_id);
600 }
601 
603  Subtree tree = ts_node__subtree(self);
604  if (ts_subtree_child_count(tree) > 0) {
605  return tree.ptr->visible_child_count;
606  } else {
607  return 0;
608  }
609 }
610 
612  Subtree tree = ts_node__subtree(self);
613  if (ts_subtree_child_count(tree) > 0) {
614  return tree.ptr->named_child_count;
615  } else {
616  return 0;
617  }
618 }
619 
621  return ts_node__next_sibling(self, true);
622 }
623 
625  return ts_node__next_sibling(self, false);
626 }
627 
629  return ts_node__prev_sibling(self, true);
630 }
631 
633  return ts_node__prev_sibling(self, false);
634 }
635 
637  return ts_node__first_child_for_byte(self, byte, true);
638 }
639 
641  return ts_node__first_child_for_byte(self, byte, false);
642 }
643 
645  TSNode self,
646  uint32_t start,
647  uint32_t end
648 ) {
649  return ts_node__descendant_for_byte_range(self, start, end, true);
650 }
651 
653  TSNode self,
654  uint32_t start,
655  uint32_t end
656 ) {
657  return ts_node__descendant_for_byte_range(self, start, end, false);
658 }
659 
661  TSNode self,
662  TSPoint start,
663  TSPoint end
664 ) {
665  return ts_node__descendant_for_point_range(self, start, end, true);
666 }
667 
669  TSNode self,
670  TSPoint start,
671  TSPoint end
672 ) {
673  return ts_node__descendant_for_point_range(self, start, end, false);
674 }
675 
676 void ts_node_edit(TSNode *self, const TSInputEdit *edit) {
677  uint32_t start_byte = ts_node_start_byte(*self);
678  TSPoint start_point = ts_node_start_point(*self);
679 
680  if (start_byte >= edit->old_end_byte) {
681  start_byte = edit->new_end_byte + (start_byte - edit->old_end_byte);
682  start_point = point_add(edit->new_end_point, point_sub(start_point, edit->old_end_point));
683  } else if (start_byte > edit->start_byte) {
684  start_byte = edit->new_end_byte;
685  start_point = edit->new_end_point;
686  }
687 
688  self->context[0] = start_byte;
689  self->context[1] = start_point.row;
690  self->context[2] = start_point.column;
691 }
const MCPhysReg * iterator
lzma_index ** i
Definition: index.h:629
TSFieldId ts_language_field_id_for_name(const TSLanguage *, const char *, uint32_t)
Definition: language.c:119
const char * ts_language_symbol_name(const TSLanguage *, TSSymbol)
Definition: language.c:59
TSNode ts_tree_root_node(const TSTree *self)
Definition: tree.c:36
#define NULL
Definition: cris-opc.c:27
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
Definition: sflib.h:133
TSSymbol ts_language_public_symbol(const TSLanguage *self, TSSymbol symbol)
Definition: language.c:51
TSSymbolMetadata ts_language_symbol_metadata(const TSLanguage *self, TSSymbol symbol)
Definition: language.c:38
static void ts_language_field_map(const TSLanguage *self, uint32_t production_id, const TSFieldMapEntry **start, const TSFieldMapEntry **end)
Definition: language.h:246
static const TSSymbol * ts_language_alias_sequence(const TSLanguage *self, uint32_t production_id)
Definition: language.h:227
static Length length_zero(void)
Definition: length.h:39
static Length length_add(Length len1, Length len2)
Definition: length.h:25
bool ts_node_has_error(TSNode self)
Definition: node.c:457
static Subtree ts_node__subtree(TSNode self)
Definition: node.c:48
TSPoint ts_node_end_point(TSNode self)
Definition: node.c:410
bool ts_node_is_extra(TSNode self)
Definition: node.c:438
uint32_t ts_node_start_byte(TSNode self)
Definition: node.c:36
uint32_t ts_node_child_count(TSNode self)
Definition: node.c:602
TSNode ts_node_named_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end)
Definition: node.c:652
void ts_node_edit(TSNode *self, const TSInputEdit *edit)
Definition: node.c:676
TSNode ts_node_child(TSNode self, uint32_t child_index)
Definition: node.c:492
TSNode ts_node_child_by_field_name(TSNode self, const char *name, uint32_t name_length)
Definition: node.c:589
TSNode ts_node_next_named_sibling(TSNode self)
Definition: node.c:624
bool ts_node_is_missing(TSNode self)
Definition: node.c:449
static TSNode ts_node__prev_sibling(TSNode self, bool include_anonymous)
Definition: node.c:187
static TSNode ts_node__child(TSNode self, uint32_t child_index, bool include_anonymous)
Definition: node.c:136
TSNode ts_node_named_descendant_for_point_range(TSNode self, TSPoint start, TSPoint end)
Definition: node.c:668
static uint32_t ts_node__alias(const TSNode *self)
Definition: node.c:44
bool ts_node_has_changes(TSNode self)
Definition: node.c:453
TSNode ts_node_first_child_for_byte(TSNode self, uint32_t byte)
Definition: node.c:636
bool ts_node_is_named(TSNode self)
Definition: node.c:442
TSPoint ts_node_start_point(TSNode self)
Definition: node.c:40
TSNode ts_node_prev_sibling(TSNode self)
Definition: node.c:628
static TSNode ts_node__next_sibling(TSNode self, bool include_anonymous)
Definition: node.c:246
static bool ts_node_child_iterator_done(NodeChildIterator *self)
Definition: node.c:73
bool ts_node_is_null(TSNode self)
Definition: node.c:434
TSNode ts_node_child_by_field_id(TSNode self, TSFieldId field_id)
Definition: node.c:500
static bool ts_node__is_relevant(TSNode self, bool include_anonymous)
Definition: node.c:106
TSNode ts_node_prev_named_sibling(TSNode self)
Definition: node.c:632
static TSNode ts_node__descendant_for_byte_range(TSNode self, uint32_t range_start, uint32_t range_end, bool include_anonymous)
Definition: node.c:326
static bool ts_node_child_iterator_next(NodeChildIterator *self, TSNode *result)
Definition: node.c:77
const char * ts_node_type(TSNode self)
Definition: node.c:420
TSNode ts_node_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end)
Definition: node.c:644
static bool ts_subtree_has_trailing_empty_descendant(Subtree self, Subtree other)
Definition: node.c:173
static NodeChildIterator ts_node_iterate_children(const TSNode *node)
Definition: node.c:54
TSNode ts_node_descendant_for_point_range(TSNode self, TSPoint start, TSPoint end)
Definition: node.c:660
static TSNode ts_node__descendant_for_point_range(TSNode self, TSPoint range_start, TSPoint range_end, bool include_anonymous)
Definition: node.c:365
static uint32_t ts_node__relevant_child_count(TSNode self, bool include_anonymous)
Definition: node.c:120
char * ts_node_string(TSNode self)
Definition: node.c:426
TSNode ts_node_next_sibling(TSNode self)
Definition: node.c:620
TSNode ts_node_first_named_child_for_byte(TSNode self, uint32_t byte)
Definition: node.c:640
uint32_t ts_node_named_child_count(TSNode self)
Definition: node.c:611
uint32_t ts_node_end_byte(TSNode self)
Definition: node.c:406
const char * ts_node_field_name_for_child(TSNode self, uint32_t child_index)
Definition: node.c:572
static TSNode ts_node__first_child_for_byte(TSNode self, uint32_t goal, bool include_anonymous)
Definition: node.c:297
static TSNode ts_node__null(void)
Definition: node.c:30
TSNode ts_node_named_child(TSNode self, uint32_t child_index)
Definition: node.c:496
TSNode ts_node_new(const TSTree *tree, const Subtree *subtree, Length position, TSSymbol alias)
Definition: node.c:17
TSNode ts_node_parent(TSNode self)
Definition: node.c:461
bool ts_node_eq(TSNode self, TSNode other)
Definition: node.c:430
TSSymbol ts_node_symbol(TSNode self)
Definition: node.c:414
static TSPoint point_sub(TSPoint a, TSPoint b)
Definition: point.h:21
static bool point_lt(TSPoint a, TSPoint b)
Definition: point.h:32
static TSPoint point_add(TSPoint a, TSPoint b)
Definition: point.h:14
static bool point_lte(TSPoint a, TSPoint b)
Definition: point.h:28
@ field_id
Definition: parser.c:1736
uint16_t TSFieldId
Definition: parser.h:20
uint16_t TSSymbol
Definition: parser.h:19
unsigned int uint32_t
Definition: sftypes.h:29
Definition: length.h:9
uint32_t bytes
Definition: length.h:10
TSPoint extent
Definition: length.h:11
uint32_t child_index
Definition: node.c:10
const TSSymbol * alias_sequence
Definition: node.c:12
uint32_t structural_child_index
Definition: node.c:11
Subtree parent
Definition: node.c:7
const TSTree * tree
Definition: node.c:8
Length position
Definition: node.c:9
uint32_t visible_child_count
Definition: subtree.h:135
uint32_t named_child_count
Definition: subtree.h:136
uint16_t production_id
Definition: subtree.h:140
bool inherited
Definition: parser.h:27
TSFieldId field_id
Definition: parser.h:25
uint32_t old_end_byte
Definition: api.h:85
uint32_t start_byte
Definition: api.h:84
uint32_t new_end_byte
Definition: api.h:86
TSPoint old_end_point
Definition: api.h:88
TSPoint new_end_point
Definition: api.h:89
Definition: api.h:92
const TSTree * tree
Definition: api.h:95
const void * id
Definition: api.h:94
Definition: api.h:55
uint32_t row
Definition: api.h:56
uint32_t column
Definition: api.h:57
Definition: tree.h:15
const TSLanguage * language
Definition: tree.h:17
Definition: z80asm.h:102
char * ts_subtree_string(Subtree self, const TSLanguage *language, bool include_all)
Definition: subtree.c:947
#define ts_subtree_children(self)
Definition: subtree.h:233
static bool ts_subtree_visible(Subtree self)
Definition: subtree.h:214
static uint32_t ts_subtree_total_bytes(Subtree self)
Definition: subtree.h:278
static uint32_t ts_subtree_error_cost(Subtree self)
Definition: subtree.h:302
static bool ts_subtree_extra(Subtree self)
Definition: subtree.h:216
static bool ts_subtree_has_changes(Subtree self)
Definition: subtree.h:217
static bool ts_subtree_missing(Subtree self)
Definition: subtree.h:218
static Length ts_subtree_size(Subtree self)
Definition: subtree.h:265
static bool ts_subtree_named(Subtree self)
Definition: subtree.h:215
static uint32_t ts_subtree_child_count(Subtree self)
Definition: subtree.h:282
#define NULL_SUBTREE
Definition: subtree.h:19
static Length ts_subtree_padding(Subtree self)
Definition: subtree.h:256
static TSSymbol ts_subtree_symbol(Subtree self)
Definition: subtree.h:213
const SubtreeHeapData * ptr
Definition: subtree.h:158