<commit_before>var path = require('path'),
    sys = require('util'),
    fs = require('fs');

var less = {
    version: [1, 1, 6],
    Parser: require('./parser').Parser,
    importer: require('./parser').importer,
    tree: require('./tree'),
    render: function (input, options, callback) {
        options = options || {};

        if (typeof(options) === 'function') {
            callback = options, options = {};
        }

        var parser = new(less.Parser)(options),
            ee;

        if (callback) {
            parser.parse(input, function (e, root) {
                callback(e, root.toCSS(options));
            });
        } else {
            ee = new(require('events').EventEmitter);

            process.nextTick(function () {
                parser.parse(input, function (e, root) {
                    if (e) { ee.emit('error', e) }
                    else   { ee.emit('success', root.toCSS(options)) }
                });
            });
            return ee;
        }
    },
    writeError: function (ctx, options) {
        options = options || {};

        var message = "";
        var extract = ctx.extract;
        var error = [];
        var stylize = options.color ? less.stylize : function (str) { return str };

        if (options.silent) { return }

        if (!ctx.index) {
            return sys.error(ctx.stack || ctx.message);
        }

        if (typeof(extract[0]) === 'string') {
            error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
        }

        error.push(ctx.line + ' ' + extract[1].slice(0, ctx.column)
                            + stylize(stylize(extract[1][ctx.column], 'bold')
                            + extract[1].slice(ctx.column + 1), 'yellow'));

        if (typeof(extract[2]) === 'string') {
            error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
        }
        error = error.join('\n') + '\033[0m\n';

        message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
        ctx.filename && (message += stylize(' in ', 'red') + ctx.filename +
                stylize(':' + ctx.line + ':' + ctx.column, 'grey'));

        sys.error(message, error);

        if (ctx.callLine) {<commit_msg>fix error reporting when index == 0<commit_after>var path = require('path'),
    sys = require('util'),
    fs = require('fs');

var less = {
    version: [1, 1, 6],
    Parser: require('./parser').Parser,
    importer: require('./parser').importer,
    tree: require('./tree'),
    render: function (input, options, callback) {
        options = options || {};

        if (typeof(options) === 'function') {
            callback = options, options = {};
        }

        var parser = new(less.Parser)(options),
            ee;

        if (callback) {
            parser.parse(input, function (e, root) {
                callback(e, root.toCSS(options));
            });
        } else {
            ee = new(require('events').EventEmitter);

            process.nextTick(function () {
                parser.parse(input, function (e, root) {
                    if (e) { ee.emit('error', e) }
                    else   { ee.emit('success', root.toCSS(options)) }
                });
            });
            return ee;
        }
    },
    writeError: function (ctx, options) {
        options = options || {};

        var message = "";
        var extract = ctx.extract;
        var error = [];
        var stylize = options.color ? less.stylize : function (str) { return str };

        if (options.silent) { return }

        if (!ctx.hasOwnProperty('index')) {
            return sys.error(ctx.stack || ctx.message);
        }

        if (typeof(extract[0]) === 'string') {
            error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
        }

        error.push(ctx.line + ' ' + extract[1].slice(0, ctx.column)
                            + stylize(stylize(extract[1][ctx.column], 'bold')
                            + extract[1].slice(ctx.column + 1), 'yellow'));

        if (typeof(extract[2]) === 'string') {
            error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
        }
        error = error.join('\n') + '\033[0m\n';

        message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
        ctx.filename && (message += stylize(' in ', 'red') + ctx.filename +
                stylize(':' + ctx.line + ':' + ctx.column, 'grey'));

        sys.error(message, error);

        if (ctx.callLine) {
{'fraction_non_alphanumeric': 0.1767857142857143, 'fraction_numerical': 0.008258928571428572, 'mean_word_length': 1.7306520414381474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1630422', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1296, 'n_words': 273}