Class: OpenEHR::AQL::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/openehr/aql/lexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Token.



24
25
26
27
28
29
30
# File 'lib/openehr/aql/lexer.rb', line 24

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

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



22
23
24
# File 'lib/openehr/aql/lexer.rb', line 22

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



22
23
24
# File 'lib/openehr/aql/lexer.rb', line 22

def line
  @line
end

#typeObject (readonly)

Returns the value of attribute type.



22
23
24
# File 'lib/openehr/aql/lexer.rb', line 22

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



22
23
24
# File 'lib/openehr/aql/lexer.rb', line 22

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



32
33
34
# File 'lib/openehr/aql/lexer.rb', line 32

def ==(other)
  other.is_a?(Token) && type == other.type && value == other.value
end

#hashObject



37
38
39
# File 'lib/openehr/aql/lexer.rb', line 37

def hash
  [type, value].hash
end

#to_sObject



41
42
43
# File 'lib/openehr/aql/lexer.rb', line 41

def to_s
  "#{type}(#{value.inspect})@#{line}:#{column}"
end