Reads each line in the input file in sequence and updates global vars. Effectively reads and collects information from the input file to the global variable groupcache, a dictionary containing info about each part of the fortran module. At the end of analyzeline, information i
(m, case, line)
| 993 | |
| 994 | |
| 995 | def analyzeline(m, case, line): |
| 996 | """ |
| 997 | Reads each line in the input file in sequence and updates global vars. |
| 998 | |
| 999 | Effectively reads and collects information from the input file to the |
| 1000 | global variable groupcache, a dictionary containing info about each part |
| 1001 | of the fortran module. |
| 1002 | |
| 1003 | At the end of analyzeline, information is filtered into the correct dict |
| 1004 | keys, but parameter values and dimensions are not yet interpreted. |
| 1005 | """ |
| 1006 | global groupcounter, groupname, groupcache, grouplist, filepositiontext |
| 1007 | global currentfilename, f77modulename, neededinterface, neededmodule |
| 1008 | global expectbegin, gotnextfile, previous_context |
| 1009 | |
| 1010 | block = m.group('this') |
| 1011 | if case != 'multiline': |
| 1012 | previous_context = None |
| 1013 | if expectbegin and case not in ['begin', 'call', 'callfun', 'type'] \ |
| 1014 | and not skipemptyends and groupcounter < 1: |
| 1015 | newname = os.path.basename(currentfilename).split('.')[0] |
| 1016 | outmess( |
| 1017 | 'analyzeline: no group yet. Creating program group with name "%s".\n' % newname) |
| 1018 | gotnextfile = 0 |
| 1019 | groupcounter = groupcounter + 1 |
| 1020 | groupname[groupcounter] = 'program' |
| 1021 | groupcache[groupcounter] = {} |
| 1022 | grouplist[groupcounter] = [] |
| 1023 | groupcache[groupcounter]['body'] = [] |
| 1024 | groupcache[groupcounter]['vars'] = {} |
| 1025 | groupcache[groupcounter]['block'] = 'program' |
| 1026 | groupcache[groupcounter]['name'] = newname |
| 1027 | groupcache[groupcounter]['from'] = 'fromsky' |
| 1028 | expectbegin = 0 |
| 1029 | if case in ['begin', 'call', 'callfun']: |
| 1030 | # Crack line => block,name,args,result |
| 1031 | block = block.lower() |
| 1032 | if re.match(r'block\s*data', block, re.I): |
| 1033 | block = 'block data' |
| 1034 | elif re.match(r'python\s*module', block, re.I): |
| 1035 | block = 'python module' |
| 1036 | elif re.match(r'abstract\s*interface', block, re.I): |
| 1037 | block = 'abstract interface' |
| 1038 | if block == 'type': |
| 1039 | name, attrs, _ = _resolvetypedefpattern(m.group('after')) |
| 1040 | groupcache[groupcounter]['vars'][name] = dict(attrspec = attrs) |
| 1041 | args = [] |
| 1042 | result = None |
| 1043 | else: |
| 1044 | name, args, result, bindcline = _resolvenameargspattern(m.group('after')) |
| 1045 | if name is None: |
| 1046 | if block == 'block data': |
| 1047 | name = '_BLOCK_DATA_' |
| 1048 | else: |
| 1049 | name = '' |
| 1050 | if block not in ['interface', 'block data', 'abstract interface']: |
| 1051 | outmess('analyzeline: No name/args pattern found for line.\n') |
| 1052 |
no test coverage detected