function makeRules(prefixedRuleGroups) {
    Object.entries(prefixedRuleGroups).forEach(([seqPrefix, rules]) => {
      rules.forEach((rule, i) => {
        const {match, type, style} = rule;
        if (typeof match !== 'function') {
          if (typeof match === 'string') {
            rule.match = ctx => ctx.type === type && ctx.text === match;
          } else if (match instanceof RegExp) {
            rule.match = type
              ? ctx => ctx.type === type && match.test(ctx.text)
              : ctx => match.test(ctx.text);
          } else {
            rule.match = ctx => ctx.type === type;
          }
        }
        if (rule.id === undefined) {
          rule.id = i ? `${seqPrefix}-${i}` : '';
        }
        if (rule.next === undefined) {
          rule.next = `${seqPrefix}-${i + 1}`;
        }
        if (rule.id) {
          rulesById[rule.id] = [rule];
        }
        if (style === 'comment') {
          rulesByLangCmt.push(rule);
        }
        (rulesByType[type || ''] || (rulesByType[type || ''] = [])).push(rule);
      });
    });
  }
@param {Object<string,Rule[]>} prefixedRuleGroups
@return {Rule[]}