Class: BrainLove::AST::Node
- Inherits:
-
Object
- Object
- BrainLove::AST::Node
- Defined in:
- lib/brain_love/ast.rb
Direct Known Subclasses
DecrementByte, DecrementPointer, IncrementByte, IncrementPointer, InputByte, Loop, OutputByte, Statements
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept(visitor) ⇒ Object
-
#initialize(value = nil) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(value = nil) ⇒ Node
Returns a new instance of Node.
7 8 9 |
# File 'lib/brain_love/ast.rb', line 7 def initialize(value = nil) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/brain_love/ast.rb', line 5 def value @value end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 14 |
# File 'lib/brain_love/ast.rb', line 11 def ==(other) self.class == other.class && self.value == other.value end |
#accept(visitor) ⇒ Object
16 17 18 |
# File 'lib/brain_love/ast.rb', line 16 def accept(visitor) visitor.send("visit_#{self.class.to_s.split('::').last}", self) end |