class Prism::Token

This represents a token from the Ruby source.

def ==(other)

Returns true if the given other token is equal to this token.
def ==(other)
  Token === other &&
    other.type == type &&
    other.value == value
end

def deconstruct_keys(keys)

Implement the hash pattern matching interface for Token.
def deconstruct_keys(keys)
  { type: type, value: value, location: location }
end

def initialize(source, type, value, location)

Create a new token object with the given type, value, and location.
def initialize(source, type, value, location)
  @source = source
  @type = type
  @value = value
  @location = location
end

def inspect

Returns a string representation of this token.
def inspect
  location
  super
end

def location

A Location object representing the location of this token in the source.
def location
  location = @location
  return location if location.is_a?(Location)
  @location = Location.new(source, location >> 32, location & 0xFFFFFFFF)
end

def pretty_print(q)

Implement the pretty print interface for Token.
def pretty_print(q)
  q.group do
    q.text(type.to_s)
    self.location.pretty_print(q)
    q.text("(")
    q.nest(2) do
      q.breakable("")
      q.pp(value)
    end
    q.breakable("")
    q.text(")")
  end
end