code: 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
      }
  }
docs: Builds a rule with specified expression, short style switch and help. This function expects a dict with filters to work correctly.  Return format: name               The name of the switch. short              The short style switch long               The long style switch decl               The declaration expression (the input expression) desc               The optional help section for the switch optional_arg       Indicates that switch argument is optional filter             The filter to use when parsing the arg. An <<undefined>> value means that the switch does not take anargument.