private Fragment merge(Stack<Fragment> fragStack, ParseContext context) {
        Fragment start = fragStack.remove(0);
        if (fragStack.size() == 0) {
            return start;
        }

        for (Fragment fragment : fragStack) {
            if (context.canCat()) {
                start = start.cat(fragment);
            } else {
                start = start.union(fragment);
            }
        }
        return start;
    }