<commit_before>var util = require('util'),
    ometajs = require('../../ometajs'),
    globals = ometajs.globals,
    grammars = ometajs.grammars;

//
// ### function StringBuffer(*contents)
// #### contents - any number of string arguments
// @constructor
//
function StringBuffer() {
  this.buffer = [];
  for (var i = 0; i < arguments.length; i++) {
    this.put(arguments[idx]);
  }
};
exports.StringBuffer = StringBuffer;

//
// ### function put(item)
// #### @item {String} item to put in
// Put item into buffer
//
StringBuffer.prototype.put = function put(item) {
  this.buffer.push(item);

  return this;
};

//
// ### function contents()
// Return joined contents of the buffer
//
StringBuffer.prototype.contents = function contents()  {
  return this.buffer.join('');
};

//
// ### function objectThatDelegatesTo(obj, props)
// #### @obj {Object} parent object
// #### @props {Object} object to merge result with
// Returns object with merged properties of `obj` and `props`
//
function objectThatDelegatesTo(obj, props) {
  // Regular case
  if (typeof obj.prototype !== 'function') {
    var clone = Object.create(obj || {});

    Object.getOwnPropertyNames(props || {}).forEach(function(key) {
      clone[key] = props[key];
    });

    return clone;
  }

  // When old ometajs grammar is trying to inherit from the new one:
  //
  // 1. Create wrapper
  function Wrapper(source) {
    obj.call(this, source);
  }
  util.inherits(Wrapper, obj);
  Wrapper.match = grammars.AbstractGrammar.match;
  Wrapper.matchAll = grammars.AbstractGrammar.matchAll;

  var adapter = Object.create(globals.OMeta);
  adapter._genericApply = function genericApply(recv, rule, args) {<commit_msg>utils: fix for fix<commit_after>var util = require('util'),
    ometajs = require('../../ometajs'),
    globals = ometajs.globals,
    grammars = ometajs.grammars;

//
// ### function StringBuffer(*contents)
// #### contents - any number of string arguments
// @constructor
//
function StringBuffer() {
  this.buffer = [];
  for (var i = 0; i < arguments.length; i++) {
    this.put(arguments[idx]);
  }
};
exports.StringBuffer = StringBuffer;

//
// ### function put(item)
// #### @item {String} item to put in
// Put item into buffer
//
StringBuffer.prototype.put = function put(item) {
  this.buffer.push(item);

  return this;
};

//
// ### function contents()
// Return joined contents of the buffer
//
StringBuffer.prototype.contents = function contents()  {
  return this.buffer.join('');
};

//
// ### function objectThatDelegatesTo(obj, props)
// #### @obj {Object} parent object
// #### @props {Object} object to merge result with
// Returns object with merged properties of `obj` and `props`
//
function objectThatDelegatesTo(obj, props) {
  // Regular case
  if (typeof obj !== 'function') {
    var clone = Object.create(obj || {});

    Object.getOwnPropertyNames(props || {}).forEach(function(key) {
      clone[key] = props[key];
    });

    return clone;
  }

  // When old ometajs grammar is trying to inherit from the new one:
  //
  // 1. Create wrapper
  function Wrapper(source) {
    obj.call(this, source);
  }
  util.inherits(Wrapper, obj);
  Wrapper.match = grammars.AbstractGrammar.match;
  Wrapper.matchAll = grammars.AbstractGrammar.matchAll;

  var adapter = Object.create(globals.OMeta);
  adapter._genericApply = function genericApply(recv, rule, args) {
{'fraction_non_alphanumeric': 0.16040248594258658, 'fraction_numerical': 0.0011837821840781297, 'mean_word_length': 3.4298820445609435, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1654345', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1060, 'n_words': 275}