Class
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.
Instance Methods
#
lib/prism/lex_compat.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/lex_compat.rb, line 193
def event
self[1]
end
The type of the token.
#
lib/prism/lex_compat.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/lex_compat.rb, line 188
def location
self[0]
end
The location of the token in the source.
#
lib/prism/lex_compat.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/lex_compat.rb, line 203
def state
self[3]
end
The state of the lexer when this token was produced.
#
lib/prism/lex_compat.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/prism/lex_compat.rb, line 198
def value
self[2]
end
The slice of the source that this token represents.