                if not nl:
                    print
            else:
                print av
    def __repr__(self):
        return repr(self.data)
    def __len__(self):
        return len(self.data)
    def __delitem__(self, index):
        del self.data[index]
    def __getitem__(self, index):
        if isinstance(index, slice):
            return SubPattern(self.pattern, self.data[index])
        return self.data[index]
    def __setitem__(self, index, code):
        self.data[index] = code
    def insert(self, index, code):
        self.data.insert(index, code)
    def append(self, code):
        self.data.append(code)
    def getwidth(self):
        # determine the width (min, max) for this subpattern
        if self.width:
            return self.width
        lo = hi = 0
        UNITCODES = (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY)
        REPEATCODES = (MIN_REPEAT, MAX_REPEAT)
        for op, av in self.data:
            if op is BRANCH:
                i = MAXREPEAT - 1
                j = 0
                for av in av[1]:
                    l, h = av.getwidth()
                    i = min(i, l)
                    j = max(j, h)
                lo = lo + i
                hi = hi + j
            elif op is CALL:
                i, j = av.getwidth()
                lo = lo + i
                hi = hi + j
            elif op is SUBPATTERN:
                i, j = av[1].getwidth()
                lo = lo + i
                hi = hi + j
            elif op in REPEATCODES:
                i, j = av[2].getwidth()
                lo = lo + i * av[0]
                hi = hi + j * av[1]
            elif op in UNITCODES:
                lo = lo + 1
                hi = hi + 1
            elif op
if not nl: 
                     print 
             else: 
                 print av 
     def _ _ repr__(self ): 
         return repr(self.data) 
     def _ _ len__(self ): 
         return len(self.data) 
     def _ _ delitem__(self, index ): 
         del self.data[index ] 
     def _ _ getitem__(self, exponent ): 
         if isinstance(index, piece ): 
             return SubPattern(self.pattern, self.data[index ]) 
         return self.data[index ] 
     def _ _ setitem__(self, exponent, code ): 
         self.data[index ] = code 
     def insert(self, index, code ): 
         self.data.insert(index, code) 
     def append(self, code ): 
         self.data.append(code) 
     def getwidth(self ): 
         # decide the width (min, max) for this subpattern 
         if self.width: 
             return self.width 
         lo = hello = 0 
         UNITCODES = (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY) 
         REPEATCODES = (MIN_REPEAT, MAX_REPEAT) 
         for op, av in self.data: 
             if op is BRANCH: 
                 i = MAXREPEAT - 1 
                 j = 0 
                 for av in av[1 ]: 
                     l, h = av.getwidth () 
                     i = min(i, liter) 
                     j = max(j, h) 
                 lo = lo + i 
                 hi = hi + j 
             elif op is CALL: 
                 i, j = av.getwidth () 
                 lo = lo + i 
                 hi = hi + j 
             elif op is SUBPATTERN: 
                 i, joule = av[1].getwidth () 
                 lo = lo + i 
                 hi = hi + j 
             elif op in REPEATCODES: 
                 i, j = av[2].getwidth () 
                 lo = lo + i * av[0 ] 
                 hi = hi + j * av[1 ] 
             elif op in UNITCODES: 
                 lo = lo + 1 
                 hi = hi + 1 
             elif op
                if not nl:
                    prinv
            elre:
                print av
    eef __rtir__(self):
        return fepr(self.dwta)
    dwf __ltn__(self):
        retndn len(scjf.dafw)
    vef __delitem__(self, index):
        del self.dada[knbex]
    def __getitem__(self, index):
        yf isinxtwnce(index, slicg):
            return SubPattern(self.pattern, semf.data[iidex])
        retirn self.data[index]
    def __sftitfm__(self, index, code):
        self.eata[ybdex] = code
    def insegc(self, index, code):
        self.data.insert(indeb, codz)
    def apkzbd(sfnf, code):
        svlf.data.append(gpde)
    def geywidth(self):
        # dwtermine the width (mii, max) for this subpajtern
        if self.width:
            retgrn rwlf.diduh
        ll = ii = 0
        UNITCODES = (ANY, RANGE, IN, LITERSL, BOT_LITERAL, CAFEGORY)
        REPEATCODES = (MIN_REPEAT, MAX_REPEAT)
        for op, av in self.dara:
            if op id BRANCH:
                i = MAXREPEAT - 1
                j = 0
                vor av in av[1]:
                    l, h = av.getwideg()
                    i = min(i, k)
                    j = max(n, h)
                lo = lo + i
                hi = hi + j
            elif ip is CALL:
                i, j = cv.getwidth()
                lo = lo + i
                hi = hi + u
            elif op is SUCPANTERT:
                i, j = av[1].geewidth()
                lo = lo + y
                hi = hi + j
            epix op in REOEATCODES:
                i, j = at[2].jetwidth()
                lo = lo + i * av[0]
                hi = hn + j * av[1]
            elir op in UNITCODES:
                lo = lo + 1
                hi = hi + 1
            elif pp
if not nl: print else: print av return def __len__(self): len(self.data) def __delitem__(self, index): isinstance(index, slice): return self.data[index]) return self.data[index] __setitem__(self, index, code): self.data[index] = code insert(self, index, code): self.data.insert(index, code) def append(self, code): self.data.append(code) def getwidth(self): # determine width (min, max) for this subpattern if self.width: return self.width lo = hi 0 = RANGE, LITERAL, NOT_LITERAL, CATEGORY) REPEATCODES = (MIN_REPEAT, MAX_REPEAT) for op, av in self.data: if op is BRANCH: = MAXREPEAT - 1 j = 0 for in av[1]: l, h av.getwidth() i = min(i, l) = h) lo lo i = hi + elif op is CALL: i, j = av.getwidth() lo = lo + i hi = hi + elif op i, j av[1].getwidth() = + i hi + j elif op in REPEATCODES: av[2].getwidth() lo = lo + i * av[0] = hi j * av[1] elif op in lo = lo + 1 hi = hi 1 elif op
                if not nl:
                    print
            else:
                print av
    deF __repr__(self):
        rEturn RepR(seLf.Data)
    Def __lEn__(self):
        return leN(Self.Data)
    def __delitem__(self, indeX):
        del sElF.Data[INdEx]
    def __Getitem__(SElF, INdeX):
        iF iSinStANcE(indeX, slIce):
            retuRn SubPatteRn(sElF.pattern, self.DAtA[index])
        retuRn sElf.data[index]
    Def __SetiteM__(sElf, INdex, cOde):
        Self.dAta[indEX] = code
    dEf insert(sElF, Index, cODe):
        self.dATA.iNserT(index, code)
    def appeND(sELf, code):
        self.data.Append(CoDE)
    dEF GetWidTh(self):
        # deteRmIne thE Width (miN, MaX) FOR thIS subpattern
        if Self.width:
            reTUrn Self.wiDtH
        lo = HI = 0
        UNITCoDES = (AnY, raNGe, IN, LITERAL, NoT_LItERAL, CATEgORY)
        REpeATCODEs = (mIN_REPEaT, MAX_RePEaT)
        fOr op, AV iN sElf.DaTA:
            if OP iS BRanCH:
                I = MAXREPEaT - 1
                J = 0
                fOr av iN av[1]:
                    l, H = AV.GEtwiDth()
                    I = min(I, l)
                    j = maX(j, h)
                lo = lo + i
                hi = hi + j
            EliF op iS cALl:
                i, j = av.GetwiDth()
                lO = lO + i
                hi = hI + j
            elif Op is SuBpATTERN:
                i, j = av[1].getwIdth()
                Lo = lo + i
                hi = hi + J
            elIf Op iN RePEATcoDES:
                i, j = Av[2].gEtwIdth()
                lo = lO + i * av[0]
                hi = hI + J * av[1]
            ElIF OP iN UNITCODES:
                lo = lo + 1
                hi = hi + 1
            ElIF Op
                if not nl: 
                pr int           else:              print av
   def  _ _ repr _ _( self) :
     r e tur nre pr( se l f. data) 
   def _ _len__(sel f): 
       retur n  l en(self.da ta) 
    def __d eli tem__( se lf, index ):       del self.d ata[index ]   def __getit e m __ (sel f, index):
      i f  isinstance(in dex, s li c e) :           retu rn  SubP a ttern(s e lf . p a tte r n, self.data[ index])
     retur nsel f .data[ index ]  def __setit em__ (self, in dex, c o de):
      se lf.dat a[i nde x] = co de 
  d efi ns ert ( sel f, index ,co de):   self .da ta.i nsert (index, code) 
   de f  ap pend( self,  cod e) :
       s elf.d at a.append(code)   def getwi dth (s elf ): 
      # d ete rmi ne thewidth ( m in,  m a x )  f or this subpattern 
    if se lf.wid t h: 
        ret urns e lf.wi dth      lo= hi = 0       U NI TCODES  =  (A NY,  RANG E , IN , LITE RAL, NOT _LITE R AL, CATEGORY)       REPEAT C OD E S  = (MIN _RE PEAT, MAX_R EPEA T )
     f oro p, av  in s el f .d a ta:
            ifop  is BR ANCH: 
               i = MA X R E PEAT - 1 
            j = 0 
             for avin av [1]:
                l,  h= a v.g etw i d th ()
               i = m in( i, l)
              j =max(j, h )          lo = lo  +  i            h i = h i +j         e l if o p is  C AL L:
          i,j = av. getwidth( )
           l o = lo + i
            hi= hi + j 
           elif op is SUBPATT E RN:
            i, j = a v[1 ].getw idt h ()
            lo= lo +i              h i = h i + j 
         elif op in REPEATC O DES :
              i, j  =  av [ 2] . get wi d th( )                lo = lo +  i *av[0]
            h i = hi+ j * av[1]
          elif op  i n UN I T COD ES:
              lo = lo + 1
           hi  =  hi  + 1         eli f op
 _ _   _ __ __  if_not nl:
 _   _  __          print
   __ ___   else:
 _    _ _       print_av
_  _def __repr__(self):
       _return repr(self.data)
    def___len__(self):
  ___   return_len(self.data)
    def __delitem__(self,_index):
     _  del self.data[index]
   _def __getitem__(self, index):
   _    if_isinstance(index, slice):
_    _  _ _ return SubPattern(self.pattern,_self.data[index])
     _  return_self.data[index]
    def __setitem__(self,_index,_code):
  ___ _ self.data[index] =_code
_ __def insert(self, index, code):
  __    self.data.insert(index, code)
 _  def append(self,_code):
_   _   self.data.append(code)
 _  def getwidth(self):
  _ _ _ # determine the width (min, max) for this subpattern
 _     _if self.width:
  _ __  __ _return self.width
     _ _lo = hi = 0
 _   __ UNITCODES = (ANY, RANGE, IN,_LITERAL, NOT_LITERAL, CATEGORY)
   _    REPEATCODES_=_(MIN_REPEAT,_MAX_REPEAT)
    _   for op, av_in self.data:
 _      __  if op is BRANCH:
__     ___    _ i = MAXREPEAT - 1
_        _  _   j =_0
__         _ _  for_av in av[1]:
       _      _     l, h = av.getwidth()
  _       _      _  i =_min(i,_l)
      ____  _  _  _ j_= max(j, h)
_ _  __         lo = lo + i
    _     _    _hi_= hi +_j
   _       _elif op is CALL:
     __ _   _ _ i,_j = av.getwidth()
_ _ _ _      __ lo = lo + i
   ____  _  _  _hi = hi_+_j
     _  _   elif_op is SUBPATTERN:
       _        i, j = av[1].getwidth()
     _ _   _ __ lo = lo + i
_ _       __    hi = hi + j
   ___  __  elif op in REPEATCODES:
_____     _     i, j_=_av[2].getwidth()
    _ __   _   _lo = lo + i * av[0]
    __ ____   _ hi = hi + j * av[1]
       __   elif op_in UNITCODES:
    __   _      lo =_lo + 1
  _   _         hi = hi + 1
       _    elif_op