fortran-src-extras-0.1.0: Common functions and utils for fortran-src.
Safe HaskellNone
LanguageHaskell2010

Language.Fortran.Extras

Synopsis

Documentation

allB :: Data a => ProgramFile a -> [Block a] Source #

Get a list of all Blocks in a ProgramFile

allS :: Data a => ProgramFile a -> [Statement a] Source #

Get a list of all Statements in a ProgramFile

allPU :: Data a => ProgramFile a -> [ProgramUnit a] Source #

Get a list of all ProgramUnits in a ProgramFile

allPUB :: Data a => ProgramUnit a -> [Block a] Source #

Get a list of all Blocks in a ProgramUnit

allPUS :: Data a => ProgramUnit a -> [Statement a] Source #

Get a list of all Statements in a ProgramUnit

findPU' :: Data a => ProgramUnitName -> ProgramFile (Analysis a) -> Maybe (ProgramUnit (Analysis a)) Source #

Given a ProgramFile find a ProgramUnit with a particular ProgramUnitName

findPU :: Data a => String -> ProgramFile (Analysis a) -> Maybe (ProgramUnit (Analysis a)) Source #

Given a ProgramFile find a ProgramUnit with a particular name

programFile :: FortranSrcRunOptions -> IO (ProgramFile A0) Source #

Get a ProgramFile from version and path specified in FortranSrcRunOptions

programAnalysis :: FortranSrcRunOptions -> IO (ProgramFile (Analysis A0)) Source #

Get a ProgramFile with Analysis from version and path specified in FortranSrcRunOptions

some-fortran-tool Missing: (-v|--fortranVersion VERSION) PATH

Usage: vars (-v|--fortranVersion VERSION) [-I|--include DIRECTORY] PATH THIS IS WHERE THE DESCRIPTION GOES @

  • A header that is shown when the user passes the `--help` argument to the tool (note that this does not show up when the program is invoked incorrectly) @

some-fortran-tool --help THIS IS WHERE THE HEADER GOES

Usage: vars (-v|--fortranVersion VERSION) [-I|--include DIRECTORY] PATH THIS IS WHERE THE DESCRIPTION GOES

Available options: -h,--help Show this help text -v,--fortranVersion VERSION Fortran version to use, format: Fortran[6677BigIron77Legacy77Extended/90] -I,--include DIRECTORY Directory to include files from @

getProgramFile :: String -> String -> IO (ProgramFile A0) Source #

getProgramAnalysis :: String -> String -> IO (ProgramFile (Analysis A0)) Source #

Parse arguments and return a ProgramFile with Analysis

This function takes the same arguments as getProgramFile, however it will return an Analysis object within the ProgramFile monad. If any `-I DIR` arguments were specified when invoking the tool, this function will ensure that any module files located in this directory are loaded and incorporated into the analysis.

errorHandler :: String -> Either SomeException () -> IO () Source #

Helper to print out exceptions with the name of the file being processed

withProgramFile :: String -> String -> (ProgramFile A0 -> IO ()) -> IO () Source #

Given a program description, a program header, and a handler that takes a ProgramFile, this function generates the ProgramFile and passes it to the handler, while catching any exceptions that occur within either the parsing of the ProgramFile itself or while the handler is processing

withProgramAnalysis :: String -> String -> (ProgramFile (Analysis A0) -> IO ()) -> IO () Source #

Given a program description, a program header, and a handler that takes a ProgramFile, this function generates the ProgramFile annotated with Analysis and passes it to the handler, while catching any exceptions that occur within either the parsing of the ProgramFile itself or while the handler is processing

withToolOptionsAndProgramAnalysis :: String -> String -> Parser a -> (a -> ProgramFile (Analysis A0) -> IO ()) -> IO () Source #

Given a program description, a program header, a parser for tool CLI options, and a handler that takes tool CLI options object, and a ProgramFile, this function generates tool CLI options object, and a ProgramFile annotated with Analysis, and passes them to the handler, while catching any exceptions that occurs during handler processing

namedProgramUnit :: Data a => ProgramUnit a -> Maybe (String, ProgramUnit a) Source #

Given a ProgramUnit return a pair of the name of the unit as well as the unit itself only if the ProgramUnit is a PUMain, PUSubroutine, or a PUFunction

namedProgramUnits :: Data a => ProgramFile a -> [(String, ProgramUnit a)] Source #

Given a ProgramFile return all of the named ProgramUnits within the file, i.e. PUMains, PUSubroutines, or PUFunctions