Class: Prism::LexCompat::IdentToken

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

Overview

Ident tokens for the most part are exactly the same, except sometimes we know an ident is a local when ripper doesn’t (when they are introduced through named captures in regular expressions). In that case we don’t compare the state.

Instance Method Summary collapse

Methods inherited from Token

#event, #location, #state, #value

Instance Method Details

#==(other) ⇒ Object

:nodoc:



249
250
251
252
253
254
# File 'lib/prism/lex_compat.rb', line 249

def ==(other) # :nodoc:
  (self[0...-1] == other[0...-1]) && (
    (other[3] == Ripper::EXPR_LABEL | Ripper::EXPR_END) ||
    (other[3] & Ripper::EXPR_ARG_ANY != 0)
  )
end