MCPcopy Create free account
hub / github.com/numpy/numpy / analyzeline

Function analyzeline

numpy/f2py/crackfortran.py:995–1587  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

993
994
995def 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

Callers 1

cracklineFunction · 0.85

Calls 15

_resolvetypedefpatternFunction · 0.85
_resolvenameargspatternFunction · 0.85
rmbadnameFunction · 0.85
markoutercommaFunction · 0.85
rmbadname1Function · 0.85
appenddeclFunction · 0.85
cracktypespec0Function · 0.85
updatevarsFunction · 0.85
markouterparenFunction · 0.85
printFunction · 0.85
get_parametersFunction · 0.85
determineexprtypeFunction · 0.85

Tested by

no test coverage detected