<commit_before>#include "culebra.h"
#include "linenoise.hpp"
#include <fstream>
#include <iostream>
#include <vector>

using namespace culebra;
using namespace std;

bool read_file(const char* path, vector<char>& buff)
{
    ifstream ifs(path, ios::in|ios::binary);
    if (ifs.fail()) {
        return false;
    }

    auto size = static_cast<unsigned int>(ifs.seekg(0, ios::end).tellg());

    if (size > 0) {
        buff.resize(size);
        ifs.seekg(0, ios::beg).read(&buff[0], static_cast<streamsize>(buff.size()));
    }

    return true;
}

int repl(shared_ptr<Environment> env, bool print_ast)
{
    for (;;) {
        auto line = linenoise::Readline("cul> ");

        if (line == "exit" || line == "quit") {
            break;
        }

        if (!line.empty()) {
            Value val;
            string msg;
            if (run("(repl)", env, line.c_str(), line.size(), val, msg, print_ast)) {
                cout << val << endl;
                linenoise::AddHistory(line.c_str());
            } else if (!msg.empty()) {
                cout << msg;
            }
        }
    }

    return 0;
}

int main(int argc, const char** argv)
{
    auto print_ast = false;
    auto shell = false;
    vector<const char*> path_list;

    int argi = 1;
    while (argi < argc) {
        auto arg = argv[argi++];
        if (string("--shell") == arg) {
            shell = true;
        } else if (string("--ast") == arg) {
            print_ast = true;
        } else {
            path_list.push_back(arg);
        }
    }<commit_msg>Fixed format problem with error message.<commit_after>#include "culebra.h"
#include "linenoise.hpp"
#include <fstream>
#include <iostream>
#include <vector>

using namespace culebra;
using namespace std;

bool read_file(const char* path, vector<char>& buff)
{
    ifstream ifs(path, ios::in|ios::binary);
    if (ifs.fail()) {
        return false;
    }

    auto size = static_cast<unsigned int>(ifs.seekg(0, ios::end).tellg());

    if (size > 0) {
        buff.resize(size);
        ifs.seekg(0, ios::beg).read(&buff[0], static_cast<streamsize>(buff.size()));
    }

    return true;
}

int repl(shared_ptr<Environment> env, bool print_ast)
{
    for (;;) {
        auto line = linenoise::Readline("cul> ");

        if (line == "exit" || line == "quit") {
            break;
        }

        if (!line.empty()) {
            Value val;
            string msg;
            if (run("(repl)", env, line.c_str(), line.size(), val, msg, print_ast)) {
                cout << val << endl;
                linenoise::AddHistory(line.c_str());
            } else if (!msg.empty()) {
                cout << msg << endl;;
            }
        }
    }

    return 0;
}

int main(int argc, const char** argv)
{
    auto print_ast = false;
    auto shell = false;
    vector<const char*> path_list;

    int argi = 1;
    while (argi < argc) {
        auto arg = argv[argi++];
        if (string("--shell") == arg) {
            shell = true;
        } else if (string("--ast") == arg) {
            print_ast = true;
        } else {
            path_list.push_back(arg);
        }
    }
{'fraction_non_alphanumeric': 0.1602809706257982, 'fraction_numerical': 0.0038314176245210726, 'mean_word_length': 1.986653956148713, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 23, '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': '4070869', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1018, 'n_words': 246}