Class: Prism::LexCompat::IgnoredNewlineToken

Inherits:
Token
  • Object
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.

Instance Method Summary collapse

Methods inherited from Token

#event, #location, #state, #value

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