private HashSet<Token> activeTokensAt(int index) {
        HashSet<Token> result = new HashSet<>();

        index = Math.min(index, this.tokens.size());
        loop: for (int i = 0; i < index; ++i) {
            Token token = this.tokens.get(i);

            if (token.isText())
                continue;

            if (!token.closingTag()) {
                for (int j = i; j < index; ++j) {
                    Token compare = this.tokens.get(j);

                    // Found a match?
                    if (compare.closingTag() && token.getID() == compare.getID())
                        continue loop;
                }
            }

            result.add(token);
        }

        return result;
    }