parameters: (ant_pattern)
return_statement: return re.compile(''.join(rex))
docstring: Generates a regular expression from the ant pattern.
      Matching convention:
      **/a: match 'a', 'dir/a', 'dir1/dir2/a'
      a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
      *.py: match 'script.py' but not 'a/script.py'
docstring_summary: Generates a regular expression from the ant pattern.
      Matching convention:
      **/a: match 'a', 'dir/a', 'dir1/dir2/a'
      a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
      *.py: match 'script.py' but not 'a/script.py'
docstring_tokens: Generates a regular expression from the ant pattern . Matching convention : ** / a : match a dir / a dir1 / dir2 / a a / ** / b : match a / b a / c / b a / d / c / b * . py : match script . py but not a / script . py
function: def ant_pattern_to_re(ant_pattern):
      """Generates a regular expression from the ant pattern.
      Matching convention:
      **/a: match 'a', 'dir/a', 'dir1/dir2/a'
      a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
      *.py: match 'script.py' but not 'a/script.py'
      """
      rex = ['^']
      next_pos = 0
      sep_rex = r'(?:/|%s)' % re.escape(os.path.sep)
  ##    print 'Converting', ant_pattern
      for match in _ANT_RE.finditer(ant_pattern):
  ##        print 'Matched', match.group()
  ##        print match.start(0), next_pos
          if match.start(0) != next_pos:
              raise ValueError("Invalid ant pattern")
          if match.group(1): # /**/
              rex.append(sep_rex + '(?:.*%s)?' % sep_rex)
          elif match.group(2): # **/
              rex.append('(?:.*%s)?' % sep_rex)
          elif match.group(3): # /**
              rex.append(sep_rex + '.*')
          elif match.group(4): # *
              rex.append('[^/%s]*' % re.escape(os.path.sep))
          elif match.group(5): # /
              rex.append(sep_rex)
          else: # somepath
              rex.append(re.escape(match.group(6)))
          next_pos = match.end()
      rex.append('$')
      return re.compile(''.join(rex))
function_tokens: def ant_pattern_to_re ( ant_pattern ) : rex = [ '^' ] next_pos = 0 sep_rex = r'(?:/|%s)' % re . escape ( os . path . sep ) ##    print 'Converting', ant_pattern for match in _ANT_RE . finditer ( ant_pattern ) : ##        print 'Matched', match.group() ##        print match.start(0), next_pos if match . start ( 0 ) != next_pos : raise ValueError ( "Invalid ant pattern" ) if match . group ( 1 ) : # /**/ rex . append ( sep_rex + '(?:.*%s)?' % sep_rex ) elif match . group ( 2 ) : # **/ rex . append ( '(?:.*%s)?' % sep_rex ) elif match . group ( 3 ) : # /** rex . append ( sep_rex + '.*' ) elif match . group ( 4 ) : # * rex . append ( '[^/%s]*' % re . escape ( os . path . sep ) ) elif match . group ( 5 ) : # / rex . append ( sep_rex ) else : # somepath rex . append ( re . escape ( match . group ( 6 ) ) ) next_pos = match . end ( ) rex . append ( '$' ) return re . compile ( '' . join ( rex ) )