/** * Adds the specified operator to the parse tree, taking operands off * the stack as appropriate */ private void addOperator(Operator o) { // Get the operands off the stack o.getOperands(tokenStack); // Add this operator onto the stack tokenStack.push(o); }
if (op.getPrecedence() < operator.getPrecedence()) else if (op.getPrecedence() == operator.getPrecedence() && op instanceof UnaryOperator) operator.getOperands(stack); stack.push(operator); operators.push(op); o.getOperands(stack); stack.push(o); o.getOperands(stack); stack.push(o);
if (op.getPrecedence() < operator.getPrecedence()) else if (op.getPrecedence() == operator.getPrecedence() && op instanceof UnaryOperator) operator.getOperands(stack); stack.push(operator); operators.push(op); o.getOperands(stack); stack.push(o); o.getOperands(stack); stack.push(o);
/** * Adds the specified operator to the parse tree, taking operands off * the stack as appropriate */ private void addOperator(Operator o) { // Get the operands off the stack o.getOperands(tokenStack); // Add this operator onto the stack tokenStack.push(o); }