Class: Prism::Token
| Relationships & Source Files | |
| Inherits: | Object | 
| Defined in: | lib/prism/parse_result.rb | 
Overview
This represents a token from the Ruby source.
Class Method Summary
- 
    
      .new(source, 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. - 
    
      #deep_freeze  
    
    
Freeze this object and the objects it contains.
 - 
    
      #inspect  
    
    
Returns a string representation of this token.
 - 
    
      #location  
    
    
A Location object representing the location of this token in the source.
 - 
    
      #pretty_print(q)  
    
    
Implement the pretty print interface for
Token. 
Constructor Details
    .new(source, type, value, location)  ⇒ Token 
  
Create a new token object with the given type, value, and location.
Instance Attribute Details
#source (readonly, private)
The Source object that represents the source this token came from.
# File 'lib/prism/parse_result.rb', line 819
attr_reader :source
#type (readonly)
The type of token that this token is.
# File 'lib/prism/parse_result.rb', line 823
attr_reader :type
#value (readonly)
A byteslice of the source that this token represents.
# File 'lib/prism/parse_result.rb', line 826
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.
#deep_freeze
Freeze this object and the objects it contains.
#inspect
Returns a string representation of this token.
# File 'lib/prism/parse_result.rb', line 871
def inspect location super end
#location
A Location object representing the location of this token in the source.
#pretty_print(q)
Implement the pretty print interface for Token.