docs: function build_rule(filters, short, expr, desc) {
      var optional, filter;
      var m = expr.match(EXT_RULE_RE);
      if(m == null) throw OptError('The switch is not well-formed.');
      var long = m[1] || m[3];
      if(m[2] != undefined) {
          // A switch argument is expected. Check if the argument is optional,
          // then find a filter that suites.
          var optional_match = ARG_OPTIONAL_RE.test(m[2]);
          var filter_name = optional_match === null ? m[2] : optional_match[1];
          optional = optional_match !== null;
          filter = filters[filter_name];
          if(filter === undefined) filter = filters[DEFAULT_FILTER];
      }
      return {
          name: long.substr(2),
          short: short,
          long: long,
          decl: expr,
          desc: desc,
          optional_arg: optional,
          filter: filter
      }
  }