lib/distcalc/calculator/infix_translator.rb
# Convert an infix tokenized expression to a postfix one
#
# @param tokens [Array<Number, Symbol>] a stream in infix
# @return tokens [Array<Number, Symbol>] a stream in postfix
Convert an infix tokenized expression to a postfix one
Convert an infix tokenized expression to a postfix one
def to_postfix(infix_expr)
      @op_stack = Array.new
      @context_stack = [@op_stack]
      @is_first = true
      @postfix_expr = Array.new
      infix_expr.each { |t| eval_token(t) }
      check_unclosed_bracket
      @postfix_expr + @op_stack.reverse
    end
def to_postfix ( infix_expr ) @op_stack = Array . new @context_stack = [ @op_stack ] @is_first = true @postfix_expr = Array . new infix_expr . each { | t | eval_token ( t ) } check_unclosed_bracket @postfix_expr + @op_stack . reverse end
Convert an infix tokenized expression to a postfix one
Convert an infix tokenized expression to a postfix one
tokens  a stream in postfix
tokens a stream in postfix
Array<Number, Symbol>
infix_expr
<not_specific>
tokens
<not_specific>
a stream in infix
a stream in infix