diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-18 01:46:01 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-18 01:46:01 (GMT) |
commit | 0b7b4b8a229532bb7f634aedf0db81adfeb2ae18 (patch) | |
tree | f45a6aec7140a61df9c85730e95c5fd0a94356dd /Tools/scripts/eptags.py | |
parent | 9082cdd009cc5c4945cd1200cc58f6bf69eb2817 (diff) | |
download | cpython-0b7b4b8a229532bb7f634aedf0db81adfeb2ae18.zip cpython-0b7b4b8a229532bb7f634aedf0db81adfeb2ae18.tar.gz cpython-0b7b4b8a229532bb7f634aedf0db81adfeb2ae18.tar.bz2 |
satisfy the tabnanny
Diffstat (limited to 'Tools/scripts/eptags.py')
-rwxr-xr-x | Tools/scripts/eptags.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Tools/scripts/eptags.py b/Tools/scripts/eptags.py index 0e93447..dca875b 100755 --- a/Tools/scripts/eptags.py +++ b/Tools/scripts/eptags.py @@ -24,32 +24,33 @@ matcher = re.compile(expr) def treat_file(file, outfp): """Append tags found in file named 'file' to the open file 'outfp'""" try: - fp = open(file, 'r') + fp = open(file, 'r') except: - sys.stderr.write('Cannot open %s\n'%file) - return + sys.stderr.write('Cannot open %s\n'%file) + return charno = 0 lineno = 0 tags = [] size = 0 while 1: - line = fp.readline() - if not line: break - lineno = lineno + 1 - m = matcher.search(line) - if m: - tag = m.group(0) + '\177%d,%d\n'%(lineno,charno) - tags.append(tag) - size = size + len(tag) - charno = charno + len(line) + line = fp.readline() + if not line: + break + lineno = lineno + 1 + m = matcher.search(line) + if m: + tag = m.group(0) + '\177%d,%d\n'%(lineno,charno) + tags.append(tag) + size = size + len(tag) + charno = charno + len(line) outfp.write('\f\n%s,%d\n'%(file,size)) for tag in tags: - outfp.write(tag) + outfp.write(tag) def main(): outfp = open('TAGS', 'w') for file in sys.argv[1:]: - treat_file(file, outfp) + treat_file(file, outfp) if __name__=="__main__": main() |