Class: Parser::Source::Range
- Includes:
- Comparable
- Defined in:
- sorbet/rbi/parser@3.3.7.4.rbi
Overview
A range of characters in a particular source buffer.
The range is always exclusive, i.e. a range with begin_pos
of 3 and
end_pos
of 5 will contain the following characters:
example
^^
source://parser//lib/parser/source/range.rb#26
Instance Method Summary collapse
-
#adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)) ⇒ Range
by the given amount(s).
-
#begin ⇒ Range
source://parser//lib/parser/source/range.rb#55.
-
#begin_pos ⇒ Integer
source://parser//lib/parser/source/range.rb#30.
-
#column ⇒ Integer
source://parser//lib/parser/source/range.rb#92.
-
#column_range ⇒ ::Range
source://parser//lib/parser/source/range.rb#114.
-
#contained?(other) ⇒ Boolean
Return
other.contains?(self)
. -
#contains?(other) ⇒ Boolean
Returns true iff this range contains (strictly)
other
. -
#crossing?(other) ⇒ Boolean
Returns true iff both ranges intersect and also have different elements from one another.
-
#disjoint?(other) ⇒ Boolean
Return
true
iff this range andother
are disjoint. -
#empty? ⇒ Boolean
Checks if a range is empty; if it contains no characters.
-
#end ⇒ Range
source://parser//lib/parser/source/range.rb#63.
-
#end_pos ⇒ Integer
source://parser//lib/parser/source/range.rb#30.
-
#first_line ⇒ Integer
Line number of the beginning of this range.
-
#initialize(source_buffer, begin_pos, end_pos) ⇒ Range
constructor
source://parser//lib/parser/source/range.rb#37.
-
#intersect(other) ⇒ Range
source://parser//lib/parser/source/range.rb#220.
-
#is?(*what) ⇒ Boolean
is?
provides a concise way to compare the source corresponding to this range. -
#join(other) ⇒ Range
source://parser//lib/parser/source/range.rb#209.
-
#last_column ⇒ Integer
source://parser//lib/parser/source/range.rb#106.
-
#last_line ⇒ Integer
source://parser//lib/parser/source/range.rb#99.
-
#length ⇒ Integer
source://parser//lib/parser/source/range.rb#70.
-
#line ⇒ Integer
Line number of the beginning of this range.
-
#overlaps?(other) ⇒ Boolean
Return
true
iff this range is not disjoint fromother
. -
#resize(new_size) ⇒ Range
source://parser//lib/parser/source/range.rb#201.
-
#size ⇒ Integer
source://parser//lib/parser/source/range.rb#70.
-
#source ⇒ String
source://parser//lib/parser/source/range.rb#132.
-
#source_buffer ⇒ Parser::Source::Buffer
source://parser//lib/parser/source/range.rb#29.
-
#source_line ⇒ String
source://parser//lib/parser/source/range.rb#125.
-
#to_a ⇒ Array<Integer>
source://parser//lib/parser/source/range.rb#148.
-
#to_range ⇒ Range
source://parser//lib/parser/source/range.rb#155.
-
#with(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)) ⇒ Range
to the given value(s).
Constructor Details
#initialize(source_buffer, begin_pos, end_pos) ⇒ Range
source://parser//lib/parser/source/range.rb#37
5984 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 5984 def initialize(source_buffer, begin_pos, end_pos); end |
Instance Method Details
#adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)) ⇒ Range
by the given amount(s)
source://parser//lib/parser/source/range.rb#193
6000 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6000 def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end |
#begin ⇒ Range
source://parser//lib/parser/source/range.rb#55
6007 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6007 def begin; end |
#begin_pos ⇒ Integer
source://parser//lib/parser/source/range.rb#30
6013 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6013 def begin_pos; end |
#column ⇒ Integer
source://parser//lib/parser/source/range.rb#92
6019 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6019 def column; end |
#column_range ⇒ ::Range
source://parser//lib/parser/source/range.rb#114
6026 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6026 def column_range; end |
#contained?(other) ⇒ Boolean
Return other.contains?(self)
Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
source://parser//lib/parser/source/range.rb#274
6037 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6037 def contained?(other); end |
#contains?(other) ⇒ Boolean
Returns true iff this range contains (strictly) other
.
Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
source://parser//lib/parser/source/range.rb#262
6048 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6048 def contains?(other); end |
#crossing?(other) ⇒ Boolean
Returns true iff both ranges intersect and also have different elements from one another.
Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
source://parser//lib/parser/source/range.rb#286
6059 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6059 def crossing?(other); end |
#disjoint?(other) ⇒ Boolean
Return true
iff this range and other
are disjoint.
Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
source://parser//lib/parser/source/range.rb#236
6070 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6070 def disjoint?(other); end |
#empty? ⇒ Boolean
Checks if a range is empty; if it contains no characters
source://parser//lib/parser/source/range.rb#294
6078 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6078 def empty?; end |
#end ⇒ Range
source://parser//lib/parser/source/range.rb#63
6085 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6085 def end; end |
#end_pos ⇒ Integer
source://parser//lib/parser/source/range.rb#30
6091 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6091 def end_pos; end |
#first_line ⇒ Integer
Line number of the beginning of this range. By default, the first line of a buffer is 1; as such, line numbers are most commonly one-based.
source://parser//lib/parser/source/range.rb#83
6104 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6104 def first_line; end |
#intersect(other) ⇒ Range
source://parser//lib/parser/source/range.rb#220
6125 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6125 def intersect(other); end |
#is?(*what) ⇒ Boolean
is?
provides a concise way to compare the source corresponding to this range.
For example, r.source == '(' || r.source == 'begin'
is equivalent to
r.is?('(', 'begin')
.
source://parser//lib/parser/source/range.rb#141
6135 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6135 def is?(*what); end |
#join(other) ⇒ Range
source://parser//lib/parser/source/range.rb#209
6142 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6142 def join(other); end |
#last_column ⇒ Integer
source://parser//lib/parser/source/range.rb#106
6148 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6148 def last_column; end |
#last_line ⇒ Integer
source://parser//lib/parser/source/range.rb#99
6154 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6154 def last_line; end |
#length ⇒ Integer
source://parser//lib/parser/source/range.rb#70
6160 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6160 def length; end |
#line ⇒ Integer
Line number of the beginning of this range. By default, the first line of a buffer is 1; as such, line numbers are most commonly one-based.
source://parser//lib/parser/source/range.rb#83
6170 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6170 def line; end |
#overlaps?(other) ⇒ Boolean
Return true
iff this range is not disjoint from other
.
source://parser//lib/parser/source/range.rb#250
6179 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6179 def overlaps?(other); end |
#resize(new_size) ⇒ Range
source://parser//lib/parser/source/range.rb#201
6186 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6186 def resize(new_size); end |
#size ⇒ Integer
source://parser//lib/parser/source/range.rb#70
6192 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6192 def size; end |
#source ⇒ String
source://parser//lib/parser/source/range.rb#132
6198 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6198 def source; end |
#source_buffer ⇒ Parser::Source::Buffer
source://parser//lib/parser/source/range.rb#29
6204 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6204 def source_buffer; end |
#source_line ⇒ String
source://parser//lib/parser/source/range.rb#125
6210 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6210 def source_line; end |
#to_a ⇒ Array<Integer>
source://parser//lib/parser/source/range.rb#148
6216 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6216 def to_a; end |
#to_range ⇒ Range
source://parser//lib/parser/source/range.rb#155
6222 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6222 def to_range; end |
#with(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)) ⇒ Range
to the given value(s).
source://parser//lib/parser/source/range.rb#184
6248 |
# File 'sorbet/rbi/parser@3.3.7.4.rbi', line 6248 def with(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end |