eric6/Utilities/ClassBrowsers/idlclbr.py

changeset 7259
7c017076c12e
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7258:aff39db4dacc 7259:7c017076c12e
260 meth_sig = _commentsub('', meth_sig) 260 meth_sig = _commentsub('', meth_sig)
261 meth_sig = _normalize(' ', meth_sig) 261 meth_sig = _normalize(' ', meth_sig)
262 lineno = lineno + src.count('\n', last_lineno_pos, start) 262 lineno = lineno + src.count('\n', last_lineno_pos, start)
263 last_lineno_pos = start 263 last_lineno_pos = start
264 # close all interfaces/modules indented at least as much 264 # close all interfaces/modules indented at least as much
265 while classstack and \ 265 while classstack and classstack[-1][1] >= thisindent:
266 classstack[-1][1] >= thisindent:
267 if classstack[-1][0] is not None: 266 if classstack[-1][0] is not None:
268 # record the end line 267 # record the end line
269 classstack[-1][0].setEndLine(lineno - 1) 268 classstack[-1][0].setEndLine(lineno - 1)
270 del classstack[-1] 269 del classstack[-1]
271 if classstack: 270 if classstack:
272 # it's an interface/module method 271 # it's an interface/module method
273 cur_class = classstack[-1][0] 272 cur_class = classstack[-1][0]
274 if isinstance(cur_class, Interface) or \ 273 if (
275 isinstance(cur_class, Module): 274 isinstance(cur_class, Interface) or
275 isinstance(cur_class, Module)
276 ):
276 # it's a method 277 # it's a method
277 f = Function(None, meth_name, 278 f = Function(None, meth_name,
278 file, lineno, meth_sig) 279 file, lineno, meth_sig)
279 cur_class._addmethod(meth_name, f) 280 cur_class._addmethod(meth_name, f)
280 # else it's a nested def 281 # else it's a nested def
309 elif m.start("Interface") >= 0: 310 elif m.start("Interface") >= 0:
310 # we found an interface definition 311 # we found an interface definition
311 thisindent = indent 312 thisindent = indent
312 indent += 1 313 indent += 1
313 # close all interfaces/modules indented at least as much 314 # close all interfaces/modules indented at least as much
314 while classstack and \ 315 while classstack and classstack[-1][1] >= thisindent:
315 classstack[-1][1] >= thisindent:
316 if classstack[-1][0] is not None: 316 if classstack[-1][0] is not None:
317 # record the end line 317 # record the end line
318 classstack[-1][0].setEndLine(lineno - 1) 318 classstack[-1][0].setEndLine(lineno - 1)
319 del classstack[-1] 319 del classstack[-1]
320 lineno = lineno + src.count('\n', last_lineno_pos, start) 320 lineno = lineno + src.count('\n', last_lineno_pos, start)
345 elif m.start("Module") >= 0: 345 elif m.start("Module") >= 0:
346 # we found a module definition 346 # we found a module definition
347 thisindent = indent 347 thisindent = indent
348 indent += 1 348 indent += 1
349 # close all interfaces/modules indented at least as much 349 # close all interfaces/modules indented at least as much
350 while classstack and \ 350 while classstack and classstack[-1][1] >= thisindent:
351 classstack[-1][1] >= thisindent:
352 if classstack[-1][0] is not None: 351 if classstack[-1][0] is not None:
353 # record the end line 352 # record the end line
354 classstack[-1][0].setEndLine(lineno - 1) 353 classstack[-1][0].setEndLine(lineno - 1)
355 del classstack[-1] 354 del classstack[-1]
356 lineno = lineno + src.count('\n', last_lineno_pos, start) 355 lineno = lineno + src.count('\n', last_lineno_pos, start)
371 elif m.start("Attribute") >= 0: 370 elif m.start("Attribute") >= 0:
372 lineno = lineno + src.count('\n', last_lineno_pos, start) 371 lineno = lineno + src.count('\n', last_lineno_pos, start)
373 last_lineno_pos = start 372 last_lineno_pos = start
374 index = -1 373 index = -1
375 while index >= -len(classstack): 374 while index >= -len(classstack):
376 if classstack[index][0] is not None and \ 375 if (
377 not isinstance(classstack[index][0], Function) and \ 376 classstack[index][0] is not None and
378 not classstack[index][1] >= indent: 377 not isinstance(classstack[index][0], Function) and
378 not classstack[index][1] >= indent
379 ):
379 attributes = m.group("AttributeNames").split(',') 380 attributes = m.group("AttributeNames").split(',')
380 ro = m.group("AttributeReadonly") 381 ro = m.group("AttributeReadonly")
381 for attribute in attributes: 382 for attribute in attributes:
382 attr = Attribute(module, attribute, file, lineno) 383 attr = Attribute(module, attribute, file, lineno)
383 if ro: 384 if ro:

eric ide

mercurial