]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/ptags.py
5 # Create a tags file for Python programs, usable with vi.
7 # - functions (even inside other defs or classes)
10 # Warns about files it cannot open.
11 # No warnings about duplicate tags.
15 tags
= [] # Modified global variable!
22 fp
= open('tags', 'w')
24 for s
in tags
: fp
.write(s
)
27 expr
= '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]'
28 matcher
= re
.compile(expr
)
30 def treat_file(filename
):
32 fp
= open(filename
, 'r')
34 sys
.stderr
.write('Cannot open %s\n' % filename
)
36 base
= os
.path
.basename(filename
)
37 if base
[-3:] == '.py':
39 s
= base
+ '\t' + filename
+ '\t' + '1\n'
45 m
= matcher
.match(line
)
49 s
= name
+ '\t' + filename
+ '\t/^' + content
+ '/\n'
52 if __name__
== '__main__':