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 Class Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb, line 204 def initialize(array) @array = array end
Create a new token object with the given ripper-compatible array.
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb, line 214 def event @array[1] end
The type of the token.
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb, line 209 def location @array[0] end
The location of the token in the source.
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb, line 224 def state @array[3] end
The state of the lexer when this token was produced.
Source
# File vendor/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb, line 219 def value @array[2] end
The slice of the source that this token represents.