Class: Parser::Source::Range
- Includes:
- Comparable
- Defined in:
- sorbet/rbi/parser@3.3.8.0.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
5990 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5990 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
6006 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6006 def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end |
#begin ⇒ Range
source://parser//lib/parser/source/range.rb#55
6013 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6013 def begin; end |
#begin_pos ⇒ Integer
source://parser//lib/parser/source/range.rb#30
6019 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6019 def begin_pos; end |
#column ⇒ Integer
source://parser//lib/parser/source/range.rb#92
6025 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6025 def column; end |
#column_range ⇒ ::Range
source://parser//lib/parser/source/range.rb#114
6032 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6032 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
6043 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6043 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
6054 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6054 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
6065 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6065 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
6076 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6076 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
6084 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6084 def empty?; end |
#end ⇒ Range
source://parser//lib/parser/source/range.rb#63
6091 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6091 def end; end |
#end_pos ⇒ Integer
source://parser//lib/parser/source/range.rb#30
6097 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6097 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
6110 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6110 def first_line; end |
#intersect(other) ⇒ Range
source://parser//lib/parser/source/range.rb#220
6131 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6131 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
6141 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6141 def is?(*what); end |
#join(other) ⇒ Range
source://parser//lib/parser/source/range.rb#209
6148 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6148 def join(other); end |
#last_column ⇒ Integer
source://parser//lib/parser/source/range.rb#106
6154 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6154 def last_column; end |
#last_line ⇒ Integer
source://parser//lib/parser/source/range.rb#99
6160 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6160 def last_line; end |
#length ⇒ Integer
source://parser//lib/parser/source/range.rb#70
6166 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6166 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
6176 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6176 def line; end |
#overlaps?(other) ⇒ Boolean
Return true
iff this range is not disjoint from other
.
source://parser//lib/parser/source/range.rb#250
6185 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6185 def overlaps?(other); end |
#resize(new_size) ⇒ Range
source://parser//lib/parser/source/range.rb#201
6192 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6192 def resize(new_size); end |
#size ⇒ Integer
source://parser//lib/parser/source/range.rb#70
6198 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6198 def size; end |
#source ⇒ String
source://parser//lib/parser/source/range.rb#132
6204 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6204 def source; end |
#source_buffer ⇒ Parser::Source::Buffer
source://parser//lib/parser/source/range.rb#29
6210 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6210 def source_buffer; end |
#source_line ⇒ String
source://parser//lib/parser/source/range.rb#125
6216 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6216 def source_line; end |
#to_a ⇒ Array<Integer>
source://parser//lib/parser/source/range.rb#148
6222 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6222 def to_a; end |
#to_range ⇒ Range
source://parser//lib/parser/source/range.rb#155
6228 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6228 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
6254 |
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 6254 def with(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end |