Back to index

python3.2  3.2.2
Functions | Variables
ptags Namespace Reference

Functions

def main
def treat_file

Variables

list tags = []
string expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]'
tuple matcher = re.compile(expr)

Function Documentation

def ptags.main ( void  )

Definition at line 17 of file ptags.py.

00017 
00018 def main():
00019     args = sys.argv[1:]
00020     for filename in args:
00021         treat_file(filename)
00022     if tags:
00023         fp = open('tags', 'w')
00024         tags.sort()
00025         for s in tags: fp.write(s)
00026 

Here is the call graph for this function:

Here is the caller graph for this function:

def ptags.treat_file (   filename)

Definition at line 30 of file ptags.py.

00030 
00031 def treat_file(filename):
00032     try:
00033         fp = open(filename, 'r')
00034     except:
00035         sys.stderr.write('Cannot open %s\n' % filename)
00036         return
00037     base = os.path.basename(filename)
00038     if base[-3:] == '.py':
00039         base = base[:-3]
00040     s = base + '\t' + filename + '\t' + '1\n'
00041     tags.append(s)
00042     while 1:
00043         line = fp.readline()
00044         if not line:
00045             break
00046         m = matcher.match(line)
00047         if m:
00048             content = m.group(0)
00049             name = m.group(2)
00050             s = name + '\t' + filename + '\t/^' + content + '/\n'
00051             tags.append(s)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

string ptags.expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]'

Definition at line 27 of file ptags.py.

Definition at line 28 of file ptags.py.

list ptags.tags = []

Definition at line 15 of file ptags.py.