mirror of
https://github.com/python/cpython.git
synced 2025-11-13 23:46:24 +00:00
Adapt the regular expression to the new class syntax.
This commit is contained in:
parent
6c6b78d6bd
commit
9f39fbb5b7
1 changed files with 3 additions and 2 deletions
|
|
@ -18,7 +18,8 @@ def main():
|
||||||
for file in args:
|
for file in args:
|
||||||
treat_file(file, outfp)
|
treat_file(file, outfp)
|
||||||
|
|
||||||
matcher = regexp.compile('^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*\(')
|
expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:(]'
|
||||||
|
matcher = regexp.compile(expr).match
|
||||||
|
|
||||||
def treat_file(file, outfp):
|
def treat_file(file, outfp):
|
||||||
try:
|
try:
|
||||||
|
|
@ -34,7 +35,7 @@ def treat_file(file, outfp):
|
||||||
line = fp.readline()
|
line = fp.readline()
|
||||||
if not line: break
|
if not line: break
|
||||||
lineno = lineno + 1
|
lineno = lineno + 1
|
||||||
res = matcher.exec(line)
|
res = matcher(line)
|
||||||
if res:
|
if res:
|
||||||
(a, b), (a1, b1), (a2, b2) = res
|
(a, b), (a1, b1), (a2, b2) = res
|
||||||
name = line[a2:b2]
|
name = line[a2:b2]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue