reset=-1 --- initialize reset=0 --- crack the line reset=1 --- final check if mismatch of blocks occurred Cracked data is saved in grouplist[0].
(line, reset=0)
| 695 | crackline_bindlang = re.compile(r'\s*bind\(\s*(?P<lang>[^,]+)\s*,\s*name\s*=\s*"(?P<lang_name>[^"]+)"\s*\)', re.I) |
| 696 | |
| 697 | def crackline(line, reset=0): |
| 698 | """ |
| 699 | reset=-1 --- initialize |
| 700 | reset=0 --- crack the line |
| 701 | reset=1 --- final check if mismatch of blocks occurred |
| 702 | |
| 703 | Cracked data is saved in grouplist[0]. |
| 704 | """ |
| 705 | global beginpattern, groupcounter, groupname, groupcache, grouplist |
| 706 | global filepositiontext, currentfilename, neededmodule, expectbegin |
| 707 | global skipblocksuntil, skipemptyends, previous_context, gotnextfile |
| 708 | |
| 709 | _, has_semicolon = split_by_unquoted(line, ";") |
| 710 | if has_semicolon and not (f2pyenhancementspattern[0].match(line) or |
| 711 | multilinepattern[0].match(line)): |
| 712 | # XXX: non-zero reset values need testing |
| 713 | assert reset == 0, repr(reset) |
| 714 | # split line on unquoted semicolons |
| 715 | line, semicolon_line = split_by_unquoted(line, ";") |
| 716 | while semicolon_line: |
| 717 | crackline(line, reset) |
| 718 | line, semicolon_line = split_by_unquoted(semicolon_line[1:], ";") |
| 719 | crackline(line, reset) |
| 720 | return |
| 721 | if reset < 0: |
| 722 | groupcounter = 0 |
| 723 | groupname = {groupcounter: ''} |
| 724 | groupcache = {groupcounter: {}} |
| 725 | grouplist = {groupcounter: []} |
| 726 | groupcache[groupcounter]['body'] = [] |
| 727 | groupcache[groupcounter]['vars'] = {} |
| 728 | groupcache[groupcounter]['block'] = '' |
| 729 | groupcache[groupcounter]['name'] = '' |
| 730 | neededmodule = -1 |
| 731 | skipblocksuntil = -1 |
| 732 | return |
| 733 | if reset > 0: |
| 734 | fl = 0 |
| 735 | if f77modulename and neededmodule == groupcounter: |
| 736 | fl = 2 |
| 737 | while groupcounter > fl: |
| 738 | outmess(f'crackline: groupcounter={groupcounter!r} groupname={groupname!r}\n') |
| 739 | outmess( |
| 740 | 'crackline: Mismatch of blocks encountered. Trying to fix it by assuming "end" statement.\n') |
| 741 | grouplist[groupcounter - 1].append(groupcache[groupcounter]) |
| 742 | grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] |
| 743 | del grouplist[groupcounter] |
| 744 | groupcounter = groupcounter - 1 |
| 745 | if f77modulename and neededmodule == groupcounter: |
| 746 | grouplist[groupcounter - 1].append(groupcache[groupcounter]) |
| 747 | grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] |
| 748 | del grouplist[groupcounter] |
| 749 | groupcounter = groupcounter - 1 # end interface |
| 750 | grouplist[groupcounter - 1].append(groupcache[groupcounter]) |
| 751 | grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] |
| 752 | del grouplist[groupcounter] |
| 753 | groupcounter = groupcounter - 1 # end module |
| 754 | neededmodule = -1 |
nothing calls this directly
no test coverage detected
searching dependent graphs…