Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def runner (parser, options, args):
from fparser.api import Fortran2003
from fparser.readfortran import FortranFileReader
for filename in args:
reader = FortranFileReader(filename)
if options.mode != 'auto':
reader.set_mode_from_str(options.mode)
try:
program = Fortran2003.Program(reader)
print program
except Fortran2003.NoMatchError, msg:
print 'parsing %r failed at %s' % (filename, reader.fifo_item[-1])
print 'started at %s' % (reader.fifo_item[0])
print 'quiting'
return
def runner (parser, options, args):
from fparser.readfortran import FortranFileReader
from fparser.parsefortran import FortranParser
for filename in args:
reader = FortranFileReader(filename)
if options.mode != 'auto':
reader.set_mode_from_str(options.mode)
parser = FortranParser(reader)
parser.parse()
parser.analyze()
if options.task=='show':
print(parser.block.torepr(4))
elif options.task == 'none':
pass
else:
raise NotImplementedError(repr(options.task))
def analyze(self):
use = self.parent.a.use
if self.name in use:
return
modules = self.top.a.module
if self.name not in modules:
fn = self.reader.find_module_source_file(self.name)
if fn is not None:
from .readfortran import FortranFileReader
from .parsefortran import FortranParser
self.info('looking module information from %r' % (fn))
reader = FortranFileReader(fn, include_dirs=self.reader.include_dirs, source_only=self.reader.source_only)
parser = FortranParser(reader)
parser.parse()
parser.block.a.module.update(modules)
parser.analyze()
modules.update(parser.block.a.module)
if self.name not in modules:
self.warning('no information about the module %r in use statement' % (self.name))
return
module = modules[self.name]
use[self.name] = module
use_provides = self.parent.a.use_provides
renames = [split_comma(item, comma='=>') for item in self.items if '=>' in item]
norenames = [item for item in self.items if '=>' not in item]
all_mod_provides = dict(module.a.module_provides)
def runner (parser, options, args):
from fparser.readfortran import FortranFileReader
for filename in args:
reader = FortranFileReader(filename)
if options.task=='show':
for item in reader:
print >> sys.stdout, item
sys.stdout.flush()
else:
raise NotImplementedError(`options.task`)
def runner (parser, options, args):
from fparser.readfortran import FortranFileReader
from fparser.parsefortran import FortranParser
for filename in args:
reader = FortranFileReader(filename)
if options.mode != 'auto':
reader.set_mode_from_str(options.mode)
parser = FortranParser(reader)
parser.parse()
parser.analyze()
if options.task=='show':
print parser.block.torepr(4)
elif options.task == 'none':
pass
else:
raise NotImplementedError(`options.task`)
def simple_main():
import sys
if not sys.argv[1:]:
return parse_all_f()
for filename in sys.argv[1:]:
reader = FortranFileReader(filename)
print(yellow_text('Processing '+filename+' (mode=%r)' % (reader.mode)))
parser = FortranParser(reader)
parser.parse()
parser.analyze()
print(parser.block.torepr(4))
#print parser.block