private T parseNext() throws ParseException {
            checkEndOfExpression();

            final T exp = parseNextRawExpression();

            if (!currentCharIs(OPEN_PAREN)) {
                return exp;
            }

            idx++;
            while (true) {
                exp.addChild(parseNext());
                final boolean isClosingParen = currentCharIs(CLOSE_PAREN);
                final boolean isSeparator = currentCharIs(LOGIC_SEPARATOR);
                if (!isClosingParen && !isSeparator) {
                    checkEndOfExpression();
                    throwParseException("Expected '" + CLOSE_PAREN + "' or '" + LOGIC_SEPARATOR + "' but found '" + config.charAt(idx) + "'");
                }
                idx++;
                if (isClosingParen) {
                    return exp;
                }
            }
        }
Parses next expression starting from idx and leaving idx at next token AFTER expression
main/src/main/java/cgeo/geocaching/utils/config/LegacyFilterConfigParser.java