public HashSet<Fragment> asFragments() {
        HashSet<Fragment> result = new HashSet<>();

        for (int i = 0; i < this.tokens.size(); ++i) {
            Token token = this.tokens.get(i);

            if (!token.isText())
                continue;

            Fragment frag = new Fragment(token.getValue());
            for (Token attribute : this.activeTokensAt(i)) {
                if (attribute.hasValue())
                    frag.addAttribute(attribute.getTag(), attribute.getValue());
                else
                    frag.addFlag(attribute.getTag());
            }

            result.add(frag);
        }

        return result;
    }