<commit_before>/**
 * Extract the chosen Field and the list name from the query.
 * The query part of the workingObject will remain only with the SELECT statement (if found)
 * @param  {CamlSql~ParsedQuery} workingObject The working object to process
 */
function extractListAndFieldNameParts(workingObject) {
  var query = workingObject.query,
      fields = [],
      listName,
      t,
      i,
      m = query.match(/^SELECT\s(.*?)(?:\sFROM\s(.*?)|)(?:\s+((?:order|where).*)$|$)/i);

  if (m) {
    if (m.length == 4) {
      fields = parseFieldNames(m[1]);
      for (i=0; i < fields.length; i++) {

        if ((t = fields[i].match(/^(.*?)\.(.*?)\sas\s(.*?)$/i))) {
          workingObject.projectedFields.push({
            list : t[1],
            field : t[2],
            name : t[3]
          });
          fields[i] = formatFieldName(t[3]);
        } else if (fields[i].indexOf('.') !== -1) {
          throw "[camlsql] Projected fields in the format <list>.<field_name> must be followed with an AS <alias> ("+fields[i]+")";
        }

        if (!fields[i].match(/^[a-z:A-Z_\\d]+$/)) {
          if (console.warn) console.warn("[camlsql] Doubtful field name: " + fields[i]);
        }
      }
      workingObject.fields = fields;
      workingObject.listName = formatFieldName(m[2]);
      workingObject.query = m[3];
    } else {
      workingObject.query = "";
    }
  }
}

/**
 * Attempt to parse the list of field names into an array of strings<commit_msg>Fixed small field name check-issue<commit_after>/**
 * Extract the chosen Field and the list name from the query.
 * The query part of the workingObject will remain only with the SELECT statement (if found)
 * @param  {CamlSql~ParsedQuery} workingObject The working object to process
 */
function extractListAndFieldNameParts(workingObject) {
  var query = workingObject.query,
      fields = [],
      listName,
      t,
      i,
      m = query.match(/^SELECT\s(.*?)(?:\sFROM\s(.*?)|)(?:\s+((?:order|where).*)$|$)/i);

  if (m) {
    if (m.length == 4) {
      fields = parseFieldNames(m[1]);
      for (i=0; i < fields.length; i++) {

        if ((t = fields[i].match(/^(.*?)\.(.*?)\sas\s(.*?)$/i))) {
          workingObject.projectedFields.push({
            list : t[1],
            field : t[2],
            name : t[3]
          });
          fields[i] = formatFieldName(t[3]);
        } else if (fields[i].indexOf('.') !== -1) {
          throw "[camlsql] Projected fields in the format <list>.<field_name> must be followed with an AS <alias> ("+fields[i]+")";
        }

        if (!fields[i].match(/^[a-z:A-Z_\d]+$/)) {
          if (console.warn) console.warn("[camlsql] Doubtful field name: " + fields[i]);
        }
      }
      workingObject.fields = fields;
      workingObject.listName = formatFieldName(m[2]);
      workingObject.query = m[3];
    } else {
      workingObject.query = "";
    }
  }
}

/**
 * Attempt to parse the list of field names into an array of strings
{'fraction_non_alphanumeric': 0.1778975741239892, 'fraction_numerical': 0.006738544474393531, 'mean_word_length': 2.4009163802978235, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '6201132', 'n_tokens_mistral': 980, 'n_tokens_neox': 961, 'n_words': 243}