private Stack<Symbol> parseNextBooleanSymbol(String inputExpression, int index, Stack<Symbol> parseTree) {
        char symbol = inputExpression.charAt(index);
        if (Character.isLetterOrDigit(symbol)) {
            parseTree = insertString(inputExpression, index, parseTree);
        }
        else if (symbol == '&') {
            And operator = new And();
            operator.addPrecedence(accumulatedPrecedence);
            lastValidInput = null;
            parseTree = insertSymbolByPrecedence(operator, parseTree);
        }
        else if (symbol == '|') {
            Or operator = new Or();
            operator.addPrecedence(accumulatedPrecedence);
            lastValidInput = null;
            parseTree = insertSymbolByPrecedence(operator, parseTree);
        }
        else if (symbol == '!') {
            Not operator = new Not();
            operator.addPrecedence(accumulatedPrecedence);
            lastValidInput = null;
            parseTree = insertSymbolByPrecedence(operator, parseTree);
        }
        else if (symbol == '(') {
            parseTree = handleParentheses(inputExpression, index, parseTree, "boolean");
        }
        else if (inputExpression.charAt(index) == ' ' || inputExpression.charAt(index) == '\n') {
            // Skip whitespace
        }

        return parseTree;
    }