<commit_before>#ifndef _paintown_ast_identifier_h_
#define _paintown_ast_identifier_h_

#include <list>
#include <string>
#include <sstream>

namespace Ast{

class Identifier{
public:
    Identifier(const std::list<std::string*> & names):
    names(names){
    }

    bool operator==(const std::string & str) const {
        return toString() == str;
    }

    std::string toString() const {
        std::ostringstream out;
        bool first = true;
        for (std::list<std::string*>::const_iterator it = names.begin(); it != names.end(); it++){
            if (!first){
                out << ".";
            } else {
                first = false;
            }
            std::string * str = *it;
            out << *str;
        }
        return out.str();
    }
    <commit_msg>ignore case when comparing identifiers<commit_after>#ifndef _paintown_ast_identifier_h_
#define _paintown_ast_identifier_h_

#include <list>
#include <string>
#include <sstream>
#include <algorithm>

namespace Ast{

class Identifier{
public:
    Identifier(const std::list<std::string*> & names):
    names(names){
    }

    static int lowerCase( int c ){
        return tolower(c);
    }

    static std::string downcase(std::string str){
        std::transform(str.begin(), str.end(), str.begin(), lowerCase);
        return str;
    }

    bool operator==(const std::string & str) const {
        return downcase(toString()) == downcase(str);
    }

    std::string toString() const {
        std::ostringstream out;
        bool first = true;
        for (std::list<std::string*>::const_iterator it = names.begin(); it != names.end(); it++){
            if (!first){
                out << ".";
            } else {
                first = false;
            }
            std::string * str = *it;
            out << *str;
        }
        return out.str();
    }
    
{'fraction_non_alphanumeric': 0.14163090128755365, 'fraction_numerical': 0.0, 'mean_word_length': 2.18259385665529, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 14, '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': '4302699', 'n_tokens_mistral': 562, 'n_tokens_neox': 551, 'n_words': 133}