269 # can't do anything with this module |
269 # can't do anything with this module |
270 _modules[module] = dict |
270 _modules[module] = dict |
271 return dict |
271 return dict |
272 |
272 |
273 lineno, last_lineno_pos = 1, 0 |
273 lineno, last_lineno_pos = 1, 0 |
|
274 lastGlobalEntry = None |
|
275 cur_obj = None |
274 i = 0 |
276 i = 0 |
275 modifierType = ClbrBaseClasses.Function.General |
277 modifierType = ClbrBaseClasses.Function.General |
276 modifierIndent = -1 |
278 modifierIndent = -1 |
277 while True: |
279 while True: |
278 m = _getnext(src, i) |
280 m = _getnext(src, i) |
340 dict_counts[meth_name] += 1 |
342 dict_counts[meth_name] += 1 |
341 meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) |
343 meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) |
342 else: |
344 else: |
343 dict_counts[meth_name] = 0 |
345 dict_counts[meth_name] = 0 |
344 dict[meth_name] = f |
346 dict[meth_name] = f |
|
347 if not classstack: |
|
348 if lastGlobalEntry: |
|
349 lastGlobalEntry.setEndLine(lineno - 1) |
|
350 lastGlobalEntry = f |
|
351 if cur_obj and isinstance(cur_obj, Function): |
|
352 cur_obj.setEndLine(lineno - 1) |
|
353 cur_obj = f |
345 classstack.append((f, thisindent)) # Marker for nested fns |
354 classstack.append((f, thisindent)) # Marker for nested fns |
346 |
355 |
347 # reset the modifier settings |
356 # reset the modifier settings |
348 modifierType = ClbrBaseClasses.Function.General |
357 modifierType = ClbrBaseClasses.Function.General |
349 modifierIndent = -1 |
358 modifierIndent = -1 |
401 else: |
410 else: |
402 dict_counts[class_name] = 0 |
411 dict_counts[class_name] = 0 |
403 dict[class_name] = cur_class |
412 dict[class_name] = cur_class |
404 else: |
413 else: |
405 classstack[-1][0]._addclass(class_name, cur_class) |
414 classstack[-1][0]._addclass(class_name, cur_class) |
|
415 if not classstack: |
|
416 if lastGlobalEntry: |
|
417 lastGlobalEntry.setEndLine(lineno - 1) |
|
418 lastGlobalEntry = cur_class |
406 classstack.append((cur_class, thisindent)) |
419 classstack.append((cur_class, thisindent)) |
407 |
420 |
408 elif m.start("Attribute") >= 0: |
421 elif m.start("Attribute") >= 0: |
409 lineno = lineno + src.count('\n', last_lineno_pos, start) |
422 lineno = lineno + src.count('\n', last_lineno_pos, start) |
410 last_lineno_pos = start |
423 last_lineno_pos = start |
428 if "@@Globals@@" not in dict: |
441 if "@@Globals@@" not in dict: |
429 dict["@@Globals@@"] = \ |
442 dict["@@Globals@@"] = \ |
430 ClbrBaseClasses.ClbrBase(module, "Globals", file, lineno) |
443 ClbrBaseClasses.ClbrBase(module, "Globals", file, lineno) |
431 dict["@@Globals@@"]._addglobal( |
444 dict["@@Globals@@"]._addglobal( |
432 Attribute(module, variable_name, file, lineno)) |
445 Attribute(module, variable_name, file, lineno)) |
|
446 if lastGlobalEntry: |
|
447 lastGlobalEntry.setEndLine(lineno - 1) |
|
448 lastGlobalEntry = None |
433 else: |
449 else: |
434 index = -1 |
450 index = -1 |
435 while index >= -len(classstack): |
451 while index >= -len(classstack): |
436 if classstack[index][1] >= thisindent: |
452 if classstack[index][1] >= thisindent: |
437 index -= 1 |
453 index -= 1 |