Copyright 1999-2004 Pearu Peterson all rights reserved, Pearu Peterson <pearu@ioc.ee> Permission to use, modify, and distribute this software is given under the terms of the NumPy License.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. $Date: 2005/09/27 07:13:49 $ Pearu Peterson
analyzeargs_re_1 = re.compile('\\A[a-z]+[\\w$]*\\Z', re.I)
badnames = { }
########## Crack line
beforethisafter = (('\\s*(?P<before>%s(?=\\s*(\\b(%s)\\b)))' + '\\s*(?P<this>(\\b(%s)\\b))') + '\\s*(?P<after>%s)\\s*\\Z')
beginpattern77 = (re.compile((beforethisafter mod ('', groupbegins77, groupbegins77, '.*')), re.I), 'begin')
beginpattern90 = (re.compile((beforethisafter mod ('', groupbegins90, groupbegins90, '.*')), re.I), 'begin')
callfunpattern = (re.compile((beforethisafter mod ('', 'callfun', 'callfun', '.*')), re.I), 'callfun')
callnameargspattern = re.compile('\\s*(?P<name>\\b[\\w$]+\\b)\\s*@\\(@\\s*(?P<args>.*)\\s*@\\)@\\s*\\Z', re.I)
callpattern = (re.compile((beforethisafter mod ('', 'call', 'call', '.*')), re.I), 'call')
charselector = re.compile('\\s*(\\((?P<lenkind>.*)\\)|[*]\\s*(?P<charlen>.*))\\s*\\Z', re.I)
commonpattern = (re.compile((beforethisafter mod ('', 'common', 'common', '.*')), re.I), 'common')
containspattern = (re.compile((beforethisafter mod ('', 'contains', 'contains', '')), re.I), 'contains')
crackline_re_1 = re.compile('\\s*(?P<result>\\b[a-z]+[\\w]*\\b)\\s*[=].*', re.I)
currentfilename = ''
datapattern = (re.compile((beforethisafter mod ('', 'data', 'data', '.*')), re.I), 'data')
debug = [ ]
defaultimplicitrules = { }
determineexprtype_re_1 = re.compile('\\A\\(.+?[,].+?\\)\\Z', re.I)
determineexprtype_re_2 = re.compile('\\A[+-]?\\d+(_(P<name>[\\w]+)|)\\Z', re.I)
determineexprtype_re_3 = re.compile('\\A[+-]?[\\d.]+[\\d+-de.]*(_(P<name>[\\w]+)|)\\Z', re.I)
determineexprtype_re_4 = re.compile('\\A\\(.*\\)\\Z', re.I)
determineexprtype_re_5 = re.compile('\\A(?P<name>\\w+)\\s*\\(.*?\\)\\s*\\Z', re.I)
dimensionpattern = (re.compile((beforethisafter mod ('', 'dimension|virtual', 'dimension|virtual', '.*')), re.I), 'dimension')
dolowercase = 1
endifpattern = (re.compile((beforethisafter mod ('[\\w]*?', endifs, endifs, '[\\w\\s]*')), re.I), 'endif')
endifs='ends*(if|do|where|select|while|forall)'
endifs = '(end\\s*(if|do|where|select|while|forall))|(module\\s*procedure)'
endpattern = (re.compile((beforethisafter mod ('', groupends, groupends, '[\\w\\s]*')), re.I), 'end')
entrypattern = (re.compile((beforethisafter mod ('', 'entry', 'entry', '.*')), re.I), 'entry')
errmess = sys.stderr.write
expectbegin = 1
externalpattern = (re.compile((beforethisafter mod ('', 'external', 'external', '.*')), re.I), 'external')
f2py_version = __version__.version
# Non-fortran and f2py-specific statements
f2pyenhancementspattern = (re.compile((beforethisafter mod ('', 'threadsafe|fortranname|callstatement|callprotoargument|usercode|pymethoddef', 'threadsafe|fortranname|callstatement|callprotoargument|usercode|pymethoddef', '.*')), (re.I | re.S)), 'f2pyenhancements')
f77modulename = ''
f90modulevars = { }
filepositiontext = ''
formatpattern = (re.compile((beforethisafter mod ('', 'format', 'format', '.*')), re.I), 'format')
#
fortrantypes = 'character|logical|integer|real|complex|double\\s*(precision\\s*(complex|)|complex)|type(?=\\s*\\([\\w\\s,=(*)]*\\))|byte'
functionpattern = (re.compile((beforethisafter mod ('([a-z]+[\\w\\s(=*+-/)]*?|)', 'function', 'function', '.*')), re.I), 'begin')
getlincoef_re_1 = re.compile('\\A\\b\\w+\\b\\Z', re.I)
gotnextfile = 1
modulepattern=re.compile(beforethisafter%('[a-zs]*?','module','module','.*'),re.I),'begin'
groupbegins77 = 'program|block\\s*data'
groupbegins90 = (groupbegins77 + '|module|python\\s*module|interface|type(?!\\s*\\()')
groupcounter = 0
groupends = 'end|endprogram|endblockdata|endmodule|endpythonmodule|endinterface'
grouplist = { Name('groupcounter') : List(()) }
ignorecontains = 1
implicitpattern = (re.compile((beforethisafter mod ('', 'implicit', 'implicit', '.*')), re.I), 'implicit')
include_paths = [ ]
intentpattern = (re.compile((beforethisafter mod ('', 'intent|depend|note|check', 'intent|depend|note|check', '\\s*\\(.*?\\).*')), re.I), 'intent')
intrisicpattern = (re.compile((beforethisafter mod ('', 'intrisic', 'intrisic', '.*')), re.I), 'intrisic')
invbadnames = { }
is_f_file = re.compile('.*[.](for|ftn|f77|f)\\Z', re.I).match
kindselector = re.compile('\\s*(\\(\\s*(kind\\s*=)?\\s*(?P<kind>.*)\\s*\\)|[*]\\s*(?P<kind2>.*?))\\s*\\Z', re.I)
lenarraypattern = re.compile('\\s*(@\\(@\\s*(?!/)\\s*(?P<array>.*?)\\s*@\\)@\\s*[*]\\s*(?P<len>.*?)|([*]\\s*(?P<len2>.*?)|)\\s*(@\\(@\\s*(?!/)\\s*(?P<array2>.*?)\\s*@\\)@|))\\s*(=\\s*(?P<init>.*?)|(@\\(@|)/\\s*(?P<init2>.*?)\\s*/(@\\)@|)|)\\s*\\Z', re.I)
lenkindpattern = re.compile('\\s*(kind\\s*=\\s*(?P<kind>.*?)\\s*(@,@\\s*len\\s*=\\s*(?P<len>.*)|)|(len\\s*=\\s*|)(?P<len2>.*?)\\s*(@,@\\s*(kind\\s*=\\s*|)(?P<kind2>.*)|))\\s*\\Z', re.I)
multilinepattern = (re.compile("\\s*(?P<before>''')(?P<this>.*?)(?P<after>''')\\s*\\Z", re.S), 'multiline')
nameargspattern = re.compile('\\s*(?P<name>\\b[\\w$]+\\b)\\s*(@\\(@\\s*(?P<args>[\\w\\s,]*)\\s*@\\)@|)\\s*(result(\\s*@\\(@\\s*(?P<result>\\b[\\w$]+\\b)\\s*@\\)@|))*\\s*\\Z', re.I)
####
namepattern = re.compile('\\s*(?P<name>\\b[\\w]+\\b)\\s*(?P<after>.*)\\s*\\Z', re.I)
neededmodule = -Const(1)
onlyfuncs = [ ]
optionalpattern = (re.compile((beforethisafter mod ('', 'optional', 'optional', '.*')), re.I), 'optional')
parameterpattern = (re.compile((beforethisafter mod ('', 'parameter', 'parameter', '\\s*\\(.*')), re.I), 'parameter')
previous_context = None
privatepattern = (re.compile((beforethisafter mod ('', 'private', 'private', '.*')), re.I), 'private')
publicpattern = (re.compile((beforethisafter mod ('', 'public', 'public', '.*')), re.I), 'public')
pyffilename = ''
quiet = 0
real16pattern = re.compile('([-+]?(?:\\d+(?:\\.\\d*)?|\\d*\\.\\d+))[dD]((?:[-+]?\\d+)?)')
real8pattern = re.compile('([-+]?((?:\\d+(?:\\.\\d*)?|\\d*\\.\\d+))[eE]((?:[-+]?\\d+)?)|(\\d+\\.\\d*))')
requiredpattern = (re.compile((beforethisafter mod ('', 'required', 'required', '.*')), re.I), 'required')
selectpattern = re.compile('\\s*(?P<this>(@\\(@.*?@\\)@|[*][\\d*]+|[*]\\s*@\\(@.*?@\\)@|))(?P<after>.*)\\Z', re.I)
skipblocksuntil = -Const(1)
skipemptyends = 0
skipfuncs = [ ]
skipfunctions = [ ]
sourcecodeform = 'fix'
Global flags:
strictf77 = 1
subroutinepattern = (re.compile((beforethisafter mod ('[a-z\\s]*?', 'subroutine', 'subroutine', '.*')), re.I), 'begin')
tabchar = (4 * ' ')
typespattern = (re.compile((beforethisafter mod ('', fortrantypes, fortrantypes, '.*')), re.I), 'type')
typespattern4implicit = re.compile((beforethisafter mod ('', (fortrantypes + '|static|automatic|undefined'), (fortrantypes + '|static|automatic|undefined'), '.*')), re.I)
usepattern = (re.compile((beforethisafter mod ('', 'use', 'use', '.*')), re.I), 'use')
usermodules = [ ]
verbose = 1
word_pattern = re.compile('\\b[a-z][\\w$]*\\b', re.I)
reset=-1 --- initialize reset=0 --- crack the line reset=1 --- final check if mismatch of blocks occured
Cracked data is saved in grouplist[0].
Check if file is in free format Fortran.
TODO: public sub ...