function SourceFilterParser(filterText) {
    // Final output will be stored here.
    this.filter = null;
    this.sort = {};
    this.filterTextWithoutSort = '';
    var filterList = parseFilter_(filterText);

    // Text filters are stored here as strings and then added as a function at
    // the end, for performance reasons.
    var textFilters = [];

    // Filter functions are first created individually, and then merged.
    var filterFunctions = [];

    for (var i = 0; i < filterList.length; ++i) {
      var filterElement = filterList[i].parsed;
      var negated = filterList[i].negated;

      var sort = parseSortDirective_(filterElement, negated);
      if (sort) {
        this.sort = sort;
        continue;
      }

      this.filterTextWithoutSort += filterList[i].original;

      var filter = parseRestrictDirective_(filterElement, negated);
      if (!filter)
        filter = parseStringDirective_(filterElement, negated);
      if (filter) {
        if (negated) {
          filter = (function(func, sourceEntry) {
                     return !func(sourceEntry);
                   }).bind(null, filter);
        }
        filterFunctions.push(filter);
        continue;
      }
      textFilters.push({text: filterElement, negated: negated});
    }

    // Create a single filter for all text filters, so they can share a
    // TabePrinter.
    filterFunctions.push(textFilter_.bind(null, textFilters));

    // Create function to go through all the filters.
    this.filter = function(sourceEntry) {
      for (var i = 0; i < filterFunctions.length; ++i) {
        if (!filterFunctions[i](sourceEntry))
          return false;
      }
      return true;
    };
  }
/**
   * Parses |filterText|, extracting a sort method, a list of filters, and a
   * copy of |filterText| with all sort parameters removed.
   */
Parses |filterText|, extracting a sort method, a list of filters, and a
copy of |filterText| with all sort parameters removed.
Parses |filterText| extracting a sort method a list of filters and a copy of |filterText| with all sort parameters removed .
function SourceFilterParser(filterText) {
    this.filter = null;
    this.sort = {};
    this.filterTextWithoutSort = '';
    var filterList = parseFilter_(filterText);
    var textFilters = [];
    var filterFunctions = [];
    for (var i = 0; i < filterList.length; ++i) {
      var filterElement = filterList[i].parsed;
      var negated = filterList[i].negated;
      var sort = parseSortDirective_(filterElement, negated);
      if (sort) {
        this.sort = sort;
        continue;
      }
      this.filterTextWithoutSort += filterList[i].original;
      var filter = parseRestrictDirective_(filterElement, negated);
      if (!filter)
        filter = parseStringDirective_(filterElement, negated);
      if (filter) {
        if (negated) {
          filter = (function(func, sourceEntry) {
                     return !func(sourceEntry);
                   }).bind(null, filter);
        }
        filterFunctions.push(filter);
        continue;
      }
      textFilters.push({text: filterElement, negated: negated});
    }
    filterFunctions.push(textFilter_.bind(null, textFilters));
    this.filter = function(sourceEntry) {
      for (var i = 0; i < filterFunctions.length; ++i) {
        if (!filterFunctions[i](sourceEntry))
          return false;
      }
      return true;
    };
  }
function SourceFilterParser ( filterText ) { this . filter = null ; this . sort = { } ; this . filterTextWithoutSort = '' ; var filterList = parseFilter_ ( filterText ) ; var textFilters = [ ] ; var filterFunctions = [ ] ; for ( var i = 0 ; i < filterList . length ; ++ i ) { var filterElement = filterList [ i ] . parsed ; var negated = filterList [ i ] . negated ; var sort = parseSortDirective_ ( filterElement , negated ) ; if ( sort ) { this . sort = sort ; continue ; } this . filterTextWithoutSort += filterList [ i ] . original ; var filter = parseRestrictDirective_ ( filterElement , negated ) ; if ( ! filter ) filter = parseStringDirective_ ( filterElement , negated ) ; if ( filter ) { if ( negated ) { filter = ( function ( func , sourceEntry ) { return ! func ( sourceEntry ) ; } ) . bind ( null , filter ) ; } filterFunctions . push ( filter ) ; continue ; } textFilters . push ( { text : filterElement , negated : negated } ) ; } filterFunctions . push ( textFilter_ . bind ( null , textFilters ) ) ; this . filter = function ( sourceEntry ) { for ( var i = 0 ; i < filterFunctions . length ; ++ i ) { if ( ! filterFunctions [ i ] ( sourceEntry ) ) return false ; } return true ; } ; }
Parses |filterText|, extracting a sort method, a list of filters, and a
 copy of |filterText| with all sort parameters removed.
Parses |filterText| extracting a sort method a list of filters and a copy of |filterText| with all sort parameters removed .
// Final output will be stored here. // Text filters are stored here as strings and then added as a function at // the end, for performance reasons. // Filter functions are first created individually, and then merged. // Create a single filter for all text filters, so they can share a // TabePrinter. // Create function to go through all the filters.