function expand(token) {
    if (token.type === lib.types.CHAR) {
      return new discontinuousRange(token.value);
    } else if (token.type === lib.types.RANGE) {
      return new discontinuousRange(token.from, token.to);
    } else {
      var drange = new discontinuousRange();
      for (var i = 0; i < token.set.length; i++) {
        var subrange = expand.call(this, token.set[i]);
        drange.add(subrange);
        if (this.ignoreCase) {
          for (var j = 0; j < subrange.length; j++) {
            var code = subrange.index(j);
            var otherCaseCode = toOtherCase(code);
            if (code !== otherCaseCode) {
              drange.add(otherCaseCode);
            }
          }
        }
      }
      if (token.not) {
        return this.defaultRange.clone().subtract(drange);
      } else {
        return drange;
      }
    }
  }
expands a token to a DiscontinuousRange of characters which has a
length and an index function (for random selecting)

@param {Object} token
@return {DiscontinuousRange}