<commit_before>#include <stdio.h>
#include <stdlib.h>

#include <node.h>
#include <nan.h>
//#include "node_pointer.h"

using namespace v8;

#include <lua.hpp>
// #include <luajit.h>

// #include <emscripten.h>
#include <stdlib.h>
#include <string.h>

#define BUF_SIZE 1024


uint8_t* buffer_pointer = NULL;
size_t buffer_pointer_len = 0;

static int bufbuilder(lua_State* L, unsigned char* str, size_t len, struct luaL_Buffer *buf)
{
	buffer_pointer = (uint8_t*) realloc(buffer_pointer, buffer_pointer_len + len);
	memcpy(&buffer_pointer[buffer_pointer_len], str, len);
	buffer_pointer_len += len;
    return 0;
}

Persistent<Object> sourcemap_handle;

extern "C" {
int _lua_sourcemap (int i)
{
    Local<Object> sourcemap = NanNew(sourcemap_handle);
    int line = sourcemap->Get(NanNew<Number>(i - 1))->NumberValue();
    if (line <= 0) {
        line = sourcemap->Get(NanNew<Number>(sourcemap->Get(NanSymbol("length"))->NumberValue() - 1))->NumberValue();
    }
    if (line <= 0) {
        line = 1;
    }
    return line;
}
}

lua_State *L;

int go_for_it (char *content, size_t contentSize, const char* name)
{
    luaL_Buffer buf;
    int res;
    L = lua_open();  /* create state */
    luaL_buffinit(L, &buf);
<commit_msg>Corrects line numbers.<commit_after>#include <stdio.h>
#include <stdlib.h>

#include <node.h>
#include <nan.h>
//#include "node_pointer.h"

using namespace v8;

#include <lua.hpp>
// #include <luajit.h>

// #include <emscripten.h>
#include <stdlib.h>
#include <string.h>

#define BUF_SIZE 1024


uint8_t* buffer_pointer = NULL;
size_t buffer_pointer_len = 0;

static int bufbuilder(lua_State* L, unsigned char* str, size_t len, struct luaL_Buffer *buf)
{
	buffer_pointer = (uint8_t*) realloc(buffer_pointer, buffer_pointer_len + len);
	memcpy(&buffer_pointer[buffer_pointer_len], str, len);
	buffer_pointer_len += len;
    return 0;
}

Persistent<Object> sourcemap_handle;

extern "C" {
int _lua_sourcemap (int i)
{
    Local<Object> sourcemap = NanNew(sourcemap_handle);
    int line = sourcemap->Get(NanNew<Number>(i - 1))->NumberValue();
    if (line <= 0) {
        line = sourcemap->Get(NanNew<Number>(sourcemap->Get(NanSymbol("length"))->NumberValue() - 1))->NumberValue();
    }
    if (line <= 0) {
        line = 0;
    }
    return line + 1;
}
}

lua_State *L;

int go_for_it (char *content, size_t contentSize, const char* name)
{
    luaL_Buffer buf;
    int res;
    L = lua_open();  /* create state */
    luaL_buffinit(L, &buf);

{'fraction_non_alphanumeric': 0.1503030303030303, 'fraction_numerical': 0.011717171717171718, 'mean_word_length': 4.094650205761317, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 41, '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': '3675863', 'n_tokens_mistral': 966, 'n_tokens_neox': 915, 'n_words': 213}