lib/arith_expr_ast_eval/ast.rb
#
# either numeric operand xor operator (no symbolic value)
#
either numeric operand xor operator (no symbolic value)
either numeric operand xor operator ( no symbolic value )
def _proc(token, tree_stack, ops_stack)
      if @ops.operator?(token)
        STDOUT.print("===> token <{token}> is an OPERATOR\n")
        _op_case(token, ops_stack, tree_stack)
      elsif @ops.func?(token)
        STDOUT.print("===> token <{token}> is a FUNCTION EXPR\n")
         recursion here...
        tree_stack << build(_func_case(token, ops_stack, tree_stack))
         now pop the function itself
        op = ops_stack.pop
        STDOUT.print("===> token <{token}> // AFTR REC CALL with op: {op}\n")
        _build_btree_n_push(tree_stack, op)
      elsif token =~ @operand.num_rexp
        STDOUT.print("===> token <{token}> is NUMERIC\n")
        tree_stack << ArithExprASTEval::Node.new(token)
      elsif token =~ @ops.parens_rexp  /^\(.+\)$/
        STDOUT.print("===> token <{token}> is PARENTHESES <{@ops.parens_rexp}>?? \n")
         recursion here...
        tree_stack << build(token.sub(/^\(/, '').sub(/\)$/, ''))
      else
        raise SyntaxError,
              "Unexpected operator/operand found, got: {token}" +
              " valid operators: {@ops.list} //" +
              " valid functions: {@ops.func_list}"
      end
    end
def _proc ( token , tree_stack , ops_stack ) if @ops . operator? ( token ) _op_case ( token , ops_stack , tree_stack ) elsif @ops . func? ( token ) tree_stack << build ( _func_case ( token , ops_stack , tree_stack ) ) op = ops_stack . pop _build_btree_n_push ( tree_stack , op ) elsif token =~ @operand . num_rexp tree_stack << ArithExprASTEval :: Node . new ( token ) elsif token =~ @ops . parens_rexp tree_stack << build ( token . sub ( / ^ \( / , '' ) . sub ( / \) $ / , '' ) ) else raise SyntaxError , "Unexpected operator/operand found, got: #{token}" + " valid operators: #{@ops.list} //" + " valid functions: #{@ops.func_list}" end end
either numeric operand xor operator (no symbolic value)
either numeric operand xor operator ( no symbolic value )
#STDOUT.print("===> proc. token <#{token}>\n") # # STDOUT.print("===> token <#{token}> is an OPERATOR\n") # #STDOUT.print("===> token <#{token}> is a FUNCTION EXPR\n") # recursion here... # now pop the function itself #STDOUT.print("===> token <#{token}> // AFTR REC CALL with op: #{op}\n") # #STDOUT.print("===> token <#{token}> is NUMERIC\n") # # /^\(.+\)$/ #STDOUT.print("===> token <#{token}> is PARENTHESES <#{@ops.parens_rexp}>?? \n") # recursion here... #
token
<not_specific>
tree_stack
<not_specific>
ops_stack
<not_specific>