private boolean safeAdd(Token token) {
//end{check}
        
        Token last = tokens.empty() ? null : tokens.peek();        
        boolean safe = true;
        if (last !=null && (last.isNumber() || last.isOperator(')'))) {
            safe = token.isOperator('+') || token.isOperator('-') ||
                    token.isOperator(')');
        } else {
            safe = token.isNumber() || token.isOperator('(');
        }
        
        if (safe) {
            tokens.add(token);
        } else {
            System.out.println(token + " can't follow " + tokens.peek());
        }
        return safe;
    }