This represents a token from the Ruby source.
Attributes
Read
The type of token that this token is.
Read
A byteslice of the source that this token represents.
Class Methods
dev
View on GitHub
# File tmp/rubies/ruby-master/lib/prism/parse_result.rb, line 1088
def initialize(source, type, value, location)
@source = source
@type = type
@value = value
@location = location
end
Create a new token object with the given type, value, and location.
Instance Methods
dev
View on GitHub
# File tmp/rubies/ruby-master/lib/prism/parse_result.rb, line 1131
def ==(other)
Token === other &&
other.type == type &&
other.value == value
end
Returns true if the given other token is equal to this token.
dev
View on GitHub
# File tmp/rubies/ruby-master/lib/prism/parse_result.rb, line 1148
def deep_freeze
value.freeze
location.freeze
freeze
end
Freeze this object and the objects it contains.
#
dev
View on GitHub
# File tmp/rubies/ruby-master/lib/prism/parse_result.rb, line 1105
def location
location = @location
return location if location.is_a?(Location)
@location = Location.new(source, location >> 32, location & 0xFFFFFFFF)
end
A Location object representing the location of this token in the source.