parseRegex = (regex) => {
  const key = regex.toString();
  let literal = astCache.get(key);
  if (literal === undefined) {
    const flags = parser.parseFlags(regex.flags, undefined);
    const pattern = parser.parsePattern(regex.source, undefined, undefined, flags.unicode);
    literal = { pattern, flags };
    astCache.set(key, literal);
  }
  return literal;
}
Returns the AST of a given pattern.

@param {RegExp} regex
@returns {LiteralAST}