Class: Prism::LexCompat::Token
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Prism::LexCompat::Token
- Defined in:
- lib/prism/lex_compat.rb
Overview
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.
Direct Known Subclasses
EndContentToken, IdentToken, IgnoreStateToken, IgnoredNewlineToken, ParamToken
Instance Method Summary collapse
-
#event ⇒ Object
The type of the token.
-
#location ⇒ Object
The location of the token in the source.
-
#state ⇒ Object
The state of the lexer when this token was produced.
-
#value ⇒ Object
The slice of the source that this token represents.
Instance Method Details
#event ⇒ Object
The type of the token.
213 214 215 |
# File 'lib/prism/lex_compat.rb', line 213 def event self[1] end |
#location ⇒ Object
The location of the token in the source.
208 209 210 |
# File 'lib/prism/lex_compat.rb', line 208 def location self[0] end |
#state ⇒ Object
The state of the lexer when this token was produced.
223 224 225 |
# File 'lib/prism/lex_compat.rb', line 223 def state self[3] end |
#value ⇒ Object
The slice of the source that this token represents.
218 219 220 |
# File 'lib/prism/lex_compat.rb', line 218 def value self[2] end |