equal
deleted
inserted
replaced
123 "convert a glob pattern into a regexp" |
123 "convert a glob pattern into a regexp" |
124 i, n = 0, len(pat) |
124 i, n = 0, len(pat) |
125 res = '' |
125 res = '' |
126 group = 0 |
126 group = 0 |
127 escape = re.escape |
127 escape = re.escape |
128 def peek(): return i < n and pat[i] |
128 def peek(): |
|
129 return i < n and pat[i] |
129 while i < n: |
130 while i < n: |
130 c = pat[i] |
131 c = pat[i] |
131 i = i+1 |
132 i += 1 |
132 if c not in '*?[{},\\': |
133 if c not in '*?[{},\\': |
133 res += escape(c) |
134 res += escape(c) |
134 elif c == '*': |
135 elif c == '*': |
135 if peek() == '*': |
136 if peek() == '*': |
136 i += 1 |
137 i += 1 |