321 m = _getnext(src, i) |
321 m = _getnext(src, i) |
322 if not m.hasMatch(): |
322 if not m.hasMatch(): |
323 break |
323 break |
324 start, i = m.capturedStart(), m.capturedEnd() |
324 start, i = m.capturedStart(), m.capturedEnd() |
325 |
325 |
326 if m.hasCaptured("Method"): |
326 if m.captured("Method"): |
327 # found a method definition or function |
327 # found a method definition or function |
328 thisindent = indent |
328 thisindent = indent |
329 indent += 1 |
329 indent += 1 |
330 meth_name = ( |
330 meth_name = ( |
331 m.captured("MethodName") |
331 m.captured("MethodName") |
385 cur_obj.setEndLine(lineno - 1) |
385 cur_obj.setEndLine(lineno - 1) |
386 cur_obj = f |
386 cur_obj = f |
387 classstack.append((f, thisindent)) # Marker for nested fns |
387 classstack.append((f, thisindent)) # Marker for nested fns |
388 |
388 |
389 elif ( |
389 elif ( |
390 m.hasCaptured("String") |
390 m.captured("String") |
391 or m.hasCaptured("Comment") |
391 or m.captured("Comment") |
392 or m.hasCaptured("ClassIgnored") |
392 or m.captured("ClassIgnored") |
393 or m.hasCaptured("BeginEnd") |
393 or m.captured("BeginEnd") |
394 ): |
394 ): |
395 pass |
395 pass |
396 |
396 |
397 elif m.hasCaptured("Class"): |
397 elif m.captured("Class"): |
398 # we found a class definition |
398 # we found a class definition |
399 thisindent = indent |
399 thisindent = indent |
400 indent += 1 |
400 indent += 1 |
401 lineno += src.count("\n", last_lineno_pos, start) |
401 lineno += src.count("\n", last_lineno_pos, start) |
402 last_lineno_pos = start |
402 last_lineno_pos = start |
436 while acstack and acstack[-1][1] >= thisindent: |
436 while acstack and acstack[-1][1] >= thisindent: |
437 del acstack[-1] |
437 del acstack[-1] |
438 acstack.append(["public", thisindent]) |
438 acstack.append(["public", thisindent]) |
439 # default access control is 'public' |
439 # default access control is 'public' |
440 |
440 |
441 elif m.hasCaptured("Module"): |
441 elif m.captured("Module"): |
442 # we found a module definition |
442 # we found a module definition |
443 thisindent = indent |
443 thisindent = indent |
444 indent += 1 |
444 indent += 1 |
445 lineno += src.count("\n", last_lineno_pos, start) |
445 lineno += src.count("\n", last_lineno_pos, start) |
446 last_lineno_pos = start |
446 last_lineno_pos = start |
475 while acstack and acstack[-1][1] >= thisindent: |
475 while acstack and acstack[-1][1] >= thisindent: |
476 del acstack[-1] |
476 del acstack[-1] |
477 acstack.append(["public", thisindent]) |
477 acstack.append(["public", thisindent]) |
478 # default access control is 'public' |
478 # default access control is 'public' |
479 |
479 |
480 elif m.hasCaptured("AccessControl"): |
480 elif m.captured("AccessControl"): |
481 aclist = m.captured("AccessControlList") |
481 aclist = m.captured("AccessControlList") |
482 if not aclist: |
482 if not aclist: |
483 index = -1 |
483 index = -1 |
484 while index >= -len(acstack): |
484 while index >= -len(acstack): |
485 if acstack[index][1] < indent: |
485 if acstack[index][1] < indent: |
537 index -= 1 |
537 index -= 1 |
538 if lastGlobalEntry: |
538 if lastGlobalEntry: |
539 lastGlobalEntry.setEndLine(lineno - 1) |
539 lastGlobalEntry.setEndLine(lineno - 1) |
540 lastGlobalEntry = None |
540 lastGlobalEntry = None |
541 |
541 |
542 elif m.hasCaptured("Attr"): |
542 elif m.captured("Attr"): |
543 lineno += src.count("\n", last_lineno_pos, start) |
543 lineno += src.count("\n", last_lineno_pos, start) |
544 last_lineno_pos = start |
544 last_lineno_pos = start |
545 index = -1 |
545 index = -1 |
546 while index >= -len(classstack): |
546 while index >= -len(classstack): |
547 if ( |
547 if ( |
584 parent._addattribute(attr) |
584 parent._addattribute(attr) |
585 break |
585 break |
586 else: |
586 else: |
587 index -= 1 |
587 index -= 1 |
588 |
588 |
589 elif m.hasCaptured("Begin"): |
589 elif m.captured("Begin"): |
590 # a begin of a block we are not interested in |
590 # a begin of a block we are not interested in |
591 indent += 1 |
591 indent += 1 |
592 |
592 |
593 elif m.hasCaptured("End"): |
593 elif m.captured("End"): |
594 # an end of a block |
594 # an end of a block |
595 indent -= 1 |
595 indent -= 1 |
596 if indent < 0: |
596 if indent < 0: |
597 # no negative indent allowed |
597 # no negative indent allowed |
598 if classstack: |
598 if classstack: |
599 # it's a class/module method |
599 # it's a class/module method |
600 indent = classstack[-1][1] |
600 indent = classstack[-1][1] |
601 else: |
601 else: |
602 indent = 0 |
602 indent = 0 |
603 |
603 |
604 elif m.hasCaptured("CodingLine"): |
604 elif m.captured("CodingLine"): |
605 # a coding statement |
605 # a coding statement |
606 coding = m.captured("Coding") |
606 coding = m.captured("Coding") |
607 lineno += src.count("\n", last_lineno_pos, start) |
607 lineno += src.count("\n", last_lineno_pos, start) |
608 last_lineno_pos = start |
608 last_lineno_pos = start |
609 if "@@Coding@@" not in dictionary: |
609 if "@@Coding@@" not in dictionary: |