Class: Bade::AST::Node
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(type, parent = nil, lineno: nil, filename: nil) ⇒ Node
31
32
33
34
35
36
37
|
# File 'lib/bade/ast/node.rb', line 31
def initialize(type, parent = nil, lineno: nil, filename: nil)
@type = type
@parent = parent
@children = []
@lineno = lineno
@filename = filename
end
|
Instance Attribute Details
19
20
21
|
# File 'lib/bade/ast/node.rb', line 19
def children
@children
end
|
29
30
31
|
# File 'lib/bade/ast/node.rb', line 29
def filename
@filename
end
|
#lineno ⇒ Int
25
26
27
|
# File 'lib/bade/ast/node.rb', line 25
def lineno
@lineno
end
|
15
16
17
|
# File 'lib/bade/ast/node.rb', line 15
def parent
@parent
end
|
#type ⇒ Symbol
11
12
13
|
# File 'lib/bade/ast/node.rb', line 11
def type
@type
end
|
Instance Method Details
#==(other) ⇒ Bool
52
53
54
55
56
|
# File 'lib/bade/ast/node.rb', line 52
def ==(other)
return false unless self.class == other.class
type == other.type && children == other.children
end
|
44
45
46
|
# File 'lib/bade/ast/node.rb', line 44
def inspect
to_s
end
|
39
40
41
42
|
# File 'lib/bade/ast/node.rb', line 39
def to_s
require_relative 'string_serializer'
StringSerializer.new(self).to_s
end
|