Class: CFG::Token

Inherits:
ASTNode show all
Defined in:
lib/CFG/config.rb

Instance Attribute Summary collapse

Attributes inherited from ASTNode

#end, #kind, #start

Instance Method Summary collapse

Constructor Details

#initialize(kind, text, value = nil) ⇒ Token

Returns a new instance of Token.



239
240
241
242
243
# File 'lib/CFG/config.rb', line 239

def initialize(kind, text, value = nil)
  super(kind)
  @text = text
  @value = value
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



236
237
238
# File 'lib/CFG/config.rb', line 236

def text
  @text
end

#valueObject

Returns the value of attribute value.



237
238
239
# File 'lib/CFG/config.rb', line 237

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



249
250
251
252
# File 'lib/CFG/config.rb', line 249

def ==(other)
  @kind == other.kind && @text == other.text && @value == other.value &&
    @start == other.start && @end == other.end
end

#to_sObject



245
246
247
# File 'lib/CFG/config.rb', line 245

def to_s
  "Token(#{@kind}, #{text.inspect}, #{value.inspect})"
end