public static CharacterMatcher newCharacterMatcher(BitSet characterSet) {
        if (characterSet.isEmpty())
            return new CharacterMatcher() {
                @Override
                public boolean match(int c) {
                    return false;
                }

                @Override
                public String toString() {
                    return "()";
                }
            };

        if (characterSet.nextClearBit(0) == 0x110000)
            return new CharacterMatcher() {
                @Override
                public boolean match(int c) {
                    return true;
                }

                @Override
                public String toString() {
                    return "(0-10ffff)";
                }
            };

        // TODO: Maybe one set should suffice?
        LinkedList<CharacterMatcher> result = new LinkedList<>();

        LinkedList<Integer> set = null;
        for (int i = characterSet.nextSetBit(0); i >= 0; i = characterSet.nextSetBit(i + 1)) {
            int j = characterSet.nextClearBit(i);
            if ((j - i) > 1) {
                if (set != null) {
                    result.add(toCharMatcher(set));
                    set = null;
                }

                result.add(new RangeMatcher(i, j - 1));
                i = j;
            } else {
                if (set == null)
                    set = new LinkedList<>();

                set.add(i);
            }
        }

        if (set != null)
            result.add(toCharMatcher(set));

        return compose(result);
    }