Arithmetic evaluation: Difference between revisions

Line 2,535:
 
def operator?(token)
$op_priority.keys.includehas_key?(token)
end
 
Line 2,552:
if operator?(token)
# clear stack of higher priority operators
while notuntil (op_stack.empty? or
op_stack.last.info == "(" or
$op_priority[op_stack.last.info] < $op_priority[token])
pop_connect_push(op_stack, node_stack)
end
Line 2,573:
end
 
while notuntil op_stack.empty?
pop_connect_push(op_stack, node_stack)
end
Anonymous user