Utilities/ClassBrowsers/rbclbr.py

changeset 45
9a18f4dbb493
parent 13
1af94a91f439
child 97
c4086afea02b
equal deleted inserted replaced
44:fe5cd20cb0eb 45:9a18f4dbb493
255 255
256 # search the path for the file 256 # search the path for the file
257 f = None 257 f = None
258 fullpath = list(path) 258 fullpath = list(path)
259 f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath) 259 f, file, (suff, mode, type) = ClassBrowsers.find_module(module, fullpath)
260 if f:
261 f.close()
260 if type not in SUPPORTED_TYPES: 262 if type not in SUPPORTED_TYPES:
261 # not Ruby source, can't do anything with this module 263 # not Ruby source, can't do anything with this module
262 f.close()
263 _modules[module] = dict 264 _modules[module] = dict
264 return dict 265 return dict
265 266
266 _modules[module] = dict 267 _modules[module] = dict
267 classstack = [] # stack of (class, indent) pairs 268 classstack = [] # stack of (class, indent) pairs
268 acstack = [] # stack of (access control, indent) pairs 269 acstack = [] # stack of (access control, indent) pairs
269 indent = 0 270 indent = 0
270 src = f.read() 271 try:
271 f.close() 272 src = Utilities.readEncodedFile(file)[0]
273 except (UnicodeError, IOError):
274 # can't do anything with this module
275 _modules[module] = dict
276 return dict
272 277
273 lineno, last_lineno_pos = 1, 0 278 lineno, last_lineno_pos = 1, 0
274 i = 0 279 i = 0
275 while True: 280 while True:
276 m = _getnext(src, i) 281 m = _getnext(src, i)

eric ide

mercurial