code: func newGenerator(regexp *syntax.Regexp, args *GeneratorArgs) (generator *internalGenerator, err error) {
  	simplified := regexp.Simplify()
  
  	factory, ok := generatorFactories[simplified.Op]
  	if ok {
  		return factory(simplified, args)
  	}
  
  	return nil, fmt.Errorf("invalid generator pattern: /%s/ as /%s/\n%s",
  		regexp, simplified, inspectRegexpToString(simplified))
  }
docs: // Create a new generator for r.