rubyx/lib/register/instructions/operator_instruction.rb

22 lines
454 B
Ruby
Raw Normal View History

2015-08-04 21:01:20 +02:00
module Register
class OperatorInstruction < Instruction
def initialize source , operator , left , right
super(source)
@operator = operator
@left = left
@right = right
end
2015-08-07 15:46:55 +02:00
attr_reader :operator, :left , :right
2015-08-04 21:01:20 +02:00
def to_s
"OperatorInstruction: #{left} #{operator} #{right}"
end
2015-11-21 13:17:54 +01:00
end
def self.op source , operator , left , right
OperatorInstruction.new source , operator , left , right
2015-08-04 21:01:20 +02:00
end
end