Class: Prism::LexCompat::IgnoredNewlineToken

Inherits:
Token show all
Defined in:
lib/prism/lex_compat.rb

Overview

Ignored newlines can occasionally have a LABEL state attached to them, so we compare the state differently here.

Constant Summary

Constants inherited from Delegator

Delegator::VERSION

Instance Method Summary collapse

Methods inherited from Token

#event, #location, #state, #value

Methods inherited from SimpleDelegator

#__getobj__, #__setobj__

Methods inherited from Delegator

#!, #!=, #__getobj__, #__setobj__, const_missing, delegating_block, #eql?, #freeze, #initialize, #marshal_dump, #marshal_load, #methods, #protected_methods, public_api, #public_methods, #respond_to_missing?

Constructor Details

This class inherits a constructor from Delegator

Instance Method Details

#==(other) ⇒ Object

:nodoc:



240
241
242
243
244
245
246
247
248
# File 'lib/prism/lex_compat.rb', line 240

def ==(other) # :nodoc:
  return false unless self[0...-1] == other[0...-1]

  if self[4] == Ripper::EXPR_ARG | Ripper::EXPR_LABELED
    other[4] & Ripper::EXPR_ARG | Ripper::EXPR_LABELED > 0
  else
    self[4] == other[4]
  end
end