<commit_before>'use strict';

var kmp = require('kmp-matcher').kmp;


module.exports = function (query) {
  if (!query.length) {
    return [];
  }

  var xpathResult = document.evaluate('//text()[contains(.,"' + query + '")]',
                                      document, null, XPathResult.ANY_TYPE, null);
  var result = [];
  var node;
  while (node = xpathResult.iterateNext()) {
    kmp(node.textContent, query)
      .forEach(function (start) {
        var range = document.createRange();
        range.setStart(node, start);
        range.setEnd(node, start + query.length);
        result.push(range);<commit_msg>Add error message for &quot;<commit_after>'use strict';

var kmp = require('kmp-matcher').kmp;


module.exports = function (query) {
  if (!query.length) {
    return [];
  }

  if (query.indexOf('"') >= 0) {
    throw new Error('Unimplemented: can\'t match &quot;');
  }

  var xpathResult = document.evaluate('//text()[contains(.,"' + query + '")]',
                                      document, null, XPathResult.ANY_TYPE, null);
  var result = [];
  var node;
  while (node = xpathResult.iterateNext()) {
    kmp(node.textContent, query)
      .forEach(function (start) {
        var range = document.createRange();
        range.setStart(node, start);
        range.setEnd(node, start + query.length);
        result.push(range);
{'fraction_non_alphanumeric': 0.16176470588235295, 'fraction_numerical': 0.0007352941176470588, 'mean_word_length': 2.6586021505376345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3445287', 'n_tokens_mistral': 430, 'n_tokens_neox': 414, 'n_words': 90}