class RKelly::CharRange

Represents a syntax element location in source code - where it begins and where it ends.

It's a value object - it can't be modified.

Constants

EMPTY

A re-usable empty range

Attributes

from[R]
to[R]

Public Class Methods

new(from, to) click to toggle source
# File lib/rkelly/char_range.rb, line 13
def initialize(from, to)
  @from = from
  @to = to
end

Public Instance Methods

inspect()
Alias for: to_s
next(string) click to toggle source

Creates a new range that immediately follows this one and contains the given string.

# File lib/rkelly/char_range.rb, line 20
def next(string)
  CharRange.new(@to.next(string[0]), @to.next(string))
end
to_s() click to toggle source
# File lib/rkelly/char_range.rb, line 24
def to_s
  "<#{@from}...#{@to}>"
end
Also aliased as: inspect