protected Fragment parseNegateFragment(CharBuffer chars, ParseContext context) {
        Fragment newFrag = Fragment.create();
        while (chars.remain()) {
            char c = chars.next();
            switch (c) {
            // escape
                case '\\':
                    c = chars.next();
                    buildNegateEscapeOrRangeFrag(newFrag, c);
                    break;
                case ']':
                    context.leaveLeftSquarreBracket();
                    return newFrag;
                default:
                    addDefaultNegate(newFrag, chars, context, c);
            }
        }

        throw new IllegalStateException("no ] after [");
    }