diff options
author | Guido van Rossum <guido@python.org> | 1992-08-31 10:54:06 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-08-31 10:54:06 (GMT) |
commit | 0cc19450e27ffacf4c70ac8717d6ecb000a4d4e1 (patch) | |
tree | 54ed5fb1f2bf0ab7ddc1f72c0a02da34f88c32cc /Tools | |
parent | f2e1cfb8f36c2385e16e0816a8e14e19a0cdcef1 (diff) | |
download | cpython-0cc19450e27ffacf4c70ac8717d6ecb000a4d4e1.zip cpython-0cc19450e27ffacf4c70ac8717d6ecb000a4d4e1.tar.gz cpython-0cc19450e27ffacf4c70ac8717d6ecb000a4d4e1.tar.bz2 |
Use regex instead of regexp
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/eptags.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Tools/scripts/eptags.py b/Tools/scripts/eptags.py index db535af..2c1a15c 100755 --- a/Tools/scripts/eptags.py +++ b/Tools/scripts/eptags.py @@ -10,7 +10,7 @@ # No warnings about duplicate tags. import sys -import regexp +import regex def main(): outfp = open('TAGS', 'w') @@ -18,8 +18,8 @@ def main(): for file in args: treat_file(file, outfp) -expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:(]' -matcher = regexp.compile(expr).match +expr = '^[ \t]*\(def\|class\)[ \t]+\([a-zA-Z0-9_]+\)[ \t]*[:(]' +matcher = regex.compile(expr) def treat_file(file, outfp): try: @@ -35,9 +35,8 @@ def treat_file(file, outfp): line = fp.readline() if not line: break lineno = lineno + 1 - res = matcher(line) - if res: - (a, b), (a1, b1), (a2, b2) = res + if matcher.search(line) >= 0: + (a, b), (a1, b1), (a2, b2) = matcher.regs[:3] name = line[a2:b2] pat = line[a:b] tag = pat + '\177' + `lineno` + ',' + `charno` + '\n' |