package Token;
import Main.Expression;
import java.util.List;
import java.util.Stack;


public class RightParenthesis extends Operator{
	
	public void act(Stack<Expression> S) throws Exception{}
	public RightParenthesis(int position){
		setPositionInPredicate(position);
	}
	public void put(List<Token> postOrder,Stack<Operator> S)throws Exception{
		while(!S.isEmpty()){
			if(!S.peek().isLeftParenthesis()){
				postOrder.add(S.pop());
			}
			else{
				S.pop();
				return;
			}
		}
		throw new Exception("unbalanced parenthesis: at char " + getPositionInPredicate());
	}
}
