Class: YARP::LexCompat::IgnoredNewlineToken

Inherits:
Token
  • Object
show all
Defined in:
lib/yarp/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



235
236
237
238
239
240
241
242
243
# File 'lib/yarp/lex_compat.rb', line 235

def ==(other)
  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