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