<commit_before>/**
 * formula-parser v1.0.2
 * (http://github.com/rkirsling/formula-parser)
 *
 * Copyright (c) 2015 <NAME>
 * Released under the MIT License.
 */
'use strict';

var MIN_PRECEDENCE = 0;

/**
 * Returns the remainder of a given string after slicing off
 * the length of a given symbol and any following whitespace.
 *
 * @private
 * @param {string} str    - a string to slice
 * @param {string} symbol - an initial substring
 * @returns {string}
 */
function sliceSymbol(str, symbol) {
  var tail = str.slice(symbol.length);
  var whitespace = tail.match(/^\s*/)[0];
  return tail.slice(whitespace.length);
}

/**
 * Attempts to match a given list of operators against the head of a given string.
 * Returns the first match if successful, otherwise null.
 *
 * @private
 * @param {string}   str          - a string to match against
 * @param {Object[]} operatorList - an array of operator definitions
 * @returns {?Object}
 */
function matchOperator(str, operatorList) {
  return operatorList.reduce(function (match, operator) {
    return match ? match :
      str.indexOf(operator.symbol) === 0 ? operator : null;
  }, null);
}

/**
 * Attempts to parse a variable at the head of a given string.
 * Returns an AST node and string remainder if successful, otherwise null.
 *
 * @private
 * @param {Object} self - a FormulaParser instance<commit_msg>Handle the case when one operator symbol is a prefix of another one<commit_after>/**
 * formula-parser v1.0.2
 * (http://github.com/rkirsling/formula-parser)
 *
 * Copyright (c) 2015 <NAME>
 * Released under the MIT License.
 */
'use strict';

var MIN_PRECEDENCE = 0;

/**
 * Returns the remainder of a given string after slicing off
 * the length of a given symbol and any following whitespace.
 *
 * @private
 * @param {string} str    - a string to slice
 * @param {string} symbol - an initial substring
 * @returns {string}
 */
function sliceSymbol(str, symbol) {
  var tail = str.slice(symbol.length);
  var whitespace = tail.match(/^\s*/)[0];
  return tail.slice(whitespace.length);
}

/**
 * Attempts to match a given list of operators against the head of a given string.
 * Returns the match having the longest symbol if successful, otherwise null.
 *
 * @private
 * @param {string}   str          - a string to match against
 * @param {Object[]} operatorList - an array of operator definitions
 * @returns {?Object}
 */
function matchOperator(str, operatorList) {
  return operatorList.reduce(function (longestMatch, operator) {
    return str.indexOf(operator.symbol) === 0 &&
      (!longestMatch || operator.symbol.length > longestMatch.symbol.length) ?
      operator : longestMatch;
  }, null);
}

/**
 * Attempts to parse a variable at the head of a given string.
 * Returns an AST node and string remainder if successful, otherwise null.
 *
 * @private
 * @param {Object} self - a FormulaParser instance
{'fraction_non_alphanumeric': 0.11515782171349288, 'fraction_numerical': 0.00693721817551162, 'mean_word_length': 3.548895899053628, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1253629', 'n_tokens_mistral': 848, 'n_tokens_neox': 825, 'n_words': 319}