Class: RBS::Parser::Token
- Inherits:
-
Object
- Object
- RBS::Parser::Token
- Defined in:
- sig/parser.rbs,
lib/rbs/parser/token.rb
Overview
Represents a token per result of Parser.lex.
Instance Attribute Summary collapse
-
#location ⇒ Location[untyped, untyped]
readonly
Returns the value of attribute location.
-
#type ⇒ Symbol
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #comment? ⇒ Boolean
-
#initialize(type:, location:) ⇒ Token
constructor
A new instance of Token.
- #value ⇒ String
Constructor Details
#initialize(type:, location:) ⇒ Token
Returns a new instance of Token.
9 10 11 12 |
# File 'lib/rbs/parser/token.rb', line 9 def initialize(type:, location:) @type = type @location = location end |
Instance Attribute Details
#location ⇒ Location[untyped, untyped] (readonly)
Returns the value of attribute location.
7 8 9 |
# File 'lib/rbs/parser/token.rb', line 7 def location @location end |
#type ⇒ Symbol (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/rbs/parser/token.rb', line 6 def type @type end |
Instance Method Details
#comment? ⇒ Boolean
18 19 20 |
# File 'lib/rbs/parser/token.rb', line 18 def comment? @type == :tCOMMENT || @type == :tLINECOMMENT end |
#value ⇒ String
14 15 16 |
# File 'lib/rbs/parser/token.rb', line 14 def value @location.source end |