Class: Prism::Token
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/prism/parse_result.rb, prism/extension.c |
Overview
This represents a token from the Ruby source.
Class Method Summary
-
.new(type, value, location) ⇒ Token
constructor
Create a new token object with the given type, value, and location.
Instance Attribute Summary
Instance Method Summary
-
#==(other)
Returns true if the given other token is equal to this token.
-
#deconstruct_keys(keys)
Implement the hash pattern matching interface for
Token
. -
#pretty_print(q)
Implement the pretty print interface for
Token
.
Constructor Details
.new(type, value, location) ⇒ Token
Create a new token object with the given type, value, and location.
Instance Attribute Details
#location (readonly)
A Location object representing the location of this token in the source.
# File 'lib/prism/parse_result.rb', line 424
attr_reader :location
#type (readonly)
The type of token that this token is.
# File 'lib/prism/parse_result.rb', line 418
attr_reader :type
#value (readonly)
A byteslice of the source that this token represents.
# File 'lib/prism/parse_result.rb', line 421
attr_reader :value
Instance Method Details
#==(other)
Returns true if the given other token is equal to this token.
#deconstruct_keys(keys)
Implement the hash pattern matching interface for Token
.
#pretty_print(q)
Implement the pretty print interface for Token
.