class Prism::LexCompat::Token - Documentation for Ruby 4.0
Description: class Prism::LexCompat::Token: When we produce tokens, we produce the same arrays that Ripper does. However, we add a couple of convenience methods onto them to make them a little e
Keywords: ruby,class,Prism::LexCompat::Token

🔍

No recent searches

# class Prism::LexCompat::Token

When we produce tokens, we produce the same arrays that `Ripper` does. However, we add a couple of convenience methods onto them to make them a little easier to work with. We delegate all other methods to the array.

### Public Instance Methods

event ()
Source

    # File lib/prism/lex_compat.rb, line 213
    def event
      self[1]
    end

The type of the token.

location ()
Source

    # File lib/prism/lex_compat.rb, line 208
    def location
      self[0]
    end

The location of the token in the source.

state ()
Source

    # File lib/prism/lex_compat.rb, line 223
    def state
      self[3]
    end

The state of the lexer when this token was produced.

value ()
Source

    # File lib/prism/lex_compat.rb, line 218
    def value
      self[2]
    end

The slice of the source that this token represents.