Class: Natsuzora::Token

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

Constant Summary collapse

RESERVED_WORDS =
%w[if unless else each as in of unsecure true false null include].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value, line:, column:) ⇒ Token

Returns a new instance of Token.



9
10
11
12
13
14
# File 'lib/natsuzora/token.rb', line 9

def initialize(type, value, line:, column:)
  @type = type
  @value = value
  @line = line
  @column = column
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



5
6
7
# File 'lib/natsuzora/token.rb', line 5

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



5
6
7
# File 'lib/natsuzora/token.rb', line 5

def line
  @line
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/natsuzora/token.rb', line 5

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/natsuzora/token.rb', line 5

def value
  @value
end

Instance Method Details

#inspectObject



16
17
18
# File 'lib/natsuzora/token.rb', line 16

def inspect
  "#<Token #{type}:#{value.inspect} at #{line}:#{column}>"
end