294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
# File 'lib/BOAST/Algorithm.rb', line 294
def to_var
op1 = nil
op1 = @operand1.to_var if @operand1.respond_to?(:to_var)
op2 = nil
op2 = @operand2.to_var if @operand2.respond_to?(:to_var)
if op1 and op2 then
r_t, oper = BOAST::transition(op1, op2, @operator)
res_exp = BOAST::Expression::to_str_base(op1, op2, oper, r_t)
return r_t.copy(res_exp, :const => nil, :constant => nil)
elsif op2
res_exp = BOAST::Expression::to_str_base(@operand1, op2, @operator)
return op2.copy(res_exp, :const => nil, :constant => nil)
elsif op1
res_exp = BOAST::Expression::to_str_base(op1, @operand2, @operator)
return op1.copy(res_exp, :const => nil, :constant => nil)
else
STDERR.puts "#{@operand1} #{@operand2}"
raise "Expression on no operand!"
end
end
|