<commit_before><commit_msg>implement to string method<commit_after>#include "selector.h"
#include <string>

using std::string;

namespace shl {
namespace selector {

string ScopeNameSelector::str() const {
    string buffer;
    buffer += components[0];

    for (size_t pos = 1; pos < components.size(); ++pos) {
        buffer += '.';
        buffer += components[pos];
    }

    return buffer;
}

string ScopeSelector::str() const {
    string buffer;

    if (anchor_begin) buffer += "^ ";
    buffer += atoms[0].str();

    for (size_t pos = 1; pos < atoms.size(); ++pos) {
        if (atoms[pos].anchor_prev) buffer += " > ";
        else buffer += " ";
        buffer += atoms[pos].str();
    }

    if (anchor_end) buffer += " $";

    return buffer;
}

string GroupSelector::str() const {
    return "(" + selector.str() + ")";
}

string FilterSelector::str() const {
    string buffer;
    if (side != FilterSelector::None) {
        buffer += side;
        buffer += ": ";
    }
    buffer += selector->str();

    return buffer;
}

string ExpressionSelector::str() const {
    string buffer;
    if (is_negative) buffer += "- ";
    buffer += selector.str();

    return buffer;
}

string CompositeSelctor::str() const {
    string buffer;
    buffer += selectors[0].str();

    for(size_t pos = 1; pos < selectors.size(); ++pos) {
        buffer += ' ';
        buffer += operators[pos];
        buffer += ' ';
        buffer += selectors[pos].str();
    }

    return buffer;
}

string Selector::str() const {
    string buffer;
    for(size_t pos = 0; pos < selectors.size(); ++pos) {
        if (pos != 0) buffer += ", ";
        buffer += selectors[pos].str();
    }

    return buffer;
}

}
}
{'fraction_non_alphanumeric': 0.16890707188778492, 'fraction_numerical': 0.004675628287551139, 'mean_word_length': 2.5592515592515594, 'pattern_counts': {'":': 1, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3080555', 'n_tokens_mistral': 546, 'n_tokens_neox': 529, 'n_words': 133}