ruby_tree_sitter 1.1.0-arm64-darwin-22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +199 -0
  4. data/ext/tree_sitter/encoding.c +29 -0
  5. data/ext/tree_sitter/extconf.rb +149 -0
  6. data/ext/tree_sitter/input.c +127 -0
  7. data/ext/tree_sitter/input_edit.c +42 -0
  8. data/ext/tree_sitter/language.c +219 -0
  9. data/ext/tree_sitter/logger.c +228 -0
  10. data/ext/tree_sitter/macros.h +163 -0
  11. data/ext/tree_sitter/node.c +618 -0
  12. data/ext/tree_sitter/parser.c +398 -0
  13. data/ext/tree_sitter/point.c +26 -0
  14. data/ext/tree_sitter/quantifier.c +43 -0
  15. data/ext/tree_sitter/query.c +282 -0
  16. data/ext/tree_sitter/query_capture.c +28 -0
  17. data/ext/tree_sitter/query_cursor.c +215 -0
  18. data/ext/tree_sitter/query_error.c +41 -0
  19. data/ext/tree_sitter/query_match.c +44 -0
  20. data/ext/tree_sitter/query_predicate_step.c +83 -0
  21. data/ext/tree_sitter/range.c +35 -0
  22. data/ext/tree_sitter/repo.rb +121 -0
  23. data/ext/tree_sitter/symbol_type.c +46 -0
  24. data/ext/tree_sitter/tree.c +234 -0
  25. data/ext/tree_sitter/tree_cursor.c +269 -0
  26. data/ext/tree_sitter/tree_sitter.c +44 -0
  27. data/ext/tree_sitter/tree_sitter.h +107 -0
  28. data/lib/tree_sitter/node.rb +197 -0
  29. data/lib/tree_sitter/tree_sitter.bundle +0 -0
  30. data/lib/tree_sitter/version.rb +8 -0
  31. data/lib/tree_sitter.rb +14 -0
  32. data/lib/tree_stand/ast_modifier.rb +30 -0
  33. data/lib/tree_stand/breadth_first_visitor.rb +54 -0
  34. data/lib/tree_stand/config.rb +13 -0
  35. data/lib/tree_stand/node.rb +224 -0
  36. data/lib/tree_stand/parser.rb +67 -0
  37. data/lib/tree_stand/range.rb +55 -0
  38. data/lib/tree_stand/tree.rb +123 -0
  39. data/lib/tree_stand/utils/printer.rb +73 -0
  40. data/lib/tree_stand/version.rb +7 -0
  41. data/lib/tree_stand/visitor.rb +127 -0
  42. data/lib/tree_stand/visitors/tree_walker.rb +37 -0
  43. data/lib/tree_stand.rb +48 -0
  44. data/tree_sitter.gemspec +35 -0
  45. metadata +124 -0
@@ -0,0 +1,618 @@
1
+ #include "tree_sitter.h"
2
+ #include "tree_sitter/api.h"
3
+
4
+ extern VALUE mTreeSitter;
5
+
6
+ VALUE cNode;
7
+
8
+ DATA_TYPE(TSNode, node)
9
+
10
+ static void node_free(void *ptr) {
11
+ node_t *type = (node_t *)ptr;
12
+ tree_rc_free(type->data.tree);
13
+ xfree(ptr);
14
+ }
15
+
16
+ DATA_MEMSIZE(node)
17
+ DATA_DECLARE_DATA_TYPE(node)
18
+ DATA_ALLOCATE(node)
19
+ DATA_UNWRAP(node)
20
+
21
+ VALUE new_node(const TSNode *ptr) {
22
+ if (ptr == NULL) {
23
+ return Qnil;
24
+ }
25
+ VALUE res = node_allocate(cNode);
26
+ node_t *type = unwrap(res);
27
+ type->data = *ptr;
28
+ tree_rc_new(type->data.tree);
29
+ return res;
30
+ }
31
+ VALUE new_node_by_val(TSNode ptr) {
32
+ VALUE res = node_allocate(cNode);
33
+ node_t *type = unwrap(res);
34
+ type->data = ptr;
35
+ tree_rc_new(type->data.tree);
36
+ return res;
37
+ }
38
+
39
+ DATA_FROM_VALUE(TSNode, node)
40
+
41
+ /**
42
+ * Check if two nodes are identical.
43
+ *
44
+ * @param other [Node]
45
+ *
46
+ * @return [Boolean]
47
+ */
48
+ static VALUE node_eq(VALUE self, VALUE other) {
49
+ return ts_node_eq(SELF, unwrap(other)->data) ? Qtrue : Qfalse;
50
+ }
51
+
52
+ /**
53
+ * Get an S-expression representing the node as a string.
54
+ *
55
+ * @return [String]
56
+ */
57
+ static VALUE node_string(VALUE self) {
58
+ char *str = ts_node_string(SELF);
59
+ VALUE res = safe_str(str);
60
+ if (str) {
61
+ free(str);
62
+ }
63
+ return res;
64
+ }
65
+
66
+ /**
67
+ * Check if a syntax node has been edited.
68
+ *
69
+ * @return [Boolean]
70
+ */
71
+ static VALUE node_has_changes(VALUE self) {
72
+ return ts_node_has_changes(SELF) ? Qtrue : Qfalse;
73
+ }
74
+
75
+ /**
76
+ * Check if the node is a syntax error or contains any syntax errors.
77
+ *
78
+ * @return [Boolean]
79
+ */
80
+ static VALUE node_has_error(VALUE self) {
81
+ return ts_node_has_error(SELF) ? Qtrue : Qfalse;
82
+ }
83
+
84
+ /**
85
+ * Check if the node is a syntax error.
86
+ *
87
+ * @return [Boolean]
88
+ */
89
+ VALUE node_is_error(VALUE self) {
90
+ return ts_node_is_error(SELF) ? Qtrue : Qfalse;
91
+ }
92
+
93
+ /**
94
+ * Check if the node is *named*. Named nodes correspond to named rules in the
95
+ * grammar, whereas *anonymous* nodes correspond to string literals in the
96
+ * grammar.
97
+ *
98
+ * @return [Boolean]
99
+ */
100
+ static VALUE node_is_named(VALUE self) {
101
+ return ts_node_is_named(SELF) ? Qtrue : Qfalse;
102
+ }
103
+
104
+ /**
105
+ * Check if the node is null. Functions like {Node#child} and
106
+ * {Node#next_sibling} will return a null node to indicate that no such node
107
+ * was found.
108
+ *
109
+ * @return [Boolean]
110
+ */
111
+ static VALUE node_is_null(VALUE self) {
112
+ return ts_node_is_null(SELF) ? Qtrue : Qfalse;
113
+ }
114
+
115
+ /**
116
+ * Check if the node is *extra*. Extra nodes represent things like comments,
117
+ * which are not required the grammar, but can appear anywhere.
118
+ *
119
+ * @return [Boolean]
120
+ */
121
+ static VALUE node_is_extra(VALUE self) {
122
+ return ts_node_is_extra(SELF) ? Qtrue : Qfalse;
123
+ }
124
+ /**
125
+ * Check if the node is *missing*. Missing nodes are inserted by the parser in
126
+ * order to recover from certain kinds of syntax errors.
127
+ *
128
+ * @return [Boolean]
129
+ */
130
+ static VALUE node_is_missing(VALUE self) {
131
+ return ts_node_is_missing(SELF) ? Qtrue : Qfalse;
132
+ }
133
+
134
+ /**
135
+ * Get the node's child at the given index, where zero represents the first
136
+ * child.
137
+ *
138
+ * @raise [IndexError] if out of range.
139
+ *
140
+ * @return [Node]
141
+ */
142
+ static VALUE node_child(VALUE self, VALUE idx) {
143
+ TSNode node = SELF;
144
+ uint32_t index = NUM2UINT(idx);
145
+ uint32_t range = ts_node_child_count(node);
146
+
147
+ if (index < range) {
148
+ return new_node_by_val(ts_node_child(node, index));
149
+ } else {
150
+ rb_raise(rb_eIndexError, "Index %d is out of range (len = %d)", index,
151
+ range);
152
+ }
153
+ }
154
+
155
+ /**
156
+ * Get the node's child with the given numerical field id.
157
+ *
158
+ * You can convert a field name to an id using {Language#field_id_for_name}.
159
+ *
160
+ * @return [Node]
161
+ */
162
+ static VALUE node_child_by_field_id(VALUE self, VALUE field_id) {
163
+ return new_node_by_val(ts_node_child_by_field_id(SELF, NUM2UINT(field_id)));
164
+ }
165
+
166
+ /**
167
+ * Get the node's child with the given field name.
168
+ *
169
+ * @param field_name [String]
170
+ *
171
+ * @return [Node]
172
+ */
173
+ static VALUE node_child_by_field_name(VALUE self, VALUE field_name) {
174
+ const char *name = StringValuePtr(field_name);
175
+ uint32_t length = (uint32_t)RSTRING_LEN(field_name);
176
+ return new_node_by_val(ts_node_child_by_field_name(SELF, name, length));
177
+ }
178
+
179
+ /**
180
+ * Get the node's number of children.
181
+ *
182
+ * @return [Integer]
183
+ */
184
+ static VALUE node_child_count(VALUE self) {
185
+ TSNode node = SELF;
186
+ const char *type = ts_node_type(node);
187
+ if (strcmp(type, "end") == 0) {
188
+ return UINT2NUM(0);
189
+ } else {
190
+ return UINT2NUM(ts_node_child_count(SELF));
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Get the node's number of descendants, including one for the node itself.
196
+ *
197
+ * @return [Integer]
198
+ */
199
+ VALUE node_descendant_count(VALUE self) {
200
+ return UINT2NUM(ts_node_descendant_count(SELF));
201
+ }
202
+
203
+ /**
204
+ * Get the smallest node within this node that spans the given range of byte
205
+ * positions.
206
+ *
207
+ * @raise [IndexError] if out of range.
208
+ *
209
+ * @param from [Integer]
210
+ * @param to [Integer]
211
+ *
212
+ * @return [Node]
213
+ */
214
+ static VALUE node_descendant_for_byte_range(VALUE self, VALUE from, VALUE to) {
215
+ uint32_t from_b = NUM2UINT(from);
216
+ uint32_t to_b = NUM2UINT(to);
217
+
218
+ if (from_b > to_b) {
219
+ rb_raise(rb_eIndexError, "From > To: %d > %d", from_b, to_b);
220
+ } else {
221
+ return new_node_by_val(
222
+ ts_node_descendant_for_byte_range(SELF, from_b, to_b));
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Get the smallest node within this node that spans the given range of
228
+ * (row, column) positions.
229
+ *
230
+ * @raise [IndexError] if out of range.
231
+ *
232
+ * @param from [Point]
233
+ * @param to [Point]
234
+ *
235
+ * @return [Node]
236
+ */
237
+ static VALUE node_descendant_for_point_range(VALUE self, VALUE from, VALUE to) {
238
+ TSNode node = SELF;
239
+ TSPoint start = ts_node_start_point(node);
240
+ TSPoint end = ts_node_end_point(node);
241
+ TSPoint f = value_to_point(from);
242
+ TSPoint t = value_to_point(to);
243
+
244
+ if ((f.row < start.row) || (t.row > end.row) ||
245
+ (f.row == start.row && (f.column < start.column)) ||
246
+ (t.row == end.row && (t.column > end.column))) {
247
+ rb_raise(rb_eIndexError,
248
+ "Invalid point range: [%+" PRIsVALUE ", %+" PRIsVALUE
249
+ "] is not in [%+" PRIsVALUE ", %+" PRIsVALUE "].",
250
+ from, to, new_point(&start), new_point(&end));
251
+ } else {
252
+ return new_node_by_val(ts_node_descendant_for_point_range(node, f, t));
253
+ }
254
+ }
255
+
256
+ /**
257
+ * Edit the node to keep it in-sync with source code that has been edited.
258
+ *
259
+ * This function is only rarely needed. When you edit a syntax tree with the
260
+ * {Tree#edit} function, all of the nodes that you retrieve from the tree
261
+ * afterward will already reflect the edit. You only need to use {Node#edit}
262
+ * when you have a {Node} instance that you want to keep and continue to use
263
+ * after an edit.
264
+ *
265
+ * @param input_edit [InputEdit]
266
+ *
267
+ * @return [nil]
268
+ */
269
+ static VALUE node_edit(VALUE self, VALUE input_edit) {
270
+ TSNode node = SELF;
271
+ TSInputEdit edit = value_to_input_edit(input_edit);
272
+ ts_node_edit(&node, &edit);
273
+
274
+ return Qnil;
275
+ }
276
+
277
+ /**
278
+ * Get the node's end byte.
279
+ *
280
+ * @return [Integer]
281
+ */
282
+ static VALUE node_end_byte(VALUE self) {
283
+ return UINT2NUM(ts_node_end_byte(SELF));
284
+ }
285
+
286
+ /**
287
+ * Get the node's end position in terms of rows and columns.
288
+ *
289
+ * @return [Point]
290
+ */
291
+ static VALUE node_end_point(VALUE self) {
292
+ return new_point_by_val(ts_node_end_point(SELF));
293
+ }
294
+
295
+ /**
296
+ * Get the field name for node's child at the given index, where zero represents
297
+ * the first child.
298
+ *
299
+ * @raise [IndexError] if out of range.
300
+ *
301
+ * @return [String]
302
+ */
303
+ static VALUE node_field_name_for_child(VALUE self, VALUE idx) {
304
+ // FIXME: the original API returns nil if no name was found, but I made it
305
+ // raise an exception like `node_child` for consistency. The latter was made
306
+ // this way to avoid segfault. Should we absolutely stick to the original API?
307
+ TSNode node = SELF;
308
+ uint32_t index = NUM2UINT(idx);
309
+ uint32_t range = ts_node_child_count(node);
310
+
311
+ if (index < range) {
312
+ return safe_str(ts_node_field_name_for_child(node, index));
313
+ } else {
314
+ rb_raise(rb_eIndexError, "Index %d is out of range (len = %d)", index,
315
+ range);
316
+ }
317
+ }
318
+
319
+ /**
320
+ * Get the node's first child that extends beyond the given byte offset.
321
+ *
322
+ * @param byte [Integer]
323
+ *
324
+ * @return [Node]
325
+ */
326
+ static VALUE node_first_child_for_byte(VALUE self, VALUE byte) {
327
+ return new_node_by_val(ts_node_first_child_for_byte(SELF, NUM2UINT(byte)));
328
+ }
329
+
330
+ /**
331
+ * Get the node's first named child that extends beyond the given byte offset.
332
+ *
333
+ * @param byte [Integer]
334
+ *
335
+ * @return [Node]
336
+ */
337
+ static VALUE node_first_named_child_for_byte(VALUE self, VALUE byte) {
338
+ return new_node_by_val(
339
+ ts_node_first_named_child_for_byte(SELF, NUM2UINT(byte)));
340
+ }
341
+
342
+ /**
343
+ * Get the node's type as a numerical id as it appears in the grammar ignoring
344
+ * aliases. This should be used in {Language#next_state} instead of
345
+ * {Node#symbol}.
346
+ *
347
+ * @return [Integer]
348
+ */
349
+ VALUE node_grammar_symbol(VALUE self) {
350
+ return UINT2NUM(ts_node_grammar_symbol(SELF));
351
+ }
352
+
353
+ /**
354
+ * Get the node's type as it appears in the grammar ignoring aliases as a
355
+ * null-terminated string.
356
+ *
357
+ * @return String
358
+ */
359
+ VALUE node_grammar_type(VALUE self) {
360
+ return safe_str(ts_node_grammar_type(SELF));
361
+ }
362
+
363
+ /**
364
+ * Get the node's language.
365
+ *
366
+ * @return [Language]
367
+ */
368
+ static VALUE node_language(VALUE self) {
369
+ return new_language(ts_node_language(SELF));
370
+ }
371
+
372
+ /**
373
+ * Get the smallest *named* node within this node that spans the given range of
374
+ * byte positions.
375
+ *
376
+ * @raise [IndexError] if out of range.
377
+ *
378
+ * @param from [Integer]
379
+ * @param to [Integer]
380
+ *
381
+ * @return [Node]
382
+ */
383
+ static VALUE node_named_descendant_for_byte_range(VALUE self, VALUE from,
384
+ VALUE to) {
385
+ uint32_t from_b = NUM2UINT(from);
386
+ uint32_t to_b = NUM2UINT(to);
387
+
388
+ if (from_b > to_b) {
389
+ rb_raise(rb_eIndexError, "From > To: %d > %d", from_b, to_b);
390
+ } else {
391
+ return new_node_by_val(
392
+ ts_node_named_descendant_for_byte_range(SELF, from_b, to_b));
393
+ }
394
+ }
395
+
396
+ /**
397
+ * Get the smallest *named* node within this node that spans the given range of
398
+ * (row, column) positions.
399
+ *
400
+ * @raise [IndexError] if out of range.
401
+ *
402
+ * @param from [Point]
403
+ * @param to [Point]
404
+ *
405
+ * @return [Node]
406
+ */
407
+ static VALUE node_named_descendant_for_point_range(VALUE self, VALUE from,
408
+ VALUE to) {
409
+ TSNode node = SELF;
410
+ TSPoint start = ts_node_start_point(node);
411
+ TSPoint end = ts_node_end_point(node);
412
+ TSPoint f = value_to_point(from);
413
+ TSPoint t = value_to_point(to);
414
+
415
+ if ((f.row < start.row) || (t.row > end.row) ||
416
+ (f.row == start.row && (f.column < start.column)) ||
417
+ (t.row == end.row && (t.column > end.column))) {
418
+ rb_raise(rb_eIndexError,
419
+ "Invalid point range: [%+" PRIsVALUE ", %+" PRIsVALUE
420
+ "] is not in [%+" PRIsVALUE ", %+" PRIsVALUE "].",
421
+ from, to, new_point(&start), new_point(&end));
422
+ } else {
423
+ return new_node_by_val(
424
+ ts_node_named_descendant_for_point_range(node, f, t));
425
+ }
426
+ }
427
+
428
+ /**
429
+ * Get the node's *named* child at the given index.
430
+ *
431
+ * @see named?
432
+ *
433
+ * @param idx [Integer]
434
+ *
435
+ * @raise [IndexError] if out of range.
436
+ *
437
+ * @return [Node]
438
+ */
439
+ static VALUE node_named_child(VALUE self, VALUE idx) {
440
+ // FIXME: see notes in `node_field_name_for_child`
441
+ TSNode node = SELF;
442
+ uint32_t index = NUM2UINT(idx);
443
+ uint32_t range = ts_node_named_child_count(node);
444
+
445
+ if (index < range) {
446
+ return new_node_by_val(ts_node_named_child(node, index));
447
+ } else {
448
+ rb_raise(rb_eIndexError, "Index %d is out of range (len = %d)", index,
449
+ range);
450
+ }
451
+ }
452
+
453
+ /**
454
+ * Get the node's number of *named* children.
455
+ *
456
+ * @see named?
457
+ *
458
+ * @return [Integer]
459
+ */
460
+ static VALUE node_named_child_count(VALUE self) {
461
+ return UINT2NUM(ts_node_named_child_count(SELF));
462
+ }
463
+
464
+ /**
465
+ * Get the node's next *named* sibling.
466
+ *
467
+ * @return [Node]
468
+ */
469
+ static VALUE node_next_named_sibling(VALUE self) {
470
+ return new_node_by_val(ts_node_next_named_sibling(SELF));
471
+ }
472
+
473
+ /**
474
+ * Get the node's next sibling.
475
+ *
476
+ * @return [Node]
477
+ */
478
+ static VALUE node_next_sibling(VALUE self) {
479
+ return new_node_by_val(ts_node_next_sibling(SELF));
480
+ }
481
+
482
+ /**
483
+ * Get the parse state after this node.
484
+ *
485
+ * @return [Integer]
486
+ */
487
+ VALUE node_next_parse_state(VALUE self) {
488
+ return UINT2NUM(ts_node_next_parse_state(SELF));
489
+ }
490
+
491
+ /**
492
+ * Get the node's immediate parent.
493
+ *
494
+ * @return [Node]
495
+ */
496
+ static VALUE node_parent(VALUE self) {
497
+ return new_node_by_val(ts_node_parent(SELF));
498
+ }
499
+
500
+ /**
501
+ * Get the node's previous *named* sibling.
502
+ *
503
+ * @return [Node]
504
+ */
505
+ static VALUE node_prev_named_sibling(VALUE self) {
506
+ return new_node_by_val(ts_node_prev_named_sibling(SELF));
507
+ }
508
+
509
+ /**
510
+ * Get the node's previous sibling.
511
+ *
512
+ * @return [Node]
513
+ */
514
+ static VALUE node_prev_sibling(VALUE self) {
515
+ return new_node_by_val(ts_node_prev_sibling(SELF));
516
+ }
517
+
518
+ /**
519
+ * Get the node's start byte.
520
+ *
521
+ * @return [Integer]
522
+ */
523
+ static VALUE node_start_byte(VALUE self) {
524
+ return UINT2NUM(ts_node_start_byte(SELF));
525
+ }
526
+
527
+ /**
528
+ * Get the node's start position in terms of rows and columns.
529
+ *
530
+ * @return [Point]
531
+ */
532
+ static VALUE node_start_point(VALUE self) {
533
+ return new_point_by_val(ts_node_start_point(SELF));
534
+ }
535
+
536
+ /**
537
+ * Get this node's parse state.
538
+ *
539
+ * @return [Integer]
540
+ */
541
+ VALUE node_parse_state(VALUE self) {
542
+ return UINT2NUM(ts_node_parse_state(SELF));
543
+ }
544
+
545
+ /**
546
+ * Get the node's type as a numerical id.
547
+ *
548
+ * @return [Integer]
549
+ */
550
+ static VALUE node_symbol(VALUE self) { return UINT2NUM(ts_node_symbol(SELF)); }
551
+
552
+ /**
553
+ * Get the node's type as a null-terminated string.
554
+ *
555
+ * @return [Symbol]
556
+ */
557
+ static VALUE node_type(VALUE self) { return safe_symbol(ts_node_type(SELF)); }
558
+
559
+ void init_node(void) {
560
+ cNode = rb_define_class_under(mTreeSitter, "Node", rb_cObject);
561
+
562
+ rb_undef_alloc_func(cNode);
563
+
564
+ /* Builtins */
565
+ rb_define_method(cNode, "eq?", node_eq, 1);
566
+ rb_define_method(cNode, "to_s", node_string, 0);
567
+ rb_define_method(cNode, "to_str", node_string, 0);
568
+ rb_define_method(cNode, "inspect", node_string, 0);
569
+ rb_define_method(cNode, "==", node_eq, 1);
570
+
571
+ /* Class methods */
572
+ // Predicates
573
+ rb_define_method(cNode, "changed?", node_has_changes, 0);
574
+ rb_define_method(cNode, "error?", node_is_error, 0);
575
+ rb_define_method(cNode, "has_error?", node_has_error, 0);
576
+ rb_define_method(cNode, "missing?", node_is_missing, 0);
577
+ rb_define_method(cNode, "named?", node_is_named, 0);
578
+ rb_define_method(cNode, "null?", node_is_null, 0);
579
+ rb_define_method(cNode, "extra?", node_is_extra, 0);
580
+
581
+ // Other
582
+ rb_define_method(cNode, "child", node_child, 1);
583
+ rb_define_method(cNode, "child_by_field_id", node_child_by_field_id, 1);
584
+ rb_define_method(cNode, "child_by_field_name", node_child_by_field_name, 1);
585
+ rb_define_method(cNode, "child_count", node_child_count, 0);
586
+ rb_define_method(cNode, "descendant_count", node_descendant_count, 0);
587
+ rb_define_method(cNode, "descendant_for_byte_range",
588
+ node_descendant_for_byte_range, 2);
589
+ rb_define_method(cNode, "descendant_for_point_range",
590
+ node_descendant_for_point_range, 2);
591
+ rb_define_method(cNode, "edit", node_edit, 1);
592
+ rb_define_method(cNode, "end_byte", node_end_byte, 0);
593
+ rb_define_method(cNode, "end_point", node_end_point, 0);
594
+ rb_define_method(cNode, "field_name_for_child", node_field_name_for_child, 1);
595
+ rb_define_method(cNode, "first_child_for_byte", node_first_child_for_byte, 1);
596
+ rb_define_method(cNode, "first_named_child_for_byte",
597
+ node_first_named_child_for_byte, 1);
598
+ rb_define_method(cNode, "grammar_symbol", node_grammar_symbol, 0);
599
+ rb_define_method(cNode, "grammar_type", node_grammar_type, 0);
600
+ rb_define_method(cNode, "language", node_language, 0);
601
+ rb_define_method(cNode, "named_child", node_named_child, 1);
602
+ rb_define_method(cNode, "named_child_count", node_named_child_count, 0);
603
+ rb_define_method(cNode, "named_descendant_for_byte_range",
604
+ node_named_descendant_for_byte_range, 2);
605
+ rb_define_method(cNode, "named_descendant_for_point_range",
606
+ node_named_descendant_for_point_range, 2);
607
+ rb_define_method(cNode, "next_named_sibling", node_next_named_sibling, 0);
608
+ rb_define_method(cNode, "next_parse_state", node_next_parse_state, 0);
609
+ rb_define_method(cNode, "next_sibling", node_next_sibling, 0);
610
+ rb_define_method(cNode, "parent", node_parent, 0);
611
+ rb_define_method(cNode, "parse_state", node_parse_state, 0);
612
+ rb_define_method(cNode, "prev_named_sibling", node_prev_named_sibling, 0);
613
+ rb_define_method(cNode, "prev_sibling", node_prev_sibling, 0);
614
+ rb_define_method(cNode, "start_byte", node_start_byte, 0);
615
+ rb_define_method(cNode, "start_point", node_start_point, 0);
616
+ rb_define_method(cNode, "symbol", node_symbol, 0);
617
+ rb_define_method(cNode, "type", node_type, 0);
618
+ }