123456789_123456789_123456789_123456789_123456789_

Class: Prism::LexCompat::ParamToken

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Token, SimpleDelegator
Instance Chain:
self, Token, SimpleDelegator
Inherits: Prism::LexCompat::Token
Defined in: lib/prism/lex_compat.rb

Overview

If we have an identifier that follows a method name like:

def foo bar

then Ripper will mark bar as END|LABEL if there is a local in a parent scope named bar because it hasn’t pushed the local table yet. We do this more accurately, so we need to allow comparing against both END and END|LABEL.

Instance Method Summary

Token - Inherited

#event

The type of the token.

#location

The location of the token in the source.

#state

The state of the lexer when this token was produced.

#value

The slice of the source that this token represents.

Instance Method Details

#==(other)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/prism/lex_compat.rb', line 260

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