Class: Logicality::Parser::Ast::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/logicality/parser/ast/node.rb

Overview

Base construct defining all nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Node

Returns a new instance of Node.



17
18
19
20
# File 'lib/logicality/parser/ast/node.rb', line 17

def initialize(token)
  @token = token
  @name  = ''
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/logicality/parser/ast/node.rb', line 15

def name
  @name
end

#tokenObject (readonly)

Returns the value of attribute token.



15
16
17
# File 'lib/logicality/parser/ast/node.rb', line 15

def token
  @token
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/logicality/parser/ast/node.rb', line 22

def to_s
  "AstNode: #{self.class.name}::#{token}"
end