Class: Bade::AST::Node
- Inherits:
-
Object
show all
- Defined in:
- lib/bade/ast/node.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(type, lineno: nil) ⇒ Node
23
24
25
26
27
28
|
# File 'lib/bade/ast/node.rb', line 23
def initialize(type, lineno: nil)
@type = type
@children = []
@lineno = lineno
end
|
Instance Attribute Details
#children ⇒ Array<Bade::Node>
15
16
17
|
# File 'lib/bade/ast/node.rb', line 15
def children
@children
end
|
#lineno ⇒ Int
21
22
23
|
# File 'lib/bade/ast/node.rb', line 21
def lineno
@lineno
end
|
#type ⇒ Symbol
11
12
13
|
# File 'lib/bade/ast/node.rb', line 11
def type
@type
end
|
Instance Method Details
#==(other) ⇒ Bool
43
44
45
46
47
|
# File 'lib/bade/ast/node.rb', line 43
def ==(other)
return false unless self.class == other.class
type == other.type && children == other.children
end
|
#inspect ⇒ Object
35
36
37
|
# File 'lib/bade/ast/node.rb', line 35
def inspect
to_s
end
|
#to_s ⇒ Object
30
31
32
33
|
# File 'lib/bade/ast/node.rb', line 30
def to_s
require_relative 'string_serializer'
StringSerializer.new(self).to_s
end
|