code: def transform(pattern):
      
      result = []
      groups = [[pattern]]
      while groups:
          children = groups.pop(0)
          parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
          if any(t in map(type, children) for t in parents):
              child = [c for c in children if type(c) in parents][0]
              children.remove(child)
              if type(child) is Either:
                  for c in child.children:
                      groups.append([c] + children)
              elif type(child) is OneOrMore:
                  groups.append(child.children * 2 + children)
              else:
                  groups.append(child.children + children)
          else:
              result.append(children)
      return Either(*[Required(*e) for e in result])
docs: Expand pattern into an (almost) equivalent one, but with single Either.
  
      Example: ((-a | -b) (-c | -d)) => (-a -c | -a -d | -b -c | -b -d)
      Quirks: [-a] => (-a), (-a...) => (-a -a)