substring method

  1. @override
Parser<Filter> substring()
override

Implementation

@override
Parser<Filter> substring() => super.substring().map((each) {
      var init = each[2];
      var finalVal = each[4];
      var any = _flatten(each[3]);

      // There is a special case where the substring grammar also
      // matches the present filter. This can possibly
      // be fixed in the grammar spec - but this works:
      if (init == null && finalVal == null && any.isEmpty) {
        return Filter.present(each[0]);
      }

      return SubstringFilter.rfc224(each[0], // attribute name
          initial: init,
          any: any,
          finalValue: finalVal);
    });