Class: RBS::Parser::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/parser/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/rbs/parser/token.rb', line 7

def location
  @location
end

#typeObject (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

Returns:

  • (Boolean)


18
19
20
# File 'lib/rbs/parser/token.rb', line 18

def comment?
  @type == :tCOMMENT || @type == :tLINECOMMENT
end

#valueObject



14
15
16
# File 'lib/rbs/parser/token.rb', line 14

def value
  @location.source
end