Class: TreeSitter::QueryCursor

Inherits:
Object
  • Object
show all
Defined in:
ext/tree_sitter/query_cursor.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.execObject

Class methods

Instance Method Details

#exceed_match_limit?Boolean



30
31
32
# File 'ext/tree_sitter/query_cursor.c', line 30

static VALUE query_cursor_did_exceed_match_limit(VALUE self) {
  return ts_query_cursor_did_exceed_match_limit(SELF) ? Qtrue : Qfalse;
}

#next_captureObject

inefficient.



73
74
75
76
77
78
79
80
81
82
83
84
# File 'ext/tree_sitter/query_cursor.c', line 73

static VALUE query_cursor_next_capture(VALUE self) {
  TSQueryMatch match;
  uint32_t index;
  if (ts_query_cursor_next_capture(SELF, &match, &index)) {
    VALUE res = rb_ary_new_capa(2);
    rb_ary_push(res, UINT2NUM(index));
    rb_ary_push(res, new_query_match(&match));
    return res;
  } else {
    return Qnil;
  }
}

#next_matchObject



54
55
56
57
58
59
60
61
# File 'ext/tree_sitter/query_cursor.c', line 54

static VALUE query_cursor_next_match(VALUE self) {
  TSQueryMatch match;
  if (ts_query_cursor_next_match(SELF, &match)) {
    return new_query_match(&match);
  } else {
    return Qnil;
  }
}

#remove_match(id) ⇒ Object



63
64
65
66
# File 'ext/tree_sitter/query_cursor.c', line 63

static VALUE query_cursor_remove_match(VALUE self, VALUE id) {
  ts_query_cursor_remove_match(SELF, NUM2UINT(id));
  return Qnil;
}

#set_byte_range(from, to) ⇒ Object



43
44
45
46
# File 'ext/tree_sitter/query_cursor.c', line 43

static VALUE query_cursor_set_byte_range(VALUE self, VALUE from, VALUE to) {
  ts_query_cursor_set_byte_range(SELF, NUM2UINT(from), NUM2UINT(to));
  return Qnil;
}

#set_point_range(from, to) ⇒ Object



48
49
50
51
52
# File 'ext/tree_sitter/query_cursor.c', line 48

static VALUE query_cursor_set_point_range(VALUE self, VALUE from, VALUE to) {
  ts_query_cursor_set_point_range(SELF, value_to_point(from),
                                  value_to_point(to));
  return Qnil;
}