Class: RBS::Parser::Token
- Inherits:
-
Object
- Object
- RBS::Parser::Token
- Defined in:
- lib/rbs/parser/token.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #comment? ⇒ Boolean
-
#initialize(type:, location:) ⇒ Token
constructor
A new instance of Token.
- #value ⇒ Object
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 ⇒ Object (readonly)
Returns the value of attribute location.
7 8 9 |
# File 'lib/rbs/parser/token.rb', line 7 def location @location end |
#type ⇒ Object (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 ⇒ Object
14 15 16 |
# File 'lib/rbs/parser/token.rb', line 14 def value @location.source end |