Back to index

python3.2  3.2.2
Functions | Variables
eptags Namespace Reference

Functions

def treat_file
def main

Variables

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

Function Documentation

def eptags.main ( void  )

Definition at line 50 of file eptags.py.

00050 
00051 def main():
00052     outfp = open('TAGS', 'w')
00053     for filename in sys.argv[1:]:
00054         treat_file(filename, outfp)

Here is the call graph for this function:

def eptags.treat_file (   filename,
  outfp 
)
Append tags found in file named 'filename' to the open file 'outfp'

Definition at line 24 of file eptags.py.

00024 
00025 def treat_file(filename, outfp):
00026     """Append tags found in file named 'filename' to the open file 'outfp'"""
00027     try:
00028         fp = open(filename, 'r')
00029     except:
00030         sys.stderr.write('Cannot open %s\n'%filename)
00031         return
00032     charno = 0
00033     lineno = 0
00034     tags = []
00035     size = 0
00036     while 1:
00037         line = fp.readline()
00038         if not line:
00039             break
00040         lineno = lineno + 1
00041         m = matcher.search(line)
00042         if m:
00043             tag = m.group(0) + '\177%d,%d\n' % (lineno, charno)
00044             tags.append(tag)
00045             size = size + len(tag)
00046         charno = charno + len(line)
00047     outfp.write('\f\n%s,%d\n' % (filename,size))
00048     for tag in tags:
00049         outfp.write(tag)

Here is the caller graph for this function:


Variable Documentation

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

Definition at line 21 of file eptags.py.

Definition at line 22 of file eptags.py.