<commit_before>#include <exception>
#include <iostream>
#include <vector>
#include <context.h>
#include <parser.h>
#include <image.h>
#include <exception.h>
#include <cxxopts.hpp>
#include <CLIbuiltinDrawAST.h>

using namespace std;
using namespace ast;
using namespace parser;
using namespace lexers;
using namespace cxxopts;
using namespace context;
using namespace exception;

INITIALIZE_EASYLOGGINGPP

int main(int argc, char *argv[]) {
    START_EASYLOGGINGPP(argc, argv);
    el::Logger *parserLogger = el::Loggers::getLogger("parser");
    el::Logger *exceptionLogger = el::Loggers::getLogger("exception");
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::ToFile, "false");
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format,
                                       "[%logger] %msg [%fbase:%line]");
    try {
        Options options(argv[0], " - command line options");
        options.add_options()("o,output", "output filename", value<std::string>()->default_value("output.bmp"));
        options.parse(argc, argv);

        Scope scope;
        Image image(1000, 1000);
        scope.addBuiltinFunc("#painter", std::make_shared<ast::CLIBuiltinDrawAST>(image));
        Lexer lex;
        lex.appendExp("(load \"setup.scm\")").appendExp(string("(load \"") + argv[argc - 1] + "\")");
        shared_ptr<ExprAST> ptr = parseAllExpr(lex)->eval(scope);
        if (ptr) {
            cout << ptr->display();
        }
        image.save(options["output"].as<string>().c_str());
    } catch (RuntimeError &e) {
        cout << e.what() << endl;
        throw;
    } catch (const OptionException &e) {<commit_msg>support positional arguments<commit_after>#include <exception>
#include <iostream>
#include <vector>
#include <context.h>
#include <parser.h>
#include <image.h>
#include <exception.h>
#include <cxxopts.hpp>
#include <CLIbuiltinDrawAST.h>

using namespace std;
using namespace ast;
using namespace parser;
using namespace lexers;
using namespace cxxopts;
using namespace context;
using namespace exception;

INITIALIZE_EASYLOGGINGPP

int main(int argc, char *argv[]) {
    START_EASYLOGGINGPP(argc, argv);
    el::Logger *parserLogger = el::Loggers::getLogger("parser");
    el::Logger *exceptionLogger = el::Loggers::getLogger("exception");
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::ToFile, "false");
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format,
                                       "[%logger] %msg [%fbase:%line]");
    try {
        Options options(argv[0], " - command line options");
        options.add_options()("o,output", "output filename", value<std::string>()->default_value("output.bmp"))
                ("src", "src filename", cxxopts::value<std::vector<std::string>>());
        options.parse_positional("src");
        options.parse(argc, argv);

        Lexer lex;
        Scope scope;
        Image image(1000, 1000);
        scope.addBuiltinFunc("#painter", std::make_shared<ast::CLIBuiltinDrawAST>(image));
        lex.appendExp("(load \"setup.scm\")");
        parseAllExpr(lex)->eval(scope);
        auto &v = options["src"].as<std::vector<std::string>>();
        for (const auto &s : v) {
            lex.appendExp(string("(load \"") + s + "\")");
            shared_ptr<ExprAST> ptr = parseAllExpr(lex)->eval(scope);
            if (ptr) {
                cout << ptr->display();
            }
        }
        image.save(options["output"].as<string>().c_str());
    } catch (RuntimeError &e) {
        cout << e.what() << endl;
        throw;
    } catch (const OptionException &e) {
{'fraction_non_alphanumeric': 0.1645850679988898, 'fraction_numerical': 0.00527338329170136, 'mean_word_length': 3.493765586034913, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6911167', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1099, 'n_words': 222}