MCPcopy Index your code
hub / github.com/numpy/numpy / analyzeline

Function analyzeline

numpy/f2py/crackfortran.py:989–1553  ·  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

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

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
errmessFunction · 0.85
get_parametersFunction · 0.85
determineexprtypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…