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:



260
261
262
263
264
265
266
267
268
# File 'lib/prism/lex_compat.rb', line 260

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

  if self[3] == Ripper::EXPR_ARG | Ripper::EXPR_LABELED
    other[3] & Ripper::EXPR_ARG | Ripper::EXPR_LABELED != 0
  else
    self[3] == other[3]
  end
end