parent
d03d3b247f
commit
88fe0a35da
11
etags.py
11
etags.py
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue