some small cleanup

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2011-11-08 22:31:11 -05:00
parent d03d3b247f
commit 88fe0a35da
1 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,7 @@ class EtagsRunError(Exception): pass
class TagManager(object):
lang = None
prune = ('SCCS', 'RCS', 'CVS', '.svn', '.hg', '.git', '.bzr')
prune = set(['SCCS', 'RCS', 'CVS', '.svn', '.hg', '.git', '.bzr'])
exts = set()
def __init__(self, base='.'):
@ -133,13 +133,13 @@ class Etags(object):
raise
size = int(size)
subblock = data[n+1:n+size+1]
# ...
for lineitem in subblock.split('\n'):
if len(lineitem) == 0:
continue
if len(lineitem) == 0: continue
record = self._parse_record(lineitem, filename)
self._add_record(record)
return n+size+1
return n + size + 1
def _parse_record(self, lineitem, filename):
try:
@ -177,12 +177,13 @@ class EtagRecord(object):
return "%s [%s:%d]" % (self.name, self.path, self.line)
if __name__ == '__main__':
import sys
from pprint import pprint
etags = Etags(sys.argv[1])
etags.parse()
if len(sys.argv) > 2:
print etags[sys.argv[2]]
else: