Class: TreeSitter::TextPredicateCapture

Inherits:
Object
  • Object
show all
Defined in:
lib/tree_sitter/text_predicate_capture.rb

Overview

A representation for text predicates.

Constant Summary collapse

EQ_CAPTURE =

Equality Capture

0
EQ_STRING =

Equality String

1
MATCH_STRING =

Match String

2
ANY_STRING =

Any String

3

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, fst, snd, positive, match_all) ⇒ TextPredicateCapture

Returns a new instance of TextPredicateCapture.



24
25
26
27
28
29
30
# File 'lib/tree_sitter/text_predicate_capture.rb', line 24

def initialize(type, fst, snd, positive, match_all)
  @type = type
  @fst = fst
  @snd = snd
  @positive = positive
  @match_all = match_all
end

Instance Attribute Details

#fstObject (readonly)

Returns the value of attribute fst.



11
12
13
# File 'lib/tree_sitter/text_predicate_capture.rb', line 11

def fst
  @fst
end

#sndObject (readonly)

Returns the value of attribute snd.



12
13
14
# File 'lib/tree_sitter/text_predicate_capture.rb', line 12

def snd
  @snd
end

#typeObject (readonly)

Returns the value of attribute type.



13
14
15
# File 'lib/tree_sitter/text_predicate_capture.rb', line 13

def type
  @type
end

Class Method Details

.any_stringObject

Create a TextPredicateCapture for ANY_STRING.



22
# File 'lib/tree_sitter/text_predicate_capture.rb', line 22

def self.any_string(...) = new(ANY_STRING, ...)

.eq_captureObject

Create a TextPredicateCapture for EQ_CAPTURE.



16
17
# File 'lib/tree_sitter/text_predicate_capture.rb', line 16

def self.eq_capture(...) = new(EQ_CAPTURE, ...)
# Create a TextPredicateCapture for {EQ_STRING}.

.eq_stringObject

Create a TextPredicateCapture for EQ_STRING.



18
19
# File 'lib/tree_sitter/text_predicate_capture.rb', line 18

def self.eq_string(...) = new(EQ_STRING, ...)
# Create a TextPredicateCapture for {MATCH_STRING}.

.match_stringObject

Create a TextPredicateCapture for MATCH_STRING.



20
21
# File 'lib/tree_sitter/text_predicate_capture.rb', line 20

def self.match_string(...) = new(MATCH_STRING, ...)
# Create a TextPredicateCapture for {ANY_STRING}.

Instance Method Details

#match_all?Boolean

‘#any-` means don’t match all.

Returns:

  • (Boolean)


35
# File 'lib/tree_sitter/text_predicate_capture.rb', line 35

def match_all? = @match_all

#positive?Boolean

‘#eq` is positive, `#not-eq` is not.

Returns:

  • (Boolean)


33
34
# File 'lib/tree_sitter/text_predicate_capture.rb', line 33

def positive? = @positive
# `#any-` means don't match all.