Class: Predicator::AST::Node

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/predicator/ast.rb

Direct Known Subclasses

Binary, Terminal, Ternary, Unary

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left) ⇒ Node

Returns a new instance of Node.



8
9
10
# File 'lib/predicator/ast.rb', line 8

def initialize left
  @left = left
end

Instance Attribute Details

#leftObject

Returns the value of attribute left.



6
7
8
# File 'lib/predicator/ast.rb', line 6

def left
  @left
end

Instance Method Details

#each(&block) ⇒ Object



12
13
14
# File 'lib/predicator/ast.rb', line 12

def each &block
  Visitors::Each.new(block).accept self
end

#literal?Boolean

Returns:

  • (Boolean)


37
# File 'lib/predicator/ast.rb', line 37

def literal?; false; end

#to_dotObject



16
17
18
# File 'lib/predicator/ast.rb', line 16

def to_dot
  Visitors::Dot.new.accept self
end

#to_instructionsObject



20
21
22
# File 'lib/predicator/ast.rb', line 20

def to_instructions
  Visitors::Instructions.new.accept self
end

#to_predicateObject



24
25
26
# File 'lib/predicator/ast.rb', line 24

def to_predicate
  Visitors::Predicate.new.accept self
end

#to_sObject



28
29
30
# File 'lib/predicator/ast.rb', line 28

def to_s
  Visitors::String.new.accept self
end

#typeObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/predicator/ast.rb', line 32

def type
  raise NotImplementedError
end

#variable?Boolean

Returns:

  • (Boolean)


36
# File 'lib/predicator/ast.rb', line 36

def variable?; false; end