-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parsers and analyses for Fortran standards 66, 77, 90, 95 and 2003 (partial). -- -- Provides lexing, parsing, and basic analyses of Fortran code covering -- standards: FORTRAN 66, FORTRAN 77, Fortran 90, Fortran 95, Fortran -- 2003 (partial) and some legacy extensions. Includes data flow and -- basic block analysis, a renamer, and type analysis. For example usage, -- see the CamFort project, which uses fortran-src as its -- front end. @package fortran-src @version 0.16.2 module Language.Fortran.AST.Common type Name = String -- | Supporting code for handling Fortran BOZ literal constants. -- -- Using the definition from the latest Fortran standards (F2003, F2008), -- BOZ constants are bitstrings (untyped!) which have basically no -- implicit rules. How they're interpreted depends on context (they are -- generally limited to DATA statements and a small handful of intrinsic -- functions). -- -- Note that currently, we don't store BOZ constants as bitstrings. -- Storing them in their string representation is easy and in that form, -- they're easy to safely resolve to an integer. An alternate option -- would be to store them as the bitstring B of BOZ, and only -- implement functions on that. For simple uses (integer), I'm doubtful -- that would provide extra utility or performance, but it may be more -- sensible in the future. For now, you may retrieve a bitstring by -- converting to a numeric type and using something like -- showIntAtBase, or a Bits instance. -- -- This type carries _some_ syntactic information that doesn't change -- meaning. The expectation is that most users won't want to inspect -- Boz values, usually just convert them, so we do it for -- convenience for checking syntax conformance. Note that not all info is -- retained -- which of single or double quotes were used is not -- recorded, for example. module Language.Fortran.AST.Literal.Boz -- | A Fortran BOZ literal constant. -- -- The prefix defines the characters allowed in the string: -- --
-- INTEGER(1) --FTInt1 :: FTInt -- |
-- INTEGER(2) --FTInt2 :: FTInt -- |
-- INTEGER(4) --FTInt4 :: FTInt -- |
-- INTEGER(8) --FTInt8 :: FTInt -- |
-- INTEGER(16) --FTInt16 :: FTInt type family FTIntCombine k1 k2 instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Type.Scalar.Int.FTInt instance Data.Binary.Class.Binary Language.Fortran.Repr.Type.Scalar.Int.FTInt instance GHC.Classes.Ord Language.Fortran.Repr.Type.Scalar.Int.FTInt instance GHC.Classes.Eq Language.Fortran.Repr.Type.Scalar.Int.FTInt instance GHC.Enum.Enum Language.Fortran.Repr.Type.Scalar.Int.FTInt instance Data.Data.Data Language.Fortran.Repr.Type.Scalar.Int.FTInt instance GHC.Generics.Generic Language.Fortran.Repr.Type.Scalar.Int.FTInt instance GHC.Show.Show Language.Fortran.Repr.Type.Scalar.Int.FTInt instance Language.Fortran.Repr.Type.Scalar.Common.FKind Language.Fortran.Repr.Type.Scalar.Int.FTInt module Language.Fortran.Repr.Type.Scalar.Real data FTReal FTReal4 :: FTReal FTReal8 :: FTReal instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Type.Scalar.Real.FTReal instance Data.Binary.Class.Binary Language.Fortran.Repr.Type.Scalar.Real.FTReal instance GHC.Classes.Ord Language.Fortran.Repr.Type.Scalar.Real.FTReal instance GHC.Classes.Eq Language.Fortran.Repr.Type.Scalar.Real.FTReal instance GHC.Enum.Enum Language.Fortran.Repr.Type.Scalar.Real.FTReal instance Data.Data.Data Language.Fortran.Repr.Type.Scalar.Real.FTReal instance GHC.Generics.Generic Language.Fortran.Repr.Type.Scalar.Real.FTReal instance GHC.Show.Show Language.Fortran.Repr.Type.Scalar.Real.FTReal instance Language.Fortran.Repr.Type.Scalar.Common.FKind Language.Fortran.Repr.Type.Scalar.Real.FTReal -- | Fortran complex data type. -- -- The complex data type is a simple layer on top of reals. We reuse the -- type and value representation from reals, but for convenience, we -- provide a newtype wrapper to enable writing a FKinded -- instance for the complex type. -- -- TODO candidate for improving. other ways of writing, name is long -- & poor. alternatively, could enforce usage of this module Language.Fortran.Repr.Type.Scalar.Complex newtype FTComplexWrapper FTComplexWrapper :: FTReal -> FTComplexWrapper [unFTComplexWrapper] :: FTComplexWrapper -> FTReal instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance Data.Binary.Class.Binary Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance GHC.Classes.Ord Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance GHC.Classes.Eq Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance GHC.Enum.Enum Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance Data.Data.Data Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance GHC.Generics.Generic Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance GHC.Show.Show Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper instance Language.Fortran.Repr.Type.Scalar.Common.FKind Language.Fortran.Repr.Type.Scalar.Complex.FTComplexWrapper module Language.Fortran.Repr.Util natVal'' :: forall (a :: NaturalK). KnownNat a => Natural module Language.Fortran.Repr.Value.Common data PrimRepr -- | Representation behaviour intends to match Fortran's. I guess we'll -- target gfortran. Machine :: PrimRepr -- | Use "mathematically ideal" representations e.g. Integer for all -- INTEGER(x) types. This enables us to check for correctness -- issues such as overflow. Idealized :: PrimRepr data Check -- | Where relevant/possible, values will be checked for correctness (e.g. -- existence of over/underflow), and adjusted accordingly. Checked :: Check -- | Values will not be checked for correctness. Unchecked :: Check -- | Idealized Fortran INTEGER values. -- -- This module stores Fortran INTEGER values in a Haskell Integer, -- together with a phantom type describing the Fortran kind. This way, we -- can safely check for bounds issues, and leave exact behaviour up to -- the user. module Language.Fortran.Repr.Value.Scalar.Int.Idealized type family FIntMRep k = r | r -> k newtype FIntI (k :: FTInt) FIntI :: Integer -> FIntI (k :: FTInt) fIntICheckBounds :: forall k rep. (rep ~ FIntMRep k, Bounded rep, Integral rep) => FIntI k -> Maybe String data SomeFIntI SomeFIntI :: FIntI fk -> SomeFIntI someFIntIBOpWrap :: (Integer -> Integer -> Integer) -> SomeFIntI -> SomeFIntI -> SomeFIntI instance Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance Data.Binary.Class.Binary (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance GHC.Classes.Ord (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance GHC.Classes.Eq (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance Data.Typeable.Internal.Typeable k => Data.Data.Data (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance GHC.Generics.Generic (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance GHC.Show.Show (Language.Fortran.Repr.Value.Scalar.Int.Idealized.FIntI k) instance GHC.Show.Show Language.Fortran.Repr.Value.Scalar.Int.Idealized.SomeFIntI instance GHC.Classes.Eq Language.Fortran.Repr.Value.Scalar.Int.Idealized.SomeFIntI -- | Idealized Fortran LOGICAL values. -- -- In cases where you don't need the machine representation of a -- LOGICAL(x), which is likely to be an INTEGER(x), you -- can store all kinds with a Haskell Bool. module Language.Fortran.Repr.Value.Scalar.Logical.Idealized newtype FLogical (k :: FTInt) FLogical :: Bool -> FLogical (k :: FTInt) instance GHC.Classes.Ord (Language.Fortran.Repr.Value.Scalar.Logical.Idealized.FLogical k) instance GHC.Classes.Eq (Language.Fortran.Repr.Value.Scalar.Logical.Idealized.FLogical k) instance GHC.Show.Show (Language.Fortran.Repr.Value.Scalar.Logical.Idealized.FLogical k) module Language.Fortran.Rewriter.Internal -- | Represents location in source code. -- -- Note that, SourceLocation indicates space between characters, -- i.e the following example: -- --
-- SourceLocation 0 1 ---- -- indicates position between first and second characters in a file. data SourceLocation SourceLocation :: Int -> Int -> SourceLocation -- | Represents range in source code. data SourceRange SourceRange :: SourceLocation -> SourceLocation -> SourceRange -- | Represents a character in the original source text along with any -- replacement operations applied to the character in place. -- -- It expects a character (in case it's empty, Nothing should be used), -- whether it should be removed, its SourceLocation and a string -- that should be put in place of it. data RChar RChar :: Maybe Char -> Bool -> SourceLocation -> ByteString -> RChar -- | Represents the intent to replace content in the file. -- -- The content in Replacement will be used in place of what is in -- the range described. Note that the replacement text can be shorter or -- larger than the original span, and it can also be multi-line. data Replacement Replacement :: SourceRange -> String -> Replacement -- | Exception raised when two Replacement objects overlap -- (OverlappingError) or Replacement points at invalid -- locations (InvalidRangeError). data ReplacementError OverlappingError :: [(Replacement, Replacement)] -> ReplacementError InvalidRangeError :: ReplacementError -- | As we advance through the [RChar] list, we consider "chunks" as -- the unit of text written out. A chunk is either: -- --
-- SourceLocation 0 1 ---- -- indicates position between first and second characters in a file. data SourceLocation SourceLocation :: Int -> Int -> SourceLocation -- | Represents range in source code. data SourceRange SourceRange :: SourceLocation -> SourceLocation -> SourceRange -- | Represents the intent to replace content in the file. -- -- The content in Replacement will be used in place of what is in -- the range described. Note that the replacement text can be shorter or -- larger than the original span, and it can also be multi-line. data Replacement Replacement :: SourceRange -> String -> Replacement -- | Exception raised when two Replacement objects overlap -- (OverlappingError) or Replacement points at invalid -- locations (InvalidRangeError). data ReplacementError OverlappingError :: [(Replacement, Replacement)] -> ReplacementError InvalidRangeError :: ReplacementError -- | Represents map of files and replacements that will be done. type ReplacementMap = Map String [Replacement] -- | Remove overlapping items from a list of replacements and return a pair -- of lists containing disjoint items and overlapping items, -- respectively. -- -- Important notes: -- -- Replacements that come first in the list will be given precedence over -- later items. partitionOverlapping :: [Replacement] -> ([Replacement], [Replacement]) -- | Apply a list of Replacements to the orginal source file. -- -- Important notes: -- -- Source locations specified in replacements are 0-indexed. -- -- Rewriting applies continuation lines when lines are longer than 72 -- characters. -- -- Example replacements: -- -- Delete the first character in a file -- --
-- Replacement (SourceRange (SourceLocation 0 0) (SourceLocation 0 1)) "" ---- -- Prepend "a" to 1 line, 2 column character -- --
-- Replacement (SourceRange (SourceLocation 0 1) (SourceLocation 0 1)) "a" ---- -- Replace a character located in 2 line, 4 column with "a" -- --
-- Replacement (SourceRange (SourceLocation 1 3) (SourceLocation 1 4)) "a" ---- -- Replace string starting in 2 line, 4 column and ending in 2 line, 6 -- column (inclusive) with "a" -- --
-- Replacement (SourceRange (SourceLocation 1 3) (SourceLocation 1 6)) "a" --processReplacements :: ReplacementMap -> IO () -- | Utility function to convert SrcSpan to SourceRange spanToSourceRange :: SrcSpan -> SourceRange -- | Given two Spans, returns a SourceRange that starts -- at the starting location of the first span, and ends at the starting -- location of the second span spanToSourceRange2 :: SrcSpan -> SrcSpan -> SourceRange -- | Given two Spans, returns a SourceRange that starts -- at the ending location of the first span, and ends at the starting -- location of the second span sourceRangeBetweenTwoSpans :: SrcSpan -> SrcSpan -> SourceRange module Language.Fortran.AST.Literal data KindParam a -- |
-- [0-9]+ --KindParamInt :: a -> SrcSpan -> String -> KindParam a -- | [a-z][a-z0-9]+ (case insensitive) KindParamVar :: a -> SrcSpan -> Name -> KindParam a instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Literal.KindParam a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Literal.KindParam a) instance GHC.Base.Functor Language.Fortran.AST.Literal.KindParam instance GHC.Generics.Generic (Language.Fortran.AST.Literal.KindParam a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Literal.KindParam a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Literal.KindParam a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Literal.KindParam a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Literal.KindParam a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Literal.KindParam a) a instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Literal.KindParam instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Literal.KindParam a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Literal.KindParam a) -- | Supporting definitions for COMPLEX literals. module Language.Fortran.AST.Literal.Complex -- | A COMPLEX literal, composed of a real part and an imaginary part. -- -- Fortran has lots of rules on how COMPLEX literals are defined and used -- in various contexts. To support all that, we define the syntactic -- structure ComplexLit to wrap all the parsing rules. Then during -- a analysis pass, you may (attempt to) convert these into a more -- regular type, like a Haskell (Double, Double) tuple. data ComplexLit a ComplexLit :: a -> SrcSpan -> ComplexPart a -> ComplexPart a -> ComplexLit a [complexLitAnno] :: ComplexLit a -> a [complexLitPos] :: ComplexLit a -> SrcSpan [complexLitRealPart] :: ComplexLit a -> ComplexPart a [complexLitImagPart] :: ComplexLit a -> ComplexPart a -- | A part (either real or imaginary) of a complex literal. -- -- Since Fortran 2003, complex literal parts support named constants, -- which must be resolved in context at compile time (R422, R423). -- -- Some compilers also allow constant expressions for the parts, and must -- evaluate at compile time. That's not allowed in any standard. -- Apparently, gfortran and ifort don't allow it, while nvfortran does. -- See: -- https://fortran-lang.discourse.group/t/complex-constants-and-variables/2909/3 -- -- We specifically avoid supporting that by defining complex parts -- without being mutually recursive with Expression. data ComplexPart a -- | signed real lit ComplexPartReal :: a -> SrcSpan -> RealLit -> Maybe (KindParam a) -> ComplexPart a -- | signed int lit ComplexPartInt :: a -> SrcSpan -> String -> Maybe (KindParam a) -> ComplexPart a -- | named constant ComplexPartNamed :: a -> SrcSpan -> Name -> ComplexPart a -- | Is the given COMPLEX literal "pure", i.e. does it have no named -- constant components? complexLitIsPure :: ComplexLit a -> Bool instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance GHC.Base.Functor Language.Fortran.AST.Literal.Complex.ComplexPart instance GHC.Generics.Generic (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Literal.Complex.ComplexPart a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance GHC.Base.Functor Language.Fortran.AST.Literal.Complex.ComplexLit instance GHC.Generics.Generic (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Literal.Complex.ComplexLit a) a instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Literal.Complex.ComplexLit instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Literal.Complex.ComplexLit a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Literal.Complex.ComplexLit a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Literal.Complex.ComplexPart a) a instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Literal.Complex.ComplexPart instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Literal.Complex.ComplexPart a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Literal.Complex.ComplexPart a) module Language.Fortran.AST.AList -- | A location-tagged list of t as (t decorated with an -- a annotation). -- -- The AST is polymorphic on some type a, which is used for -- arbitrary annotations. Since many AST nodes use lists (e.g. executable -- statements, declarations), we define a dedicated annotated list type -- to reuse. -- -- Note that the list itself also holds an a annotation. data AList t a AList :: a -> SrcSpan -> [t a] -> AList t a [alistAnno] :: AList t a -> a [alistSpan] :: AList t a -> SrcSpan [alistList] :: AList t a -> [t a] -- | Convert a non-empty list to an AList. fromList :: Spanned (t a) => a -> [t a] -> AList t a -- | Convert a list to an AList, returning Nothing iff the list is -- empty. fromList' :: Spanned (t a) => a -> [t a] -> Maybe (AList t a) fromReverseList :: Spanned (t ()) => [t ()] -> AList t () fromReverseList' :: Spanned (t ()) => [t ()] -> Maybe (AList t ()) aCons :: t a -> AList t a -> AList t a infixr 5 `aCons` aEmpty :: a -> SrcSpan -> AList t a aReverse :: AList t a -> AList t a aStrip :: AList t a -> [t a] aStrip' :: Maybe (AList t a) -> [t a] aMap :: (t a -> r a) -> AList t a -> AList r a data ATuple t1 t2 a ATuple :: a -> SrcSpan -> t1 a -> t2 a -> ATuple t1 t2 a [atupleAnno] :: ATuple t1 t2 a -> a [atupleSpan] :: ATuple t1 t2 a -> SrcSpan [atupleFst] :: ATuple t1 t2 a -> t1 a [atupleSnd] :: ATuple t1 t2 a -> t2 a instance GHC.Generics.Generic (Language.Fortran.AST.AList.AList t a) instance (Data.Typeable.Internal.Typeable t, Data.Data.Data a, Data.Data.Data (t a)) => Data.Data.Data (Language.Fortran.AST.AList.AList t a) instance (GHC.Show.Show a, GHC.Show.Show (t a)) => GHC.Show.Show (Language.Fortran.AST.AList.AList t a) instance (GHC.Classes.Ord a, GHC.Classes.Ord (t a)) => GHC.Classes.Ord (Language.Fortran.AST.AList.AList t a) instance (GHC.Classes.Eq a, GHC.Classes.Eq (t a)) => GHC.Classes.Eq (Language.Fortran.AST.AList.AList t a) instance (GHC.Base.Functor t1, GHC.Base.Functor t2) => GHC.Base.Functor (Language.Fortran.AST.AList.ATuple t1 t2) instance GHC.Generics.Generic (Language.Fortran.AST.AList.ATuple t1 t2 a) instance (Data.Typeable.Internal.Typeable t1, Data.Typeable.Internal.Typeable t2, Data.Data.Data a, Data.Data.Data (t1 a), Data.Data.Data (t2 a)) => Data.Data.Data (Language.Fortran.AST.AList.ATuple t1 t2 a) instance (GHC.Show.Show a, GHC.Show.Show (t1 a), GHC.Show.Show (t2 a)) => GHC.Show.Show (Language.Fortran.AST.AList.ATuple t1 t2 a) instance (GHC.Classes.Ord a, GHC.Classes.Ord (t1 a), GHC.Classes.Ord (t2 a)) => GHC.Classes.Ord (Language.Fortran.AST.AList.ATuple t1 t2 a) instance (GHC.Classes.Eq a, GHC.Classes.Eq (t1 a), GHC.Classes.Eq (t2 a)) => GHC.Classes.Eq (Language.Fortran.AST.AList.ATuple t1 t2 a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.AList.ATuple t1 t2 a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.AList.ATuple t1 t2 a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.AList.ATuple t1 t2 a) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out (t1 a), Text.PrettyPrint.GenericPretty.Out (t2 a)) => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.AList.ATuple t1 t2 a) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData (t1 a), Control.DeepSeq.NFData (t2 a)) => Control.DeepSeq.NFData (Language.Fortran.AST.AList.ATuple t1 t2 a) instance GHC.Base.Functor t => GHC.Base.Functor (Language.Fortran.AST.AList.AList t) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.AList.AList t a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.AList.AList t a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.AST.Annotated.Annotated (Language.Fortran.AST.AList.AList t) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.AList.AList t a) instance (Text.PrettyPrint.GenericPretty.Out a, Text.PrettyPrint.GenericPretty.Out (t a)) => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.AList.AList t a) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData (t a)) => Control.DeepSeq.NFData (Language.Fortran.AST.AList.AList t a) -- | Fortran version enum and tools for selecting version for a given file. module Language.Fortran.Version -- | The Fortran specification version used (or relevant to its context). -- -- The constructor ordering is important, since it's used for the Ord -- instance (which is used extensively for pretty printing). data FortranVersion Fortran66 :: FortranVersion -- | fairly close to FORTRAN 77 standard Fortran77 :: FortranVersion -- | F77 with some extensions Fortran77Extended :: FortranVersion -- | F77 with most extensions Fortran77Legacy :: FortranVersion Fortran90 :: FortranVersion Fortran95 :: FortranVersion Fortran2003 :: FortranVersion Fortran2008 :: FortranVersion fortranVersionAliases :: [(String, FortranVersion)] selectFortranVersion :: String -> Maybe FortranVersion -- | Deduce the FortranVersion from a FilePath using -- extension. -- -- Defaults to Fortran 90 if suffix is unrecognized. deduceFortranVersion :: FilePath -> FortranVersion instance GHC.Generics.Generic Language.Fortran.Version.FortranVersion instance Data.Data.Data Language.Fortran.Version.FortranVersion instance GHC.Classes.Eq Language.Fortran.Version.FortranVersion instance GHC.Classes.Ord Language.Fortran.Version.FortranVersion instance GHC.Show.Show Language.Fortran.Version.FortranVersion instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Version.FortranVersion instance Control.DeepSeq.NFData Language.Fortran.Version.FortranVersion -- | Parser/lexer monad, plus common functionality and definitions. module Language.Fortran.Parser.Monad data ParanthesesCount ParanthesesCount :: Integer -> Bool -> ParanthesesCount [pcActual] :: ParanthesesCount -> Integer [pcHasReached0] :: ParanthesesCount -> Bool data Context ConStart :: Context ConData :: Context ConImplicit :: Context ConNamelist :: Context ConCommon :: Context data ParseState a ParseState :: a -> ParanthesesCount -> FortranVersion -> String -> [Context] -> ParseState a [psAlexInput] :: ParseState a -> a [psParanthesesCount] :: ParseState a -> ParanthesesCount [psVersion] :: ParseState a -> FortranVersion [psFilename] :: ParseState a -> String [psContext] :: ParseState a -> [Context] data ParseError a b ParseError :: Position -> Maybe b -> String -> String -> ParseError a b [errPos] :: ParseError a b -> Position [errLastToken] :: ParseError a b -> Maybe b [errFilename] :: ParseError a b -> String [errMsg] :: ParseError a b -> String tokenMsg :: Show a => Maybe a -> String data ParseResult b c a ParseOk :: a -> ParseState b -> ParseResult b c a ParseFailed :: ParseError b c -> ParseResult b c a class LastToken a b | a -> b getLastToken :: (LastToken a b, Show b) => a -> Maybe b class Tok a eofToken :: Tok a => a -> Bool newtype Parse b c a Parse :: (ParseState b -> ParseResult b c a) -> Parse b c a [unParse] :: Parse b c a -> ParseState b -> ParseResult b c a runParse :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> ParseResult b c a runParseUnsafe :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> (a, ParseState b) throwIOError :: String -> a evalParse :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> a execParse :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> ParseState b getVersion :: (Loc a, LastToken a b, Show b) => Parse a b FortranVersion putAlex :: (Loc a, LastToken a b, Show b) => a -> Parse a b () getAlex :: (Loc a, LastToken a b, Show b) => Parse a b a topContext :: (Loc a, LastToken a b, Show b) => Parse a b Context popContext :: (Loc a, LastToken a b, Show b) => Parse a b () pushContext :: (Loc a, LastToken a b, Show b) => Context -> Parse a b () getPosition :: (Loc a, LastToken a b, Show b) => Parse a b Position getSrcSpan :: (Loc a, LastToken a b, Show b) => Position -> Parse a b SrcSpan getParanthesesCount :: (Loc a, LastToken a b, Show b) => Parse a b ParanthesesCount resetPar :: (Loc a, LastToken a b, Show b) => Parse a b () incPar :: (Loc a, LastToken a b, Show b) => Parse a b () decPar :: (Loc a, LastToken a b, Show b) => Parse a b () instance GHC.Classes.Eq Language.Fortran.Parser.Monad.ParanthesesCount instance GHC.Show.Show Language.Fortran.Parser.Monad.ParanthesesCount instance GHC.Classes.Eq Language.Fortran.Parser.Monad.Context instance GHC.Show.Show Language.Fortran.Parser.Monad.Context instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.Parser.Monad.ParseState a) instance GHC.Base.Functor (Language.Fortran.Parser.Monad.ParseResult b c) instance (Language.Fortran.Util.Position.Loc b, Language.Fortran.Parser.Monad.LastToken b c, GHC.Show.Show c) => GHC.Base.Functor (Language.Fortran.Parser.Monad.Parse b c) instance (Language.Fortran.Util.Position.Loc b, Language.Fortran.Parser.Monad.LastToken b c, GHC.Show.Show c) => GHC.Base.Applicative (Language.Fortran.Parser.Monad.Parse b c) instance (Language.Fortran.Util.Position.Loc b, Language.Fortran.Parser.Monad.LastToken b c, GHC.Show.Show c) => GHC.Base.Monad (Language.Fortran.Parser.Monad.Parse b c) instance (Language.Fortran.Util.Position.Loc b, Language.Fortran.Parser.Monad.LastToken b c, GHC.Show.Show c) => Control.Monad.Fail.MonadFail (Language.Fortran.Parser.Monad.Parse b c) instance (Language.Fortran.Util.Position.Loc b, Language.Fortran.Parser.Monad.LastToken b c, GHC.Show.Show c) => Control.Monad.State.Class.MonadState (Language.Fortran.Parser.Monad.ParseState b) (Language.Fortran.Parser.Monad.Parse b c) instance (Language.Fortran.Util.Position.Loc b, Language.Fortran.Parser.Monad.LastToken b c, GHC.Show.Show c) => Control.Monad.Error.Class.MonadError (Language.Fortran.Parser.Monad.ParseError b c) (Language.Fortran.Parser.Monad.Parse b c) instance forall k b (a :: k). GHC.Show.Show b => GHC.Show.Show (Language.Fortran.Parser.Monad.ParseError a b) instance (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b, GHC.Show.Show a, GHC.Show.Show b) => GHC.Exception.Type.Exception (Language.Fortran.Parser.Monad.ParseError a b) module Language.Fortran.Parser.Free.Lexer lexer :: (Token -> LexAction a) -> LexAction a data Token TId :: SrcSpan -> String -> Token TComment :: SrcSpan -> String -> Token TString :: SrcSpan -> String -> Token TIntegerLiteral :: SrcSpan -> String -> Token TRealLiteral :: SrcSpan -> RealLit -> Token TBozLiteral :: SrcSpan -> Boz -> Token TComma :: SrcSpan -> Token TComma2 :: SrcSpan -> Token TSemiColon :: SrcSpan -> Token TColon :: SrcSpan -> Token TDoubleColon :: SrcSpan -> Token TOpAssign :: SrcSpan -> Token TArrow :: SrcSpan -> Token TPercent :: SrcSpan -> Token TLeftPar :: SrcSpan -> Token TLeftPar2 :: SrcSpan -> Token TRightPar :: SrcSpan -> Token TLeftInitPar :: SrcSpan -> Token TRightInitPar :: SrcSpan -> Token TOpCustom :: SrcSpan -> String -> Token TOpExp :: SrcSpan -> Token TOpPlus :: SrcSpan -> Token TOpMinus :: SrcSpan -> Token TStar :: SrcSpan -> Token TOpDivision :: SrcSpan -> Token TSlash :: SrcSpan -> Token TOpOr :: SrcSpan -> Token TOpAnd :: SrcSpan -> Token TOpNot :: SrcSpan -> Token TOpEquivalent :: SrcSpan -> Token TOpNotEquivalent :: SrcSpan -> Token TOpLT :: SrcSpan -> Token TOpLE :: SrcSpan -> Token TOpEQ :: SrcSpan -> Token TOpNE :: SrcSpan -> Token TOpGT :: SrcSpan -> Token TOpGE :: SrcSpan -> Token TLogicalLiteral :: SrcSpan -> Bool -> Token TUnderscore :: SrcSpan -> Token TProgram :: SrcSpan -> Token TEndProgram :: SrcSpan -> Token TFunction :: SrcSpan -> Token TEndFunction :: SrcSpan -> Token TResult :: SrcSpan -> Token TPure :: SrcSpan -> Token TElemental :: SrcSpan -> Token TRecursive :: SrcSpan -> Token TSubroutine :: SrcSpan -> Token TEndSubroutine :: SrcSpan -> Token TBlockData :: SrcSpan -> Token TEndBlockData :: SrcSpan -> Token TModule :: SrcSpan -> Token TEndModule :: SrcSpan -> Token TContains :: SrcSpan -> Token TUse :: SrcSpan -> Token TOnly :: SrcSpan -> Token TImport :: SrcSpan -> Token TAbstract :: SrcSpan -> Token TInterface :: SrcSpan -> Token TEndInterface :: SrcSpan -> Token TProcedure :: SrcSpan -> Token TModuleProcedure :: SrcSpan -> Token TAssignment :: SrcSpan -> Token TOperator :: SrcSpan -> Token TCall :: SrcSpan -> Token TReturn :: SrcSpan -> Token TEntry :: SrcSpan -> Token TInclude :: SrcSpan -> Token TBind :: SrcSpan -> Token TC :: SrcSpan -> Token TName :: SrcSpan -> Token TAllocatable :: SrcSpan -> Token TAsynchronous :: SrcSpan -> Token TDimension :: SrcSpan -> Token TExternal :: SrcSpan -> Token TIntent :: SrcSpan -> Token TIntrinsic :: SrcSpan -> Token TNonIntrinsic :: SrcSpan -> Token TOptional :: SrcSpan -> Token TParameter :: SrcSpan -> Token TPointer :: SrcSpan -> Token TPrivate :: SrcSpan -> Token TPublic :: SrcSpan -> Token TProtected :: SrcSpan -> Token TSave :: SrcSpan -> Token TTarget :: SrcSpan -> Token TValue :: SrcSpan -> Token TVolatile :: SrcSpan -> Token TIn :: SrcSpan -> Token TOut :: SrcSpan -> Token TInOut :: SrcSpan -> Token TData :: SrcSpan -> Token TNamelist :: SrcSpan -> Token TImplicit :: SrcSpan -> Token TEquivalence :: SrcSpan -> Token TCommon :: SrcSpan -> Token TFormat :: SrcSpan -> Token TBlob :: SrcSpan -> String -> Token TAllocate :: SrcSpan -> Token TStat :: SrcSpan -> Token TErrMsg :: SrcSpan -> Token TSource :: SrcSpan -> Token TDeallocate :: SrcSpan -> Token TNullify :: SrcSpan -> Token TNone :: SrcSpan -> Token TGoto :: SrcSpan -> Token TAssign :: SrcSpan -> Token TTo :: SrcSpan -> Token TContinue :: SrcSpan -> Token TStop :: SrcSpan -> Token TPause :: SrcSpan -> Token TDo :: SrcSpan -> Token TEndDo :: SrcSpan -> Token TWhile :: SrcSpan -> Token TIf :: SrcSpan -> Token TThen :: SrcSpan -> Token TElse :: SrcSpan -> Token TElsif :: SrcSpan -> Token TEndIf :: SrcSpan -> Token TCase :: SrcSpan -> Token TSelectCase :: SrcSpan -> Token TEndSelect :: SrcSpan -> Token TDefault :: SrcSpan -> Token TCycle :: SrcSpan -> Token TExit :: SrcSpan -> Token TForall :: SrcSpan -> Token TEndForall :: SrcSpan -> Token TAssociate :: SrcSpan -> Token TEndAssociate :: SrcSpan -> Token TWhere :: SrcSpan -> Token TElsewhere :: SrcSpan -> Token TEndWhere :: SrcSpan -> Token TType :: SrcSpan -> Token TEndType :: SrcSpan -> Token TSequence :: SrcSpan -> Token TClass :: SrcSpan -> Token TEnum :: SrcSpan -> Token TEnumerator :: SrcSpan -> Token TEndEnum :: SrcSpan -> Token TKind :: SrcSpan -> Token TLen :: SrcSpan -> Token TInteger :: SrcSpan -> Token TReal :: SrcSpan -> Token TDoublePrecision :: SrcSpan -> Token TLogical :: SrcSpan -> Token TCharacter :: SrcSpan -> Token TComplex :: SrcSpan -> Token TOpen :: SrcSpan -> Token TClose :: SrcSpan -> Token TRead :: SrcSpan -> Token TWrite :: SrcSpan -> Token TPrint :: SrcSpan -> Token TBackspace :: SrcSpan -> Token TRewind :: SrcSpan -> Token TInquire :: SrcSpan -> Token TEndfile :: SrcSpan -> Token TEnd :: SrcSpan -> Token TNewline :: SrcSpan -> Token TEOF :: SrcSpan -> Token TFlush :: SrcSpan -> Token TUnit :: SrcSpan -> Token TIOStat :: SrcSpan -> Token TIOMsg :: SrcSpan -> Token TErr :: SrcSpan -> Token vanillaAlexInput :: String -> ByteString -> AlexInput data AlexInput AlexInput :: !ByteString -> {-# UNPACK #-} !Position -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Char -> {-# UNPACK #-} !Lexeme -> {-# UNPACK #-} !StartCode -> !Maybe Token -> ![Token] -> AlexInput [aiSourceBytes] :: AlexInput -> !ByteString [aiPosition] :: AlexInput -> {-# UNPACK #-} !Position [aiEndOffset] :: AlexInput -> {-# UNPACK #-} !Int [aiPreviousChar] :: AlexInput -> {-# UNPACK #-} !Char [aiLexeme] :: AlexInput -> {-# UNPACK #-} !Lexeme [aiStartCode] :: AlexInput -> {-# UNPACK #-} !StartCode [aiPreviousToken] :: AlexInput -> !Maybe Token [aiPreviousTokensInLine] :: AlexInput -> ![Token] type LexAction a = Parse AlexInput Token a lexer' :: LexAction Token data StartCode StartCode :: {-# UNPACK #-} !Int -> !StartCodeStatus -> StartCode [scActual] :: StartCode -> {-# UNPACK #-} !Int [scStatus] :: StartCode -> !StartCodeStatus data StartCodeStatus Return :: StartCodeStatus Stable :: StartCodeStatus scN :: Int instance GHC.Show.Show Language.Fortran.Parser.Free.Lexer.Lexeme instance GHC.Show.Show Language.Fortran.Parser.Free.Lexer.StartCodeStatus instance GHC.Show.Show Language.Fortran.Parser.Free.Lexer.StartCode instance GHC.Generics.Generic Language.Fortran.Parser.Free.Lexer.Token instance Data.Data.Data Language.Fortran.Parser.Free.Lexer.Token instance GHC.Show.Show Language.Fortran.Parser.Free.Lexer.Token instance GHC.Classes.Eq Language.Fortran.Parser.Free.Lexer.Token instance GHC.Show.Show Language.Fortran.Parser.Free.Lexer.AlexInput instance Language.Fortran.Parser.Free.Lexer.SpecifiesType Language.Fortran.Parser.Free.Lexer.Token instance Language.Fortran.Parser.Free.Lexer.SpecifiesType [Language.Fortran.Parser.Free.Lexer.Token] instance Language.Fortran.Util.Position.Loc Language.Fortran.Parser.Free.Lexer.AlexInput instance Language.Fortran.Parser.Monad.LastToken Language.Fortran.Parser.Free.Lexer.AlexInput Language.Fortran.Parser.Free.Lexer.Token instance Language.Fortran.Util.FirstParameter.FirstParameter Language.Fortran.Parser.Free.Lexer.Token Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.FirstParameter.FirstParameter Language.Fortran.Parser.Free.Lexer.Token Language.Fortran.Util.Position.SrcSpan => Language.Fortran.Util.Position.Spanned Language.Fortran.Parser.Free.Lexer.Token instance Language.Fortran.Parser.Monad.Tok Language.Fortran.Parser.Free.Lexer.Token instance Language.Fortran.Util.Position.Spanned Language.Fortran.Parser.Free.Lexer.Lexeme module Language.Fortran.Parser.Free.Utils unitNameCheck :: Token -> String -> Parse AlexInput Token () parseError :: Token -> LexAction a module Language.Fortran.Parser.Fixed.Lexer lexer :: (Token -> LexAction a) -> LexAction a data Token TLeftPar :: SrcSpan -> Token TRightPar :: SrcSpan -> Token TLeftArrayPar :: SrcSpan -> Token TRightArrayPar :: SrcSpan -> Token TComma :: SrcSpan -> Token TDot :: SrcSpan -> Token TPercent :: SrcSpan -> Token TColon :: SrcSpan -> Token TInclude :: SrcSpan -> Token TProgram :: SrcSpan -> Token TFunction :: SrcSpan -> Token TSubroutine :: SrcSpan -> Token TBlockData :: SrcSpan -> Token TStructure :: SrcSpan -> Token TRecord :: SrcSpan -> Token TUnion :: SrcSpan -> Token TMap :: SrcSpan -> Token TEndProgram :: SrcSpan -> Token TEndFunction :: SrcSpan -> Token TEndSubroutine :: SrcSpan -> Token TEndStructure :: SrcSpan -> Token TEndUnion :: SrcSpan -> Token TEndMap :: SrcSpan -> Token TEnd :: SrcSpan -> Token TAssign :: SrcSpan -> Token TOpAssign :: SrcSpan -> Token TTo :: SrcSpan -> Token TGoto :: SrcSpan -> Token TIf :: SrcSpan -> Token TThen :: SrcSpan -> Token TElse :: SrcSpan -> Token TElsif :: SrcSpan -> Token TEndif :: SrcSpan -> Token TCall :: SrcSpan -> Token TReturn :: SrcSpan -> Token TSave :: SrcSpan -> Token TContinue :: SrcSpan -> Token TStop :: SrcSpan -> Token TCycle :: SrcSpan -> Token TExit :: SrcSpan -> Token TCase :: SrcSpan -> Token TCaseDefault :: SrcSpan -> Token TSelectCase :: SrcSpan -> Token TEndSelect :: SrcSpan -> Token TPause :: SrcSpan -> Token TDo :: SrcSpan -> Token TDoWhile :: SrcSpan -> Token TWhile :: SrcSpan -> Token TEndDo :: SrcSpan -> Token TRead :: SrcSpan -> Token TWrite :: SrcSpan -> Token TRewind :: SrcSpan -> Token TBackspace :: SrcSpan -> Token TEndfile :: SrcSpan -> Token TInquire :: SrcSpan -> Token TOpen :: SrcSpan -> Token TClose :: SrcSpan -> Token TPrint :: SrcSpan -> Token TTypePrint :: SrcSpan -> Token TDimension :: SrcSpan -> Token TCommon :: SrcSpan -> Token TEquivalence :: SrcSpan -> Token TPointer :: SrcSpan -> Token TExternal :: SrcSpan -> Token TIntrinsic :: SrcSpan -> Token TType :: SrcSpan -> String -> Token TEntry :: SrcSpan -> Token TImplicit :: SrcSpan -> Token TNone :: SrcSpan -> Token TParameter :: SrcSpan -> Token TData :: SrcSpan -> Token TStatic :: SrcSpan -> Token TAutomatic :: SrcSpan -> Token TFormat :: SrcSpan -> Token TBlob :: SrcSpan -> String -> Token TInt :: SrcSpan -> String -> Token TBozLiteral :: SrcSpan -> Boz -> Token TExponent :: SrcSpan -> String -> Token TBool :: SrcSpan -> Bool -> Token TOpPlus :: SrcSpan -> Token TOpMinus :: SrcSpan -> Token TOpExp :: SrcSpan -> Token TStar :: SrcSpan -> Token TSlash :: SrcSpan -> Token TAmpersand :: SrcSpan -> Token TOpOr :: SrcSpan -> Token TOpAnd :: SrcSpan -> Token TOpXOr :: SrcSpan -> Token TOpNot :: SrcSpan -> Token TOpEquivalent :: SrcSpan -> Token TOpNotEquivalent :: SrcSpan -> Token TOpLT :: SrcSpan -> Token TOpLE :: SrcSpan -> Token TOpEQ :: SrcSpan -> Token TOpNE :: SrcSpan -> Token TOpGT :: SrcSpan -> Token TOpGE :: SrcSpan -> Token TId :: SrcSpan -> String -> Token TComment :: SrcSpan -> String -> Token TString :: SrcSpan -> String -> Token THollerith :: SrcSpan -> String -> Token TLabel :: SrcSpan -> String -> Token TNewline :: SrcSpan -> Token TEOF :: SrcSpan -> Token vanillaAlexInput :: String -> FortranVersion -> ByteString -> AlexInput data AlexInput AlexInput :: ByteString -> Int -> Position -> [Word8] -> Char -> Lexeme -> Int -> Int -> Maybe Token -> [Token] -> Bool -> Bool -> Bool -> FortranVersion -> AlexInput [aiSourceBytes] :: AlexInput -> ByteString [aiEndOffset] :: AlexInput -> Int [aiPosition] :: AlexInput -> Position [aiBytes] :: AlexInput -> [Word8] [aiPreviousChar] :: AlexInput -> Char [aiLexeme] :: AlexInput -> Lexeme [aiWhiteSensitiveCharCount] :: AlexInput -> Int [aiStartCode] :: AlexInput -> Int [aiPreviousToken] :: AlexInput -> Maybe Token [aiPreviousTokensInLine] :: AlexInput -> [Token] [aiCaseSensitive] :: AlexInput -> Bool [aiInComment] :: AlexInput -> Bool [aiInFormat] :: AlexInput -> Bool [aiFortranVersion] :: AlexInput -> FortranVersion type LexAction a = Parse AlexInput Token a lexN :: Int -> LexAction (Maybe String) lexemeMatch :: Lexeme -> String lexer' :: LexAction Token instance GHC.Generics.Generic Language.Fortran.Parser.Fixed.Lexer.Token instance Data.Data.Data Language.Fortran.Parser.Fixed.Lexer.Token instance GHC.Classes.Ord Language.Fortran.Parser.Fixed.Lexer.Token instance GHC.Classes.Eq Language.Fortran.Parser.Fixed.Lexer.Token instance GHC.Show.Show Language.Fortran.Parser.Fixed.Lexer.Token instance GHC.Show.Show Language.Fortran.Parser.Fixed.Lexer.Lexeme instance GHC.Show.Show Language.Fortran.Parser.Fixed.Lexer.AlexInput instance Language.Fortran.Util.Position.Loc Language.Fortran.Parser.Fixed.Lexer.AlexInput instance Language.Fortran.Parser.Monad.LastToken Language.Fortran.Parser.Fixed.Lexer.AlexInput Language.Fortran.Parser.Fixed.Lexer.Token instance Language.Fortran.Util.Position.Spanned Language.Fortran.Parser.Fixed.Lexer.Lexeme instance Language.Fortran.Util.FirstParameter.FirstParameter Language.Fortran.Parser.Fixed.Lexer.Token Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.FirstParameter.FirstParameter Language.Fortran.Parser.Fixed.Lexer.Token Language.Fortran.Util.Position.SrcSpan => Language.Fortran.Util.Position.Spanned Language.Fortran.Parser.Fixed.Lexer.Token instance Language.Fortran.Parser.Monad.Tok Language.Fortran.Parser.Fixed.Lexer.Token module Language.Fortran.Intrinsics -- | Obtain set of intrinsics that are most closely aligned with given -- version. getVersionIntrinsics :: FortranVersion -> IntrinsicsTable getIntrinsicReturnType :: String -> IntrinsicsTable -> Maybe IntrinsicType getIntrinsicNames :: IntrinsicsTable -> [String] getIntrinsicDefsUses :: String -> IntrinsicsTable -> Maybe ([Int], [Int]) isIntrinsic :: String -> IntrinsicsTable -> Bool data IntrinsicType ITReal :: IntrinsicType ITInteger :: IntrinsicType ITComplex :: IntrinsicType ITDouble :: IntrinsicType ITLogical :: IntrinsicType ITCharacter :: IntrinsicType ITParam :: Int -> IntrinsicType type IntrinsicsTable = Map String IntrinsicsEntry allIntrinsics :: IntrinsicsTable instance GHC.Generics.Generic Language.Fortran.Intrinsics.IntrinsicType instance GHC.Classes.Ord Language.Fortran.Intrinsics.IntrinsicType instance GHC.Classes.Eq Language.Fortran.Intrinsics.IntrinsicType instance GHC.Show.Show Language.Fortran.Intrinsics.IntrinsicType instance GHC.Generics.Generic Language.Fortran.Intrinsics.IntrinsicsEntry instance GHC.Classes.Ord Language.Fortran.Intrinsics.IntrinsicsEntry instance GHC.Classes.Eq Language.Fortran.Intrinsics.IntrinsicsEntry instance GHC.Show.Show Language.Fortran.Intrinsics.IntrinsicsEntry -- | Data types for representing Fortran code (for various versions of -- Fortran). -- -- The same representation is used for all supported Fortran standards. -- Constructs only available in certain versions are gated by the parsers -- (and the pretty printer). In general, the definitions here are highly -- permissible, partly to allow for all the oddities of older standards -- & extensions. -- -- Useful Fortran standard references: -- --
-- [0-9]+ --KindParamInt :: a -> SrcSpan -> String -> KindParam a -- | [a-z][a-z0-9]+ (case insensitive) KindParamVar :: a -> SrcSpan -> Name -> KindParam a -- | A part (either real or imaginary) of a complex literal. -- -- Since Fortran 2003, complex literal parts support named constants, -- which must be resolved in context at compile time (R422, R423). -- -- Some compilers also allow constant expressions for the parts, and must -- evaluate at compile time. That's not allowed in any standard. -- Apparently, gfortran and ifort don't allow it, while nvfortran does. -- See: -- https://fortran-lang.discourse.group/t/complex-constants-and-variables/2909/3 -- -- We specifically avoid supporting that by defining complex parts -- without being mutually recursive with Expression. data ComplexPart a -- | signed real lit ComplexPartReal :: a -> SrcSpan -> RealLit -> Maybe (KindParam a) -> ComplexPart a -- | signed int lit ComplexPartInt :: a -> SrcSpan -> String -> Maybe (KindParam a) -> ComplexPart a -- | named constant ComplexPartNamed :: a -> SrcSpan -> Name -> ComplexPart a data UnaryOp Plus :: UnaryOp Minus :: UnaryOp Not :: UnaryOp UnCustom :: String -> UnaryOp data BinaryOp Addition :: BinaryOp Subtraction :: BinaryOp Multiplication :: BinaryOp Division :: BinaryOp Exponentiation :: BinaryOp Concatenation :: BinaryOp GT :: BinaryOp GTE :: BinaryOp LT :: BinaryOp LTE :: BinaryOp EQ :: BinaryOp NE :: BinaryOp Or :: BinaryOp XOr :: BinaryOp And :: BinaryOp Equivalent :: BinaryOp NotEquivalent :: BinaryOp BinCustom :: String -> BinaryOp type Name = String -- | Type name referenced in syntax. -- -- In many Fortran specs and compilers, certain types are actually -- "synonyms" for other types with specified kinds. The primary example -- is DOUBLE PRECISION being equivalent to REAL(8). Type kinds were -- introduced in Fortran 90, and it should be safe to replace all -- instances of DOUBLE PRECISION with REAL(8) in Fortran 90 code. -- However, type kinds weren't present in (standard) Fortran 77, so this -- equivalence was detached from the user. -- -- In any case, it's unclear how strong the equivalence is and whether it -- can be retroactively applied to previous standards. We choose to parse -- types directly, and handle those transformations during type analysis, -- where we assign most scalars a kind (see SemType). data BaseType TypeInteger :: BaseType TypeReal :: BaseType TypeDoublePrecision :: BaseType TypeComplex :: BaseType TypeDoubleComplex :: BaseType TypeLogical :: BaseType TypeCharacter :: BaseType TypeCustom :: String -> BaseType ClassStar :: BaseType ClassCustom :: String -> BaseType TypeByte :: BaseType -- | The type specification of a declaration statement, containing the -- syntactic type name and kind selector. -- -- See HP's F90 spec pg.24. data TypeSpec a TypeSpec :: a -> SrcSpan -> BaseType -> Maybe (Selector a) -> TypeSpec a [typeSpecAnno] :: TypeSpec a -> a [typeSpecSpan] :: TypeSpec a -> SrcSpan [typeSpecBaseType] :: TypeSpec a -> BaseType [typeSpecSelector] :: TypeSpec a -> Maybe (Selector a) -- | The "kind selector" of a declaration statement. Tightly bound to -- TypeSpec. -- -- HP's F90 spec (pg.24) actually differentiates between "kind selectors" -- and "char selectors", where char selectors can specify a length -- (alongside kind), and the default meaning of an unlabelled kind -- parameter (the 8 in INTEGER(8)) is length instead of kind. We handle -- this correctly in the parsers, but place both into this -- Selector type. -- -- The upshot is, length is invalid for non-CHARACTER types, and the -- parser guarantees that it will be Nothing. For CHARACTER types, both -- maybe or may not be present. -- -- Often used with the assumption that when a Selector term is -- present, it contains some information (i.e. one of length or kind is -- Just _), so that the awkward "empty" possibility may -- be avoided. data Selector a Selector :: a -> SrcSpan -> Maybe (Expression a) -> Maybe (Expression a) -> Selector a [selectorAnno] :: Selector a -> a [selectorSpan] :: Selector a -> SrcSpan [selectorLength] :: Selector a -> Maybe (Expression a) [selectorKind] :: Selector a -> Maybe (Expression a) -- | Declarators. R505 entity-decl from F90 ISO spec. -- -- Declaration statements can have multiple variables on the right of the -- double colon, separated by commas. A Declarator identifies a -- single one of these. In F90, they look like this: -- -- VAR_NAME ( OPT_ARRAY_DIMS ) * CHAR_LENGTH_EXPR = INIT_EXPR -- -- F77 doesn't standardize so nicely -- in particular, I'm not confident -- in initializing expression syntax. So no example. -- -- Only CHARACTERs may specify a length. However, a nonstandard syntax -- feature uses non-CHARACTER lengths as a kind parameter. We parse -- regardless of type and warn during analysis. data Declarator a Declarator :: a -> SrcSpan -> Expression a -> DeclaratorType a -> Maybe (Expression a) -> Maybe (Expression a) -> Declarator a [declaratorAnno] :: Declarator a -> a [declaratorSpan] :: Declarator a -> SrcSpan [declaratorVariable] :: Declarator a -> Expression a [declaratorType] :: Declarator a -> DeclaratorType a [declaratorLength] :: Declarator a -> Maybe (Expression a) [declaratorInitial] :: Declarator a -> Maybe (Expression a) data DeclaratorType a ScalarDecl :: DeclaratorType a ArrayDecl :: AList DimensionDeclarator a -> DeclaratorType a -- | Dimension declarator stored in dimension attributes and -- Declarators. data DimensionDeclarator a DimensionDeclarator :: a -> SrcSpan -> Maybe (Expression a) -> Maybe (Expression a) -> DimensionDeclarator a [dimDeclAnno] :: DimensionDeclarator a -> a [dimDeclSpan] :: DimensionDeclarator a -> SrcSpan [dimDeclLower] :: DimensionDeclarator a -> Maybe (Expression a) [dimDeclUpper] :: DimensionDeclarator a -> Maybe (Expression a) data Attribute a AttrAllocatable :: a -> SrcSpan -> Attribute a AttrAsynchronous :: a -> SrcSpan -> Attribute a AttrDimension :: a -> SrcSpan -> AList DimensionDeclarator a -> Attribute a AttrExternal :: a -> SrcSpan -> Attribute a AttrIntent :: a -> SrcSpan -> Intent -> Attribute a AttrIntrinsic :: a -> SrcSpan -> Attribute a AttrOptional :: a -> SrcSpan -> Attribute a AttrParameter :: a -> SrcSpan -> Attribute a AttrPointer :: a -> SrcSpan -> Attribute a AttrPrivate :: a -> SrcSpan -> Attribute a AttrProtected :: a -> SrcSpan -> Attribute a AttrPublic :: a -> SrcSpan -> Attribute a AttrSave :: a -> SrcSpan -> Attribute a AttrSuffix :: a -> SrcSpan -> Suffix a -> Attribute a AttrTarget :: a -> SrcSpan -> Attribute a AttrValue :: a -> SrcSpan -> Attribute a AttrVolatile :: a -> SrcSpan -> Attribute a data Prefix a PfxRecursive :: a -> SrcSpan -> Prefix a PfxElemental :: a -> SrcSpan -> Prefix a PfxPure :: a -> SrcSpan -> Prefix a data Suffix a SfxBind :: a -> SrcSpan -> Maybe (Expression a) -> Suffix a data ProcDecl a ProcDecl :: a -> SrcSpan -> Expression a -> Maybe (Expression a) -> ProcDecl a [procDeclAnno] :: ProcDecl a -> a [procDeclSpan] :: ProcDecl a -> SrcSpan [procDeclEntityName] :: ProcDecl a -> Expression a [procDeclInitName] :: ProcDecl a -> Maybe (Expression a) data ProcInterface a ProcInterfaceName :: a -> SrcSpan -> Expression a -> ProcInterface a ProcInterfaceType :: a -> SrcSpan -> TypeSpec a -> ProcInterface a newtype Comment a Comment :: String -> Comment a -- | Part of a FORALL statement. Introduced in Fortran 95. data ForallHeader a ForallHeader :: a -> SrcSpan -> [ForallHeaderPart a] -> Maybe (Expression a) -> ForallHeader a [forallHeaderAnno] :: ForallHeader a -> a [forallHeaderSpan] :: ForallHeader a -> SrcSpan [forallHeaderHeaders] :: ForallHeader a -> [ForallHeaderPart a] [forallHeaderScaling] :: ForallHeader a -> Maybe (Expression a) data ForallHeaderPart a ForallHeaderPart :: a -> SrcSpan -> Name -> Expression a -> Expression a -> Maybe (Expression a) -> ForallHeaderPart a [forallHeaderPartAnno] :: ForallHeaderPart a -> a [forallHeaderPartSpan] :: ForallHeaderPart a -> SrcSpan [forallHeaderPartName] :: ForallHeaderPart a -> Name [forallHeaderPartStart] :: ForallHeaderPart a -> Expression a [forallHeaderPartEnd] :: ForallHeaderPart a -> Expression a [forallHeaderPartStride] :: ForallHeaderPart a -> Maybe (Expression a) data Only Exclusive :: Only Permissive :: Only data MetaInfo MetaInfo :: FortranVersion -> String -> MetaInfo [miVersion] :: MetaInfo -> FortranVersion [miFilename] :: MetaInfo -> String type Prefixes a = Maybe (AList Prefix a) type Suffixes a = Maybe (AList Suffix a) type PrefixSuffix a = (Prefixes a, Suffixes a) data ModuleNature ModIntrinsic :: ModuleNature ModNonIntrinsic :: ModuleNature -- | Part of USE statement. (F2018 14.2.2) -- -- Expressions may be names or operators. data Use a UseRename :: a -> SrcSpan -> Expression a -> Expression a -> Use a -- | name UseID :: a -> SrcSpan -> Expression a -> Use a data Argument a Argument :: a -> SrcSpan -> Maybe String -> ArgumentExpression a -> Argument a [argumentAnno] :: Argument a -> a [argumentSpan] :: Argument a -> SrcSpan [argumentName] :: Argument a -> Maybe String [argumentExpr] :: Argument a -> ArgumentExpression a -- | Extra data type to disambiguate between plain variable arguments and -- expression arguments (due to apparent behaviour of some Fortran -- compilers to treat these differently). -- -- Note the Annotated and Spanned instances pass to the -- inner Expression for ArgExpr. data ArgumentExpression a ArgExpr :: Expression a -> ArgumentExpression a ArgExprVar :: a -> SrcSpan -> Name -> ArgumentExpression a argExprNormalize :: ArgumentExpression a -> Expression a argExtractExpr :: Argument a -> Expression a data Intent In :: Intent Out :: Intent InOut :: Intent data ControlPair a ControlPair :: a -> SrcSpan -> Maybe String -> Expression a -> ControlPair a [controlPairAnno] :: ControlPair a -> a [controlPairSpan] :: ControlPair a -> SrcSpan [controlPairName] :: ControlPair a -> Maybe String [controlPairExpr] :: ControlPair a -> Expression a -- | Part of ALLOCATE statement. -- -- There are restrictions on how ALLOCATE options can be combined. See -- F2018 9.7.1, or: -- https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference/a-to-b/allocate-statement.html data AllocOpt a -- | (output) status of allocation AOStat :: a -> SrcSpan -> Expression a -> AllocOpt a -- | (output) error condition if present AOErrMsg :: a -> SrcSpan -> Expression a -> AllocOpt a AOSource :: a -> SrcSpan -> Expression a -> AllocOpt a -- | List of names for an IMPLICIT statement. data ImpList a ImpList :: a -> SrcSpan -> TypeSpec a -> AList ImpElement a -> ImpList a [impListAnno] :: ImpList a -> a [impListSpan] :: ImpList a -> SrcSpan [impListType] :: ImpList a -> TypeSpec a [impListElements] :: ImpList a -> AList ImpElement a data ImpElement a ImpElement :: a -> SrcSpan -> Char -> Maybe Char -> ImpElement a [impElementAnno] :: ImpElement a -> a [impElementSpan] :: ImpElement a -> SrcSpan [impElementFrom] :: ImpElement a -> Char [impElementTo] :: ImpElement a -> Maybe Char -- | A single COMMON block definition. -- -- The Declarators here shall not contain initializing -- expressions. data CommonGroup a CommonGroup :: a -> SrcSpan -> Maybe (Expression a) -> AList Declarator a -> CommonGroup a [commonGroupAnno] :: CommonGroup a -> a [commonGroupSpan] :: CommonGroup a -> SrcSpan [commonGroupName] :: CommonGroup a -> Maybe (Expression a) [commonGroupVars] :: CommonGroup a -> AList Declarator a data Namelist a Namelist :: a -> SrcSpan -> Expression a -> AList Expression a -> Namelist a [namelistAnno] :: Namelist a -> a [namelistSpan] :: Namelist a -> SrcSpan [namelistName] :: Namelist a -> Expression a [namelistVars] :: Namelist a -> AList Expression a -- | The part of a DATA statement describing a single set of -- initializations. -- -- The initializer list must be compatible with the name list. Generally, -- that means either the lengths must be equal, or the name list is the -- singleton list referring to an array, and the initializer list is -- compatible with that array's shape. data DataGroup a DataGroup :: a -> SrcSpan -> AList Expression a -> AList Expression a -> DataGroup a [dataGroupAnno] :: DataGroup a -> a [dataGroupSpan] :: DataGroup a -> SrcSpan [dataGroupNames] :: DataGroup a -> AList Expression a [dataGroupInitializers] :: DataGroup a -> AList Expression a -- | Field types in pre-Fortran 90 non-standard structurerecordunion -- extension. -- -- Structures were obsoleted by derived types in later standards. -- -- The outer structure is stored in StStructure. data StructureItem a -- | Regular field StructFields :: a -> SrcSpan -> TypeSpec a -> Maybe (AList Attribute a) -> AList Declarator a -> StructureItem a -- | Union field StructUnion :: a -> SrcSpan -> AList UnionMap a -> StructureItem a -- | Substructure (nestedinline recordstructure) StructStructure :: a -> SrcSpan -> Maybe String -> String -> AList StructureItem a -> StructureItem a data UnionMap a UnionMap :: a -> SrcSpan -> AList StructureItem a -> UnionMap a [unionMapAnno] :: UnionMap a -> a [unionMapSpan] :: UnionMap a -> SrcSpan [unionMapFields] :: UnionMap a -> AList StructureItem a data FormatItem a FIFormatList :: a -> SrcSpan -> Maybe String -> AList FormatItem a -> FormatItem a FIHollerith :: a -> SrcSpan -> Value a -> FormatItem a FIDelimiter :: a -> SrcSpan -> FormatItem a FIFieldDescriptorDEFG :: a -> SrcSpan -> Maybe Integer -> Char -> Integer -> Integer -> FormatItem a FIFieldDescriptorAIL :: a -> SrcSpan -> Maybe Integer -> Char -> Integer -> FormatItem a FIBlankDescriptor :: a -> SrcSpan -> Integer -> FormatItem a FIScaleFactor :: a -> SrcSpan -> Integer -> FormatItem a -- | Part of the newer (Fortran 2003?) FLUSH statement. -- -- See: -- https://www.ibm.com/docs/en/xl-fortran-aix/15.1.0?topic=attributes-flush-fortran-2003 data FlushSpec a -- | scalar integer expression FSUnit :: a -> SrcSpan -> Expression a -> FlushSpec a -- | scalar integer variable FSIOStat :: a -> SrcSpan -> Expression a -> FlushSpec a -- | scalar character variable FSIOMsg :: a -> SrcSpan -> Expression a -> FlushSpec a -- | statement label FSErr :: a -> SrcSpan -> Expression a -> FlushSpec a data DoSpecification a DoSpecification :: a -> SrcSpan -> Statement a -> Expression a -> Maybe (Expression a) -> DoSpecification a [doSpecAnno] :: DoSpecification a -> a [doSpecSpan] :: DoSpecification a -> SrcSpan -- | Guaranteed to be StExpressionAssign [doSpecInitial] :: DoSpecification a -> Statement a [doSpecLimit] :: DoSpecification a -> Expression a [doSpecIncrement] :: DoSpecification a -> Maybe (Expression a) data ProgramUnitName Named :: String -> ProgramUnitName NamelessBlockData :: ProgramUnitName NamelessComment :: ProgramUnitName NamelessMain :: ProgramUnitName -- | The empty annotation. type A0 = () class Annotated f getAnnotation :: Annotated f => f a -> a setAnnotation :: Annotated f => a -> f a -> f a modifyAnnotation :: Annotated f => (a -> a) -> f a -> f a getAnnotation :: (Annotated f, FirstParameter (f a) a) => f a -> a setAnnotation :: (Annotated f, FirstParameter (f a) a) => a -> f a -> f a class Labeled f getLabel :: Labeled f => f a -> Maybe (Expression a) getLastLabel :: Labeled f => f a -> Maybe (Expression a) setLabel :: Labeled f => f a -> Expression a -> f a class Named a getName :: Named a => a -> ProgramUnitName setName :: Named a => ProgramUnitName -> a -> a validPrefixSuffix :: PrefixSuffix a -> Bool emptyPrefixes :: Prefixes a emptySuffixes :: Suffixes a emptyPrefixSuffix :: PrefixSuffix a nonExecutableStatement :: FortranVersion -> Statement a -> Bool nonExecutableStatementBlock :: FortranVersion -> Block a -> Bool executableStatement :: FortranVersion -> Statement a -> Bool executableStatementBlock :: FortranVersion -> Block a -> Bool -- | Set a Declarator's initializing expression only if it has -- none already. setInitialisation :: Declarator a -> Expression a -> Declarator a pfSetFilename :: String -> ProgramFile a -> ProgramFile a pfGetFilename :: ProgramFile a -> String programUnitBody :: ProgramUnit a -> [Block a] updateProgramUnitBody :: ProgramUnit a -> [Block a] -> ProgramUnit a programUnitSubprograms :: ProgramUnit a -> Maybe [ProgramUnit a] -- | Non-empty (and non-strict) list type. data NonEmpty a (:|) :: a -> [a] -> NonEmpty a infixr 5 :| instance Data.Binary.Class.Binary Language.Fortran.AST.BaseType instance GHC.Generics.Generic Language.Fortran.AST.BaseType instance Data.Data.Data Language.Fortran.AST.BaseType instance GHC.Show.Show Language.Fortran.AST.BaseType instance GHC.Classes.Eq Language.Fortran.AST.BaseType instance GHC.Classes.Ord Language.Fortran.AST.BaseType instance GHC.Generics.Generic Language.Fortran.AST.MetaInfo instance Data.Data.Data Language.Fortran.AST.MetaInfo instance GHC.Show.Show Language.Fortran.AST.MetaInfo instance GHC.Classes.Ord Language.Fortran.AST.MetaInfo instance GHC.Classes.Eq Language.Fortran.AST.MetaInfo instance GHC.Base.Functor Language.Fortran.AST.Prefix instance GHC.Generics.Generic (Language.Fortran.AST.Prefix a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Prefix a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Prefix a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Prefix a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Prefix a) instance GHC.Base.Functor Language.Fortran.AST.Comment instance forall k (a :: k). GHC.Generics.Generic (Language.Fortran.AST.Comment a) instance forall k (a :: k). (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable k) => Data.Data.Data (Language.Fortran.AST.Comment a) instance forall k (a :: k). GHC.Show.Show (Language.Fortran.AST.Comment a) instance forall k (a :: k). GHC.Classes.Ord (Language.Fortran.AST.Comment a) instance forall k (a :: k). GHC.Classes.Eq (Language.Fortran.AST.Comment a) instance GHC.Generics.Generic Language.Fortran.AST.Only instance Data.Data.Data Language.Fortran.AST.Only instance GHC.Show.Show Language.Fortran.AST.Only instance GHC.Classes.Ord Language.Fortran.AST.Only instance GHC.Classes.Eq Language.Fortran.AST.Only instance GHC.Generics.Generic Language.Fortran.AST.ModuleNature instance Data.Data.Data Language.Fortran.AST.ModuleNature instance GHC.Show.Show Language.Fortran.AST.ModuleNature instance GHC.Classes.Ord Language.Fortran.AST.ModuleNature instance GHC.Classes.Eq Language.Fortran.AST.ModuleNature instance GHC.Generics.Generic Language.Fortran.AST.Intent instance Data.Data.Data Language.Fortran.AST.Intent instance GHC.Show.Show Language.Fortran.AST.Intent instance GHC.Classes.Ord Language.Fortran.AST.Intent instance GHC.Classes.Eq Language.Fortran.AST.Intent instance GHC.Base.Functor Language.Fortran.AST.ImpElement instance GHC.Generics.Generic (Language.Fortran.AST.ImpElement a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ImpElement a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ImpElement a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ImpElement a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ImpElement a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Value a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Value a) instance GHC.Base.Functor Language.Fortran.AST.Value instance GHC.Generics.Generic (Language.Fortran.AST.Value a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Value a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Value a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Value a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Value a) instance GHC.Base.Functor Language.Fortran.AST.FormatItem instance GHC.Generics.Generic (Language.Fortran.AST.FormatItem a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.FormatItem a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.FormatItem a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.FormatItem a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.FormatItem a) instance GHC.Generics.Generic Language.Fortran.AST.UnaryOp instance Data.Data.Data Language.Fortran.AST.UnaryOp instance GHC.Show.Show Language.Fortran.AST.UnaryOp instance GHC.Classes.Ord Language.Fortran.AST.UnaryOp instance GHC.Classes.Eq Language.Fortran.AST.UnaryOp instance GHC.Generics.Generic Language.Fortran.AST.BinaryOp instance Data.Data.Data Language.Fortran.AST.BinaryOp instance GHC.Show.Show Language.Fortran.AST.BinaryOp instance GHC.Classes.Ord Language.Fortran.AST.BinaryOp instance GHC.Classes.Eq Language.Fortran.AST.BinaryOp instance GHC.Base.Functor Language.Fortran.AST.ProgramUnit instance GHC.Generics.Generic (Language.Fortran.AST.ProgramUnit a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ProgramUnit a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ProgramUnit a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ProgramUnit a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ProgramUnit a) instance GHC.Base.Functor Language.Fortran.AST.Block instance GHC.Generics.Generic (Language.Fortran.AST.Block a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Block a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Block a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Block a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Block a) instance GHC.Base.Functor Language.Fortran.AST.ProcDecl instance GHC.Generics.Generic (Language.Fortran.AST.ProcDecl a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ProcDecl a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ProcDecl a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ProcDecl a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ProcDecl a) instance GHC.Base.Functor Language.Fortran.AST.ProcInterface instance GHC.Generics.Generic (Language.Fortran.AST.ProcInterface a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ProcInterface a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ProcInterface a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ProcInterface a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ProcInterface a) instance GHC.Base.Functor Language.Fortran.AST.ForallHeaderPart instance GHC.Generics.Generic (Language.Fortran.AST.ForallHeaderPart a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ForallHeaderPart a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ForallHeaderPart a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ForallHeaderPart a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ForallHeaderPart a) instance GHC.Base.Functor Language.Fortran.AST.ForallHeader instance GHC.Generics.Generic (Language.Fortran.AST.ForallHeader a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ForallHeader a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ForallHeader a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ForallHeader a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ForallHeader a) instance GHC.Base.Functor Language.Fortran.AST.Use instance GHC.Generics.Generic (Language.Fortran.AST.Use a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Use a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Use a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Use a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Use a) instance GHC.Base.Functor Language.Fortran.AST.ArgumentExpression instance GHC.Generics.Generic (Language.Fortran.AST.ArgumentExpression a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ArgumentExpression a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ArgumentExpression a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ArgumentExpression a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ArgumentExpression a) instance GHC.Base.Functor Language.Fortran.AST.Argument instance GHC.Generics.Generic (Language.Fortran.AST.Argument a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Argument a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Argument a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Argument a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Argument a) instance GHC.Base.Functor Language.Fortran.AST.ControlPair instance GHC.Generics.Generic (Language.Fortran.AST.ControlPair a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ControlPair a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ControlPair a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ControlPair a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ControlPair a) instance GHC.Base.Functor Language.Fortran.AST.AllocOpt instance GHC.Generics.Generic (Language.Fortran.AST.AllocOpt a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.AllocOpt a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.AllocOpt a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.AllocOpt a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.AllocOpt a) instance GHC.Base.Functor Language.Fortran.AST.ImpList instance GHC.Generics.Generic (Language.Fortran.AST.ImpList a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ImpList a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ImpList a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ImpList a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ImpList a) instance GHC.Base.Functor Language.Fortran.AST.CommonGroup instance GHC.Generics.Generic (Language.Fortran.AST.CommonGroup a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.CommonGroup a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.CommonGroup a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.CommonGroup a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.CommonGroup a) instance GHC.Base.Functor Language.Fortran.AST.Namelist instance GHC.Generics.Generic (Language.Fortran.AST.Namelist a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Namelist a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Namelist a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Namelist a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Namelist a) instance GHC.Base.Functor Language.Fortran.AST.DataGroup instance GHC.Generics.Generic (Language.Fortran.AST.DataGroup a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.DataGroup a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.DataGroup a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.DataGroup a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.DataGroup a) instance GHC.Base.Functor Language.Fortran.AST.Selector instance GHC.Generics.Generic (Language.Fortran.AST.Selector a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Selector a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Selector a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Selector a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Selector a) instance GHC.Base.Functor Language.Fortran.AST.TypeSpec instance GHC.Generics.Generic (Language.Fortran.AST.TypeSpec a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.TypeSpec a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.TypeSpec a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.TypeSpec a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.TypeSpec a) instance GHC.Base.Functor Language.Fortran.AST.Suffix instance GHC.Generics.Generic (Language.Fortran.AST.Suffix a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Suffix a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Suffix a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Suffix a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Suffix a) instance GHC.Base.Functor Language.Fortran.AST.Attribute instance GHC.Generics.Generic (Language.Fortran.AST.Attribute a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Attribute a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Attribute a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Attribute a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Attribute a) instance GHC.Base.Functor Language.Fortran.AST.UnionMap instance GHC.Generics.Generic (Language.Fortran.AST.UnionMap a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.UnionMap a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.UnionMap a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.UnionMap a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.UnionMap a) instance GHC.Base.Functor Language.Fortran.AST.StructureItem instance GHC.Generics.Generic (Language.Fortran.AST.StructureItem a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.StructureItem a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.StructureItem a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.StructureItem a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.StructureItem a) instance GHC.Base.Functor Language.Fortran.AST.FlushSpec instance GHC.Generics.Generic (Language.Fortran.AST.FlushSpec a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.FlushSpec a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.FlushSpec a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.FlushSpec a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.FlushSpec a) instance GHC.Base.Functor Language.Fortran.AST.DimensionDeclarator instance GHC.Generics.Generic (Language.Fortran.AST.DimensionDeclarator a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.DimensionDeclarator a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.DimensionDeclarator a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.DimensionDeclarator a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.DimensionDeclarator a) instance GHC.Base.Functor Language.Fortran.AST.DeclaratorType instance GHC.Generics.Generic (Language.Fortran.AST.DeclaratorType a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.DeclaratorType a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.DeclaratorType a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.DeclaratorType a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.DeclaratorType a) instance GHC.Base.Functor Language.Fortran.AST.Declarator instance GHC.Generics.Generic (Language.Fortran.AST.Declarator a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Declarator a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Declarator a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Declarator a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Declarator a) instance GHC.Base.Functor Language.Fortran.AST.Statement instance GHC.Generics.Generic (Language.Fortran.AST.Statement a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Statement a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Statement a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Statement a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Statement a) instance GHC.Base.Functor Language.Fortran.AST.DoSpecification instance GHC.Generics.Generic (Language.Fortran.AST.DoSpecification a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.DoSpecification a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.DoSpecification a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.DoSpecification a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.DoSpecification a) instance GHC.Base.Functor Language.Fortran.AST.Index instance GHC.Generics.Generic (Language.Fortran.AST.Index a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Index a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Index a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Index a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Index a) instance GHC.Base.Functor Language.Fortran.AST.Expression instance GHC.Generics.Generic (Language.Fortran.AST.Expression a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.Expression a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.Expression a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.Expression a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.Expression a) instance GHC.Base.Functor Language.Fortran.AST.ProgramFile instance GHC.Generics.Generic (Language.Fortran.AST.ProgramFile a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.AST.ProgramFile a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.AST.ProgramFile a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.AST.ProgramFile a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.AST.ProgramFile a) instance GHC.Generics.Generic Language.Fortran.AST.ProgramUnitName instance Data.Data.Data Language.Fortran.AST.ProgramUnitName instance GHC.Show.Show Language.Fortran.AST.ProgramUnitName instance GHC.Classes.Eq Language.Fortran.AST.ProgramUnitName instance GHC.Classes.Ord Language.Fortran.AST.ProgramUnitName instance Language.Fortran.AST.Named (Language.Fortran.AST.ProgramUnit a) instance Data.Binary.Class.Binary Language.Fortran.AST.ProgramUnitName instance Control.DeepSeq.NFData Language.Fortran.AST.ProgramUnitName instance Language.Fortran.AST.Labeled Language.Fortran.AST.Block instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ProgramFile a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ProgramFile a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ProgramFile a) instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ArgumentExpression instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ArgumentExpression a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ProgramUnit a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Suffix a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Block a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Statement a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Argument a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Use a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.TypeSpec a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ProcDecl a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ProcInterface a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Selector a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Attribute a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ImpList a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.CommonGroup a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.DataGroup a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.StructureItem a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.UnionMap a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Namelist a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Expression a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Index a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.DoSpecification a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.FlushSpec a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Declarator a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.DimensionDeclarator a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ControlPair a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.AllocOpt a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ForallHeader a) a instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ForallHeaderPart a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ProgramUnit a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Suffix a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Block a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Statement a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Argument a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Use a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.TypeSpec a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ProcDecl a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ProcInterface a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Selector a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Attribute a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ImpList a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.CommonGroup a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.DataGroup a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.StructureItem a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.UnionMap a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Namelist a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Expression a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Index a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.DoSpecification a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.FlushSpec a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Declarator a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.DimensionDeclarator a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ControlPair a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.AllocOpt a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ForallHeader a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ForallHeaderPart a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ProgramUnit instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Block instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Statement instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Argument instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Use instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.TypeSpec instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ProcDecl instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ProcInterface instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Selector instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Attribute instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ImpList instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.CommonGroup instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.DataGroup instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.StructureItem instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.UnionMap instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Namelist instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Expression instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Index instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.DoSpecification instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.FlushSpec instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.Declarator instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.DimensionDeclarator instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ControlPair instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.AllocOpt instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ForallHeader instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ForallHeaderPart instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ProgramUnit a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Suffix a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Statement a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Argument a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Use a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Attribute a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.TypeSpec a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ProcDecl a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ProcInterface a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Selector a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ImpList a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Block a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.CommonGroup a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.DataGroup a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.StructureItem a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.UnionMap a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Namelist a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Expression a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Index a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.DoSpecification a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.FlushSpec a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Declarator a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.DimensionDeclarator a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ControlPair a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.AllocOpt a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ForallHeader a) instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ForallHeaderPart a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ProgramUnit a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Suffix a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Statement a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ProcDecl a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ProcInterface a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Argument a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ArgumentExpression a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Use a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Attribute a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ImpList a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Block a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.CommonGroup a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.DataGroup a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.StructureItem a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.UnionMap a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Namelist a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Expression a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Index a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.DoSpecification a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.FlushSpec a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.TypeSpec a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Selector a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Declarator a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.DimensionDeclarator a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.DeclaratorType a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ControlPair a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.AllocOpt a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ForallHeader a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ForallHeaderPart a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ProgramUnit a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Block a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Expression a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.TypeSpec a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Index a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Statement a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ProcDecl a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ProcInterface a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.DoSpecification a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Selector a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ForallHeader a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ForallHeaderPart a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Argument a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ArgumentExpression a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Use a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Attribute a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.CommonGroup a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ControlPair a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.AllocOpt a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.DataGroup a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.DimensionDeclarator a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Declarator a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.DeclaratorType a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.FlushSpec a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ImpList a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Namelist a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Suffix a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.StructureItem a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.UnionMap a) instance Data.Binary.Class.Binary Language.Fortran.AST.BinaryOp instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.BinaryOp instance Control.DeepSeq.NFData Language.Fortran.AST.BinaryOp instance Data.Binary.Class.Binary Language.Fortran.AST.UnaryOp instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.UnaryOp instance Control.DeepSeq.NFData Language.Fortran.AST.UnaryOp instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.FormatItem a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.FormatItem a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.FormatItem instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.FormatItem a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.FormatItem a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.FormatItem a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.ImpElement a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.ImpElement a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.AST.ImpElement instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.ImpElement a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.ImpElement a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.ImpElement a) instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.Intent instance Control.DeepSeq.NFData Language.Fortran.AST.Intent instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.ModuleNature instance Control.DeepSeq.NFData Language.Fortran.AST.ModuleNature instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.Only instance Control.DeepSeq.NFData Language.Fortran.AST.Only instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Comment a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Comment a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.AST.Prefix a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.AST.Prefix a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.Util.Position.Spanned (Language.Fortran.AST.Prefix a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.AST.Prefix a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.AST.Prefix a) instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.MetaInfo instance Control.DeepSeq.NFData Language.Fortran.AST.MetaInfo instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.AST.BaseType instance Control.DeepSeq.NFData Language.Fortran.AST.BaseType instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (GHC.Base.NonEmpty a) -- | Common Fortran evaluation definitions. module Language.Fortran.Repr.Eval.Common -- | Monads which provide functionality to evaluate Fortran expressions in -- some static context. -- -- Actions in this monad may -- --
-- If the upper bound is less than the lower bound, the range is empty, the -- extent in that dimension is zero, and the array is of zero size. ---- -- Note that the Foldable instance does not provide -- "dimension-like" access to this type. That is, length (a :: -- Dims t a) will _not_ tell you how many dimensions -- a represents. Use dimsLength for that. data Dims t a -- | Explicit-shape array. All dimensions are known. DimsExplicitShape :: t (Dim a) -> Dims t a -- | Assumed-size array. The final dimension has no upper bound (it is -- obtained from its effective argument). Earlier dimensions may be -- defined like explicit-shape arrays. DimsAssumedSize :: Maybe (t (Dim a)) -> a -> Dims t a -- | Assumed-shape array. Shape is taken from effective argument. We store -- the lower bound for each dimension, and thus also the rank (via list -- length). DimsAssumedShape :: t a -> Dims t a prettyIntersperse :: Foldable t => Doc -> t Doc -> Doc prettyAfter :: Foldable t => Doc -> t Doc -> Doc -- | Traverse over the functor in a Dims value with a functor bound -- type. -- -- For example, to turn a Dims t (Maybe a) into a -- Maybe (Dims t a). dimsTraverse :: (Traversable t, Applicative f) => Dims t (f a) -> f (Dims t a) -- | How many dimensions does the given Dims represent? dimsLength :: Foldable t => Dims t a -> Int instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.Fortran.Common.Array.Dim a) instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Language.Fortran.Common.Array.Dim a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.Fortran.Common.Array.Dim a) instance Data.Traversable.Traversable Language.Fortran.Common.Array.Dim instance Data.Foldable.Foldable Language.Fortran.Common.Array.Dim instance GHC.Base.Functor Language.Fortran.Common.Array.Dim instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.Common.Array.Dim a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.Common.Array.Dim a) instance GHC.Generics.Generic (Language.Fortran.Common.Array.Dim a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.Common.Array.Dim a) instance Data.Traversable.Traversable t => Data.Traversable.Traversable (Language.Fortran.Common.Array.Dims t) instance Data.Foldable.Foldable t => Data.Foldable.Foldable (Language.Fortran.Common.Array.Dims t) instance GHC.Base.Functor t => GHC.Base.Functor (Language.Fortran.Common.Array.Dims t) instance GHC.Generics.Generic (Language.Fortran.Common.Array.Dims t a) instance (GHC.Show.Show a, GHC.Show.Show (t a), GHC.Show.Show (t (Language.Fortran.Common.Array.Dim a))) => GHC.Show.Show (Language.Fortran.Common.Array.Dims t a) instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData (t a), Control.DeepSeq.NFData (t (Language.Fortran.Common.Array.Dim a))) => Control.DeepSeq.NFData (Language.Fortran.Common.Array.Dims t a) instance (Data.Data.Data a, Data.Data.Data (t a), Data.Data.Data (t (Language.Fortran.Common.Array.Dim a)), Data.Typeable.Internal.Typeable t) => Data.Data.Data (Language.Fortran.Common.Array.Dims t a) instance (GHC.Classes.Eq a, GHC.Classes.Eq (t a), GHC.Classes.Eq (t (Language.Fortran.Common.Array.Dim a))) => GHC.Classes.Eq (Language.Fortran.Common.Array.Dims t a) instance (Data.Binary.Class.Binary a, Data.Binary.Class.Binary (t a), Data.Binary.Class.Binary (t (Language.Fortran.Common.Array.Dim a))) => Data.Binary.Class.Binary (Language.Fortran.Common.Array.Dims t a) instance (GHC.Classes.Ord a, GHC.Classes.Ord (t a), GHC.Classes.Ord (t (Language.Fortran.Common.Array.Dim a))) => GHC.Classes.Ord (Language.Fortran.Common.Array.Dims t a) instance (Data.Foldable.Foldable t, GHC.Base.Functor t, Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Common.Array.Dim a), Text.PrettyPrint.GenericPretty.Out a) => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Common.Array.Dims t a) instance Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Common.Array.Dims t a) => Language.Fortran.PrettyPrint.Pretty (Language.Fortran.Common.Array.Dims t a) instance Text.PrettyPrint.GenericPretty.Out a => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Common.Array.Dim a) instance Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Common.Array.Dim a) => Language.Fortran.PrettyPrint.Pretty (Language.Fortran.Common.Array.Dim a) -- | Utils for various parsers (beyond token level). -- -- We can sometimes work around there being free-form and fixed-form -- versions of the LexAction monad by requesting the underlying -- instances instances. We place such utilities that match that form -- here. module Language.Fortran.Parser.ParserUtils exprToComplexLitPart :: MonadFail m => Expression a -> m (ComplexPart a) -- | Helper for forming COMPLEX literals. complexLit :: MonadFail m => SrcSpan -> Expression A0 -> Expression A0 -> m (Expression A0) module Language.Fortran.Parser.Free.Fortran95 programParser :: LexAction (ProgramFile A0) functionParser :: LexAction (ProgramUnit A0) blockParser :: LexAction (Block A0) statementParser :: LexAction (Statement A0) expressionParser :: LexAction (Expression A0) includesParser :: LexAction [Block A0] module Language.Fortran.Parser.Free.Fortran90 programParser :: LexAction (ProgramFile A0) functionParser :: LexAction (ProgramUnit A0) blockParser :: LexAction (Block A0) statementParser :: LexAction (Statement A0) expressionParser :: LexAction (Expression A0) includesParser :: LexAction [Block A0] module Language.Fortran.Parser.Free.Fortran2003 programParser :: LexAction (ProgramFile A0) functionParser :: LexAction (ProgramUnit A0) blockParser :: LexAction (Block A0) statementParser :: LexAction (Statement A0) expressionParser :: LexAction (Expression A0) includesParser :: LexAction [Block A0] module Language.Fortran.Parser.Fixed.Utils -- | UNSAFE. Must be called with expected token types (see usage sites). -- Will cause a runtime exception if it doesn't form a valid REAL -- literal. makeRealLit :: Maybe Token -> Maybe Token -> Maybe Token -> Maybe (SrcSpan, String) -> Expression A0 parseError :: Token -> LexAction a convCmts :: [Block a] -> [ProgramUnit a] module Language.Fortran.Parser.Fixed.Fortran77 programParser :: LexAction (ProgramFile A0) blockParser :: LexAction (Block A0) statementParser :: LexAction (Statement A0) expressionParser :: LexAction (Expression A0) includesParser :: LexAction [Block A0] module Language.Fortran.Parser.Fixed.Fortran66 programParser :: LexAction (ProgramFile A0) blockParser :: LexAction (Block A0) statementParser :: LexAction (Statement A0) expressionParser :: LexAction (Expression A0) includesParser :: LexAction [Block A0] module Language.Fortran.LValue -- | A subset of Expression which can only contain values that can -- be assigned to. data LValue a LvSimpleVar :: a -> SrcSpan -> Name -> LValue a LvSubscript :: a -> SrcSpan -> LValue a -> AList Index a -> LValue a LvDataRef :: a -> SrcSpan -> LValue a -> LValue a -> LValue a -- | If the expression can be seen as an lvalue, convert it to an -- LValue. toLValue :: Expression a -> Maybe (LValue a) instance GHC.Base.Functor Language.Fortran.LValue.LValue instance GHC.Generics.Generic (Language.Fortran.LValue.LValue a) instance Data.Data.Data a => Data.Data.Data (Language.Fortran.LValue.LValue a) instance GHC.Show.Show a => GHC.Show.Show (Language.Fortran.LValue.LValue a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.Fortran.LValue.LValue a) instance Language.Fortran.Util.FirstParameter.FirstParameter (Language.Fortran.LValue.LValue a) a instance Language.Fortran.Util.SecondParameter.SecondParameter (Language.Fortran.LValue.LValue a) Language.Fortran.Util.Position.SrcSpan instance Language.Fortran.AST.Annotated.Annotated Language.Fortran.LValue.LValue instance Language.Fortran.Util.Position.Spanned (Language.Fortran.LValue.LValue a) module Language.Fortran.Analysis.SemanticTypes data CharacterLen -- | specified with a * CharLenStar :: CharacterLen -- | specified with a : (Fortran2003) FIXME, possibly, with a more robust -- const-exp: CharLenColon :: CharacterLen -- | specified with a non-trivial expression CharLenExp :: CharacterLen -- | specified with a constant integer CharLenInt :: Int -> CharacterLen -- | The main dimension type is a non-empty list of dimensions where each -- bound is Maybe Int. Nothing -- bounds indicate a dynamic bound (e.g. uses a dummy variable). type Dimensions = Dims NonEmpty (Maybe Int) -- | Semantic type assigned to variables. -- -- BaseType stores the "type tag" given in syntax. SemTypes -- add metadata (kind and length), and resolve some "simple" types to a -- core type with a preset kind (e.g. `DOUBLE PRECISION` -> -- `REAL(8)`). -- -- Fortran 90 (and beyond) features may not be well supported. data SemType TInteger :: Kind -> SemType TReal :: Kind -> SemType TComplex :: Kind -> SemType TLogical :: Kind -> SemType TByte :: Kind -> SemType TCharacter :: CharacterLen -> Kind -> SemType -- | A Fortran array type is represented by a type and a set of dimensions. TArray :: SemType -> Dimensions -> SemType -- | Constructor to use for F77 structures, F90 DDTs TCustom :: String -> SemType type Kind = Int -- | Convert Dimensions data type to its previous type synonym -- (Maybe [(Int, Int)]). -- -- Drops all information for array dimensions that aren't fully -- static/known. dimensionsToTuples :: Dimensions -> Maybe [(Int, Int)] charLenSelector :: Maybe (Selector a) -> (Maybe CharacterLen, Maybe String) charLenSelector' :: Expression a -> CharacterLen -- | Attempt to recover the Value that generated the given -- CharacterLen. charLenToValue :: CharacterLen -> Maybe (Value a) getTypeKind :: SemType -> Kind setTypeKind :: SemType -> Kind -> SemType charLenConcat :: CharacterLen -> CharacterLen -> CharacterLen -- | Recover the most appropriate TypeSpec for the given -- SemType, depending on the given FortranVersion. -- -- Kinds weren't formalized as a syntactic feature until Fortran 90, so -- we ask for a context. If possible (>=F90), we prefer the more -- explicit representation e.g. REAL(8). For older versions, for -- specific type-kind combinations, DOUBLE PRECISION and -- DOUBLE COMPLEX are used instead. However, we otherwise don't -- shy away from adding kind info regardless of theoretical version -- support. -- -- Array types don't work properly, due to array type info being in a -- parent node that holds individual elements. recoverSemTypeTypeSpec :: forall a. a -> SrcSpan -> FortranVersion -> SemType -> TypeSpec a -- | Given a BaseType infer the "default" kind (or size of the -- variable in memory). -- -- Useful when you need a default kind, but gives you an unwrapped type. -- Consider using Analysis.deriveSemTypeFromBaseType also. -- -- Further documentation: -- https://docs.oracle.com/cd/E19957-01/805-4939/c400041360f5/index.html kindOfBaseType :: BaseType -> Int getTypeSize :: SemType -> Maybe Int setTypeSize :: SemType -> Maybe Int -> SemType instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Analysis.SemanticTypes.CharacterLen instance Data.Binary.Class.Binary Language.Fortran.Analysis.SemanticTypes.CharacterLen instance Control.DeepSeq.NFData Language.Fortran.Analysis.SemanticTypes.CharacterLen instance GHC.Generics.Generic Language.Fortran.Analysis.SemanticTypes.CharacterLen instance Data.Data.Data Language.Fortran.Analysis.SemanticTypes.CharacterLen instance GHC.Show.Show Language.Fortran.Analysis.SemanticTypes.CharacterLen instance GHC.Classes.Eq Language.Fortran.Analysis.SemanticTypes.CharacterLen instance GHC.Classes.Ord Language.Fortran.Analysis.SemanticTypes.CharacterLen instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Analysis.SemanticTypes.SemType instance Data.Binary.Class.Binary Language.Fortran.Analysis.SemanticTypes.SemType instance Control.DeepSeq.NFData Language.Fortran.Analysis.SemanticTypes.SemType instance GHC.Generics.Generic Language.Fortran.Analysis.SemanticTypes.SemType instance Data.Data.Data Language.Fortran.Analysis.SemanticTypes.SemType instance GHC.Show.Show Language.Fortran.Analysis.SemanticTypes.SemType instance GHC.Classes.Eq Language.Fortran.Analysis.SemanticTypes.SemType instance GHC.Classes.Ord Language.Fortran.Analysis.SemanticTypes.SemType instance Language.Fortran.PrettyPrint.Pretty Language.Fortran.Analysis.SemanticTypes.SemType -- | Low-boilerplate Out instances for Showables using -- DerivingVia. -- -- Useful for integrating types that don't work nicely with -- Generic with GenericPretty. (Really, there should be -- a class like Out directly in pretty, but alas.) -- -- Use as follows: -- -- data EeGadts a where C1 :: EeGadts Bool C2 :: EeGadts String deriving -- stock instance Show (EeGadts a) deriving via OutShowly (EeGadts a) -- instance Out (EeGadts a) module Text.PrettyPrint.GenericPretty.ViaShow newtype OutShowly a OutShowly :: a -> OutShowly a [unOutShowly] :: OutShowly a -> a class Out a instance GHC.Show.Show a => Text.PrettyPrint.GenericPretty.Out (Text.PrettyPrint.GenericPretty.ViaShow.OutShowly a) module Text.PrettyPrint.GenericPretty.Orphans instance Text.PrettyPrint.GenericPretty.Out Data.Text.Internal.Text instance Text.PrettyPrint.GenericPretty.Out GHC.Int.Int8 instance Text.PrettyPrint.GenericPretty.Out GHC.Int.Int16 instance Text.PrettyPrint.GenericPretty.Out GHC.Int.Int32 instance Text.PrettyPrint.GenericPretty.Out GHC.Int.Int64 instance Text.PrettyPrint.GenericPretty.Out GHC.Num.Natural.Natural module Language.Fortran.Repr.Type.Scalar.String -- | The length of a CHARACTER value. -- -- IanH provides a great reference on StackOverflow: -- https://stackoverflow.com/a/25051522/2246637 data CharLen -- | CHARACTER(LEN=x) (where x is a constant integer -- expression). Value has the given static length. CharLen :: Natural -> CharLen -- | CHARACTER(LEN=*). F90. Value has assumed length. For a dummy -- argument, the length is assumed from the actual argument. For a -- PARAMETER named constant, the length is assumed from the length of the -- initializing expression. CharLenAssumed :: CharLen -- | CHARACTER(LEN=:). F2003. Value has deferred length. Must have -- the ALLOCATABLE or POINTER attribute. CharLenDeferred :: CharLen prettyCharLen :: Natural -> String instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Type.Scalar.String.CharLen instance Data.Binary.Class.Binary Language.Fortran.Repr.Type.Scalar.String.CharLen instance GHC.Classes.Ord Language.Fortran.Repr.Type.Scalar.String.CharLen instance GHC.Classes.Eq Language.Fortran.Repr.Type.Scalar.String.CharLen instance Data.Data.Data Language.Fortran.Repr.Type.Scalar.String.CharLen instance GHC.Generics.Generic Language.Fortran.Repr.Type.Scalar.String.CharLen instance GHC.Show.Show Language.Fortran.Repr.Type.Scalar.String.CharLen module Language.Fortran.Repr.Type.Scalar -- | A Fortran scalar type. data FScalarType FSTInt :: FTInt -> FScalarType FSTReal :: FTReal -> FScalarType FSTComplex :: FTReal -> FScalarType FSTLogical :: FTInt -> FScalarType FSTString :: Natural -> FScalarType -- | F77 structure, F90 DDT (non-intrinsic scalar) FSTCustom :: String -> FScalarType prettyScalarType :: FScalarType -> String fScalarTypeKind :: FScalarType -> Maybe FKindLit prettyKinded :: FKind a => a -> String -> String instance GHC.Classes.Ord Language.Fortran.Repr.Type.Scalar.FScalarType instance GHC.Classes.Eq Language.Fortran.Repr.Type.Scalar.FScalarType instance GHC.Show.Show Language.Fortran.Repr.Type.Scalar.FScalarType instance Data.Data.Data Language.Fortran.Repr.Type.Scalar.FScalarType instance GHC.Generics.Generic Language.Fortran.Repr.Type.Scalar.FScalarType module Language.Fortran.Repr.Type.Array -- | A Fortran array type. -- -- An array type is defined by a scalar type together with a shape. data FArrayType FArrayType :: FScalarType -> Shape -> FArrayType [fatScalar] :: FArrayType -> FScalarType [fatShape] :: FArrayType -> Shape -- | The shape of a Fortran array is a list of extents. (The rank of the -- array is length of the list.) -- -- Note that the F90 standard limits maximum array rank to 7 (R512). -- -- TODO * An empty list here feels nonsensical. Perhaps this should be -- NonEmpty. * List type is inefficient here, since we don't care about -- pushing/popping, and list length is important. Use a vector type -- instead. newtype Shape Shape :: [Natural] -> Shape [getShape] :: Shape -> [Natural] fatSize :: FArrayType -> Natural instance GHC.Classes.Ord Language.Fortran.Repr.Type.Array.Shape instance GHC.Classes.Eq Language.Fortran.Repr.Type.Array.Shape instance GHC.Show.Show Language.Fortran.Repr.Type.Array.Shape instance Data.Data.Data Language.Fortran.Repr.Type.Array.Shape instance GHC.Generics.Generic Language.Fortran.Repr.Type.Array.Shape instance GHC.Classes.Ord Language.Fortran.Repr.Type.Array.FArrayType instance GHC.Classes.Eq Language.Fortran.Repr.Type.Array.FArrayType instance GHC.Show.Show Language.Fortran.Repr.Type.Array.FArrayType instance Data.Data.Data Language.Fortran.Repr.Type.Array.FArrayType instance GHC.Generics.Generic Language.Fortran.Repr.Type.Array.FArrayType module Language.Fortran.Repr.Type -- | A Fortran type (scalar or array). data FType MkFScalarType :: FScalarType -> FType MkFArrayType :: FArrayType -> FType instance Data.Data.Data Language.Fortran.Repr.Type.FType instance GHC.Show.Show Language.Fortran.Repr.Type.FType instance GHC.Classes.Eq Language.Fortran.Repr.Type.FType instance GHC.Generics.Generic Language.Fortran.Repr.Type.FType -- | Evaluate AST terms to types in the type representation. module Language.Fortran.Repr.Eval.Type fromExpression :: forall m a. (MonadFEval m, EvalTo m ~ FType) => Expression a -> m (Either String FType) -- | Fortran CHAR value representation. -- -- Currently only CHARs of known length. module Language.Fortran.Repr.Value.Scalar.String data FString (l :: NaturalK) FString :: Text -> FString (l :: NaturalK) eqFString :: FString l -> FString r -> Bool -- | Attempt to a Text into an FString of the given length. fString :: forall l. KnownNat l => Text -> Maybe (FString l) fStringLen :: forall l. KnownNat l => FString l -> Natural data SomeFString SomeFString :: FString l -> SomeFString -- | Lift a Text into SomeFString. someFString :: Text -> SomeFString someFStringLen :: SomeFString -> Natural concatFString :: forall ll lr. (KnownNat ll, KnownNat lr) => FString ll -> FString lr -> FString (ll + lr) concatSomeFString :: SomeFString -> SomeFString -> SomeFString fStringBOp :: (Text -> Text -> r) -> FString ll -> FString lr -> r someFStringBOp :: (Text -> Text -> r) -> SomeFString -> SomeFString -> r instance GHC.Show.Show (Language.Fortran.Repr.Value.Scalar.String.FString l) instance GHC.Classes.Eq (Language.Fortran.Repr.Value.Scalar.String.FString l) instance GHC.Classes.Ord (Language.Fortran.Repr.Value.Scalar.String.FString l) instance GHC.TypeNats.KnownNat l => Data.Data.Data (Language.Fortran.Repr.Value.Scalar.String.FString l) instance GHC.Show.Show Language.Fortran.Repr.Value.Scalar.String.SomeFString instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Value.Scalar.String.SomeFString instance GHC.TypeNats.KnownNat l => Data.Binary.Class.Binary (Language.Fortran.Repr.Value.Scalar.String.FString l) instance GHC.Classes.Eq Language.Fortran.Repr.Value.Scalar.String.SomeFString instance Data.Data.Data Language.Fortran.Repr.Value.Scalar.String.SomeFString instance Data.Binary.Class.Binary Language.Fortran.Repr.Value.Scalar.String.SomeFString -- | Common definitions for Fortran scalar representations. module Language.Fortran.Repr.Value.Scalar.Common -- | Convenience wrapper which multiple Fortran tag-kinded intrinsic types -- fit. -- -- A type ft takes some type fk of kind k, and -- we are permitted to move the type between the term and type levels -- using the included singleton instances. -- -- For example, integers are kinded with type level FTInts. So -- we can define an integer with an existential ("unknown") kind with the -- type SomeFKinded FTInt FInt. By pattern matching on -- it, we recover the hidden kind tag (as well as obtaining the value). -- -- Note that many type classes usually derived generically (e.g. -- Binary) instances should be manually derived on this wrapper -- type. TODO give a better explanation why? data SomeFKinded k ft [SomeFKinded] :: forall {k} ft (fk :: k). (SingKind k, SingI fk, Data (ft fk)) => ft fk -> SomeFKinded k ft -- | Recover some TYPE(x)'s kind (the x). someFKindedKind :: SomeFKinded k ft -> Demote k -- | A kinded Fortran value. class FKinded a where { -- | The Haskell type used to record this Fortran type's kind. type FKindedT a; -- | For every Fortran kind of this Fortran type a, the underlying -- representation b has the given constraints. type FKindedC a b :: Constraint; } -- | Obtain the kind of a Fortran value. fKind :: FKinded a => a -> FKindedT a instance forall k (ft :: k -> *). (Data.Singletons.SingKind k, forall (fk :: k). Data.Singletons.SingI fk, forall (fk :: k). Data.Data.Data (ft fk), Data.Typeable.Internal.Typeable ft, Data.Typeable.Internal.Typeable k) => Data.Data.Data (Language.Fortran.Repr.Value.Scalar.Common.SomeFKinded k ft) instance forall k1 (ft :: k1 -> *) k2. (forall (fk :: k1). GHC.Show.Show (ft fk)) => GHC.Show.Show (Language.Fortran.Repr.Value.Scalar.Common.SomeFKinded k2 ft) instance forall k1 k2 (ft :: k2 -> *). (forall (fk :: k2). GHC.Show.Show (ft fk)) => Text.PrettyPrint.GenericPretty.Out (Language.Fortran.Repr.Value.Scalar.Common.SomeFKinded k1 ft) instance forall k (ft :: k -> *). (Data.Binary.Class.Binary (Data.Singletons.Demote k), Data.Singletons.SingKind k, forall (fk :: k). Data.Singletons.SingI fk => Data.Binary.Class.Binary (ft fk), forall (fk :: k). Data.Data.Data (ft fk)) => Data.Binary.Class.Binary (Language.Fortran.Repr.Value.Scalar.Common.SomeFKinded k ft) module Language.Fortran.Repr.Value.Scalar.Real data FReal -- |
-- REAL(4) --FReal4 :: Float -> FReal -- |
-- REAL(8) --FReal8 :: Double -> FReal fRealUOp' :: (Float -> r) -> (Double -> r) -> FReal -> r fRealBOp' :: (Float -> Float -> r) -> (Double -> Double -> r) -> FReal -> FReal -> r fRealUOpInplace' :: (Float -> Float) -> (Double -> Double) -> FReal -> FReal fRealBOpInplace' :: (Float -> Float -> Float) -> (Double -> Double -> Double) -> FReal -> FReal -> FReal fRealUOp :: (forall a. FKindedC FReal a => a -> r) -> FReal -> r fRealUOpInplace :: (forall a. FKindedC FReal a => a -> a) -> FReal -> FReal fRealBOp :: (forall a. FKindedC FReal a => a -> a -> r) -> FReal -> FReal -> r fRealBOpInplace :: (forall a. FKindedC FReal a => a -> a -> a) -> FReal -> FReal -> FReal instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Value.Scalar.Real.FReal instance Data.Binary.Class.Binary Language.Fortran.Repr.Value.Scalar.Real.FReal instance Data.Data.Data Language.Fortran.Repr.Value.Scalar.Real.FReal instance GHC.Generics.Generic Language.Fortran.Repr.Value.Scalar.Real.FReal instance GHC.Show.Show Language.Fortran.Repr.Value.Scalar.Real.FReal instance Language.Fortran.Repr.Value.Scalar.Common.FKinded Language.Fortran.Repr.Value.Scalar.Real.FReal instance GHC.Classes.Eq Language.Fortran.Repr.Value.Scalar.Real.FReal -- | Machine Fortran INTEGER values. -- -- This module stores Fortran INTEGER values in a matching Haskell -- machine integer type. For example, an INT(4) would be stored -- in an Int32. This way, we get both efficient operations and -- common overflow behaviour (which hopefully matches most Fortran -- compilers), and explicitly encode kinding semantics via promoting -- integral types. module Language.Fortran.Repr.Value.Scalar.Int.Machine -- | A Fortran integer value, type INTEGER(k). data FInt -- |
-- INTEGER(1) --FInt1 :: Int8 -> FInt -- |
-- INTEGER(2) --FInt2 :: Int16 -> FInt -- |
-- INTEGER(4) --FInt4 :: Int32 -> FInt -- |
-- INTEGER(8) --FInt8 :: Int64 -> FInt withFInt :: Num a => FInt -> a fIntUOp' :: (Int8 -> r) -> (Int16 -> r) -> (Int32 -> r) -> (Int64 -> r) -> FInt -> r fIntBOp' :: (Int8 -> Int8 -> r) -> (Int16 -> Int16 -> r) -> (Int32 -> Int32 -> r) -> (Int64 -> Int64 -> r) -> FInt -> FInt -> r fIntUOpInplace' :: (Int8 -> Int8) -> (Int16 -> Int16) -> (Int32 -> Int32) -> (Int64 -> Int64) -> FInt -> FInt fIntBOpInplace' :: (Int8 -> Int8 -> Int8) -> (Int16 -> Int16 -> Int16) -> (Int32 -> Int32 -> Int32) -> (Int64 -> Int64 -> Int64) -> FInt -> FInt -> FInt fIntUOp :: (forall a. FKindedC FInt a => a -> r) -> FInt -> r fIntUOpInplace :: (forall a. FKindedC FInt a => a -> a) -> FInt -> FInt fIntBOp :: (forall a. FKindedC FInt a => a -> a -> r) -> FInt -> FInt -> r fIntBOpInplace :: (forall a. FKindedC FInt a => a -> a -> a) -> FInt -> FInt -> FInt instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt instance Data.Binary.Class.Binary Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt instance Data.Data.Data Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt instance GHC.Generics.Generic Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt instance GHC.Show.Show Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt instance Language.Fortran.Repr.Value.Scalar.Common.FKinded Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt instance GHC.Classes.Eq Language.Fortran.Repr.Value.Scalar.Int.Machine.FInt -- | Machine Fortran LOGICAL values. -- -- Fortran compilers usually store LOGICALs as INTEGERs (they former is -- tied to the latter in the specifications). To more accurately simulate -- their behaviour, we represent them directly as integers, and simply -- provide a handful of definitions for using them as booleans. module Language.Fortran.Repr.Value.Scalar.Logical.Machine -- | Retrieve the boolean value stored by a LOGICAL(x). fLogicalToBool :: FInt -> Bool -- | Convert a bool to its Fortran machine representation in any numeric -- type. fLogicalNumericFromBool :: Num a => Bool -> a -- | Consume some Fortran logical stored using an integer. consumeFLogicalNumeric :: (Num a, Eq a) => r -> r -> a -> r fLogicalNot :: FInt -> FInt module Language.Fortran.Repr.Value.Scalar.Logical module Language.Fortran.Repr.Value.Scalar.Int -- | Fortran COMPLEX value representation. -- -- A Fortran COMPLEX is simply two REALs of the same kind. module Language.Fortran.Repr.Value.Scalar.Complex data FComplex -- |
-- COMPLEX(8) --FComplex8 :: Float -> Float -> FComplex -- |
-- COMPLEX(16) --FComplex16 :: Double -> Double -> FComplex fComplexFromReal :: FReal -> FComplex fComplexBOp' :: (Float -> Float -> a) -> (a -> a -> r) -> (Double -> Double -> b) -> (b -> b -> r) -> FComplex -> FComplex -> r fComplexBOpInplace' :: (Float -> Float -> Float) -> (Double -> Double -> Double) -> FComplex -> FComplex -> FComplex fComplexBOp :: (forall a. FKindedC FComplex a => a -> a -> b) -> (b -> b -> r) -> FComplex -> FComplex -> r fComplexBOpInplace :: (forall a. FKindedC FComplex a => a -> a -> a) -> FComplex -> FComplex -> FComplex instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Value.Scalar.Complex.FComplex instance Data.Binary.Class.Binary Language.Fortran.Repr.Value.Scalar.Complex.FComplex instance Data.Data.Data Language.Fortran.Repr.Value.Scalar.Complex.FComplex instance GHC.Generics.Generic Language.Fortran.Repr.Value.Scalar.Complex.FComplex instance GHC.Show.Show Language.Fortran.Repr.Value.Scalar.Complex.FComplex instance Language.Fortran.Repr.Value.Scalar.Common.FKinded Language.Fortran.Repr.Value.Scalar.Complex.FComplex instance GHC.Classes.Eq Language.Fortran.Repr.Value.Scalar.Complex.FComplex module Language.Fortran.Repr.Value.Scalar.Machine -- | A Fortran scalar value. data FScalarValue FSVInt :: FInt -> FScalarValue FSVReal :: FReal -> FScalarValue FSVComplex :: FComplex -> FScalarValue FSVLogical :: FInt -> FScalarValue FSVString :: Text -> FScalarValue -- | Recover a Fortran scalar value's type. fScalarValueType :: FScalarValue -> FScalarType instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Value.Scalar.Machine.FScalarValue instance Data.Binary.Class.Binary Language.Fortran.Repr.Value.Scalar.Machine.FScalarValue instance GHC.Classes.Eq Language.Fortran.Repr.Value.Scalar.Machine.FScalarValue instance Data.Data.Data Language.Fortran.Repr.Value.Scalar.Machine.FScalarValue instance GHC.Generics.Generic Language.Fortran.Repr.Value.Scalar.Machine.FScalarValue instance GHC.Show.Show Language.Fortran.Repr.Value.Scalar.Machine.FScalarValue -- | Fortran scalar value representation. -- -- For kinded Fortran types where different kinds use different -- representations, e.g. INTEGER, the general pattern is to export a -- rank-2 function each for unary and binary operations. They are -- restricted with a type class appropriate to the underlying values -- stored e.g. Integral, RealFloat. The function is then -- specialized depending on the value's representation - and thus kind, -- since the kind informs the representation. -- -- For more details, see the Machine module. module Language.Fortran.Repr.Value.Scalar module Language.Fortran.Repr.Value.Machine -- | A Fortran value (scalar only currently). data FValue MkFScalarValue :: FScalarValue -> FValue fValueType :: FValue -> FType fromConstInt :: FValue -> Maybe Integer fromConstReal :: FValue -> Maybe Double instance Text.PrettyPrint.GenericPretty.Out Language.Fortran.Repr.Value.Machine.FValue instance Data.Binary.Class.Binary Language.Fortran.Repr.Value.Machine.FValue instance GHC.Classes.Eq Language.Fortran.Repr.Value.Machine.FValue instance Data.Data.Data Language.Fortran.Repr.Value.Machine.FValue instance GHC.Generics.Generic Language.Fortran.Repr.Value.Machine.FValue instance GHC.Show.Show Language.Fortran.Repr.Value.Machine.FValue -- | Precise Fortran value model. -- -- Note that we actually think about two different models: one storing -- values "machine-like" (Machine), one storing them -- "mathematically idealized" (Idealized). Only certain Fortran -- types have these split representations, namely integers and logicals. -- The rest have a single representation each. -- -- Both representations may be convenient in different own ways: -- --
-- INT(a, 1) --evalIntrinsicInt1 :: MonadFEvalValue m => FValue -> m Int8 -- |
-- INT(a, 2) --evalIntrinsicInt2 :: MonadFEvalValue m => FValue -> m Int16 -- | INT(a, 4), INT(a) evalIntrinsicInt4 :: MonadFEvalValue m => FValue -> m Int32 -- |
-- INT(a, 8) --evalIntrinsicInt8 :: MonadFEvalValue m => FValue -> m Int64 evalIntrinsicIntXCoerce :: forall r m. (MonadFEvalValue m, Integral r) => (FInt -> r) -> FValue -> m r evalArg :: MonadFEvalValue m => Argument (Analysis a) -> m FValue forceScalar :: MonadFEvalValue m => FValue -> m FScalarValue forceUnconsArg :: MonadFEvalValue m => [a] -> m (a, [a]) forceArgs :: MonadFEvalValue m => Int -> [a] -> m [a] evalIntrinsicIor :: MonadFEvalValue m => FScalarValue -> FScalarValue -> m FValue evalIntrinsicMax :: MonadFEvalValue m => [FValue] -> m FValue -- | Evaluate a constant expression (F2018 10.1.12). evalConstExpr :: MonadFEvalValue m => Expression (Analysis a) -> m FValue instance GHC.Classes.Eq Language.Fortran.Repr.Eval.Value.Error instance GHC.Show.Show Language.Fortran.Repr.Eval.Value.Error instance GHC.Generics.Generic Language.Fortran.Repr.Eval.Value.Error instance Control.Monad.Error.Class.MonadError Language.Fortran.Repr.Eval.Value.Error Language.Fortran.Repr.Eval.Value.FEvalValuePure instance Control.Monad.Writer.Class.MonadWriter [GHC.Base.String] Language.Fortran.Repr.Eval.Value.FEvalValuePure instance Control.Monad.Reader.Class.MonadReader (Data.Map.Internal.Map Language.Fortran.AST.Common.Name Language.Fortran.Repr.Value.Machine.FValue) Language.Fortran.Repr.Eval.Value.FEvalValuePure instance GHC.Base.Monad Language.Fortran.Repr.Eval.Value.FEvalValuePure instance GHC.Base.Applicative Language.Fortran.Repr.Eval.Value.FEvalValuePure instance GHC.Base.Functor Language.Fortran.Repr.Eval.Value.FEvalValuePure instance Language.Fortran.Repr.Eval.Common.MonadFEval Language.Fortran.Repr.Eval.Value.FEvalValuePure module Language.Fortran.Analysis.Types -- | Annotate AST nodes with type information and also return a type -- environment mapping names to type information. analyseTypes :: Data a => ProgramFile (Analysis a) -> (ProgramFile (Analysis a), TypeEnv) -- | Annotate AST nodes with type information and also return a type -- environment mapping names to type information; provided with a -- starting type environment. analyseTypesWithEnv :: Data a => TypeEnv -> ProgramFile (Analysis a) -> (ProgramFile (Analysis a), TypeEnv) -- | Annotate AST nodes with type information, return a type environment -- mapping names to type information and return any type errors found; -- provided with a starting type environment. analyseAndCheckTypesWithEnv :: Data a => TypeEnv -> ProgramFile (Analysis a) -> (ProgramFile (Analysis a), TypeEnv, [TypeError]) extractTypeEnv :: forall a. Data a => ProgramFile (Analysis a) -> TypeEnv -- | Mapping of names to type information. type TypeEnv = Map Name IDType -- | Information about a detected type error. type TypeError = (String, SrcSpan) -- | Attempt to derive the SemType of a variable from the relevant -- parts of its surrounding StDeclaration. -- -- This is an example of a simple declaration: -- -- INTEGER(8) :: var_name -- -- A declaration holds a TypeSpec (left of the double colon; LHS) -- and a list of Declarators (right of the double colon; RHS). -- However, CHARACTER variable are allowed to specify their length via -- special syntax on the RHS: -- -- CHARACTER :: string*10 -- -- so to handle that, this function takes that length as a Maybe -- Expression (as provided in StDeclaration). -- -- If a length was defined on both sides, the declaration length (RHS) is -- used. This matches gfortran's behaviour, though even with -Wall they -- don't warn on this rather confusing syntax usage. We report a (soft) -- type error. deriveSemTypeFromDeclaration :: (MonadState InferState m, MonadReader InferConfig m) => SrcSpan -> SrcSpan -> TypeSpec a -> Maybe (Expression a) -> m SemType -- | Attempt to derive a SemType from a TypeSpec. deriveSemTypeFromTypeSpec :: MonadState InferState m => TypeSpec a -> m SemType -- | Derive SemType directly from BaseType, using relevant -- default kinds. deriveSemTypeFromBaseType :: BaseType -> SemType runInfer :: FortranVersion -> TypeEnv -> Infer a -> (a, InferState) inferState0 :: FortranVersion -> InferState instance GHC.Show.Show Language.Fortran.Analysis.Types.InferState instance GHC.Show.Show Language.Fortran.Analysis.Types.InferConfig instance GHC.Classes.Eq Language.Fortran.Analysis.Types.InferConfig -- | Analyse variables/function names and produce unique names that can be -- used to replace the original names while maintaining program -- equivalence (a.k.a. alpha-conversion). The advantage of the unique -- names is that scoping issues can be ignored when doing further -- analysis. module Language.Fortran.Analysis.Renaming -- | Annotate unique names for variable and function declarations and uses. analyseRenames :: Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a) -- | Annotate unique names for variable and function declarations and uses. -- With external module map. analyseRenamesWithModuleMap :: Data a => ModuleMap -> ProgramFile (Analysis a) -> ProgramFile (Analysis a) -- | Take the unique name annotations and substitute them into the actual -- AST. rename :: Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a) -- | Take a renamed program and undo the renames. unrename :: Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a) type ModuleMap = Map ProgramUnitName ModEnv instance GHC.Classes.Eq Language.Fortran.Analysis.Renaming.RenameState instance GHC.Show.Show Language.Fortran.Analysis.Renaming.RenameState module Language.Fortran.Transformation.Monad getProgramFile :: Transform a (ProgramFile (Analysis a)) putProgramFile :: ProgramFile (Analysis a) -> Transform a () modifyProgramFile :: (ProgramFile (Analysis a) -> ProgramFile (Analysis a)) -> Transform a () runTransform :: Data a => TypeEnv -> ModuleMap -> Transform a () -> ProgramFile a -> ProgramFile a type Transform a = State (TransformationState a) -- | Note that labeled (nonblock) DO grouping must be done before block DO -- grouping. module Language.Fortran.Transformation.Grouping groupForall :: Data a => Transform a () groupDo :: Data a => Transform a () groupLabeledDo :: Data a => Transform a () module Language.Fortran.Transformation.Disambiguation.Intrinsic disambiguateIntrinsic :: Data a => Transform a () module Language.Fortran.Transformation.Disambiguation.Function disambiguateFunction :: Data a => Transform a () instance Language.Fortran.Transformation.Disambiguation.Function.Indexed Language.Fortran.AST.Argument instance Language.Fortran.Transformation.Disambiguation.Function.Indexed Language.Fortran.AST.Expression -- | Analyse a program file and create basic blocks. module Language.Fortran.Analysis.BBlocks -- | Insert basic block graphs into each program unit's analysis analyseBBlocks :: Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a) -- | Create a mapping of (non-module) program unit names to their -- associated bblock graph. genBBlockMap :: Data a => ProgramFile (Analysis a) -> BBlockMap (Analysis a) -- | Show a basic block graph in a somewhat decent way. showBBGr :: (Out a, Show a) => BBGr a -> String -- | Show a basic block graph without the clutter showAnalysedBBGr :: (Out a, Show a) => BBGr (Analysis a) -> String -- | Pick out and show the basic block graphs in the program file analysis. showBBlocks :: (Data a, Out a, Show a) => ProgramFile (Analysis a) -> String -- | Output a graph in the GraphViz DOT format bbgrToDOT :: BBGr a -> String -- | A mapping of program unit names to bblock graphs. type BBlockMap a = Map ProgramUnitName (BBGr a) type ASTBlockNode = Int type ASTExprNode = Int genSuperBBGr :: forall a. Data a => BBlockMap (Analysis a) -> SuperBBGr (Analysis a) data SuperBBGr a SuperBBGr :: BBGr a -> IntMap ProgramUnitName -> Map PUName SuperNode -> SuperBBGr a [superBBGrGraph] :: SuperBBGr a -> BBGr a [superBBGrClusters] :: SuperBBGr a -> IntMap ProgramUnitName [superBBGrEntries] :: SuperBBGr a -> Map PUName SuperNode -- | Show a basic block supergraph showSuperBBGr :: (Out a, Show a) => SuperBBGr (Analysis a) -> String -- | Output a supergraph in the GraphViz DOT format superBBGrToDOT :: SuperBBGr a -> String findLabeledBBlock :: String -> BBGr a -> Maybe Node -- | Some helper functions to output some pseudo-code for readability. showBlock :: Block a -> String -- | Dataflow analysis to be applied once basic block analysis is complete. module Language.Fortran.Analysis.DataFlow -- | Compute dominators of each bblock in the graph. Node A dominates node -- B when all paths from the start node of that program unit must pass -- through node A in order to reach node B. That will be represented as -- the relation (B, [A, ...]) in the DomMap. dominators :: BBGr a -> DomMap -- | Compute the immediate dominator of each bblock in the graph. The -- immediate dominator is, in a sense, the closest dominator of -- a node. Given nodes A and B, you can say that node A is immediately -- dominated by node B if there does not exist any node C such that: node -- A dominates node C and node C dominates node B. iDominators :: BBGr a -> IDomMap -- | DomMap : node -> dominators of node type DomMap = BBNodeMap BBNodeSet -- | IDomMap : node -> immediate dominator of node type IDomMap = BBNodeMap BBNode -- | The postordering of a graph outputs the label after traversal of -- children. postOrder :: OrderF a -- | Reversed postordering. revPostOrder :: OrderF a -- | The preordering of a graph outputs the label before traversal of -- children. preOrder :: OrderF a -- | Reversed preordering. revPreOrder :: OrderF a -- | An OrderF is a function from graph to a specific ordering of nodes. type OrderF a = BBGr a -> [Node] -- | Apply the iterative dataflow analysis method. Forces evaluation of -- intermediate data structures at each step. dataFlowSolver :: (NFData t, Ord t) => BBGr a -> (Node -> InOut t) -> OrderF a -> (OutF t -> InF t) -> (InF t -> OutF t) -> InOutMap t -- | InOut : (dataflow into the bblock, dataflow out of the bblock) type InOut t = (t, t) -- | InOutMap : node -> (dataflow into node, dataflow out of node) type InOutMap t = BBNodeMap (InOut t) -- | InF, a function that returns the in-dataflow for a given node type InF t = Node -> t -- | OutF, a function that returns the out-dataflow for a given node type OutF t = Node -> t -- | Dataflow analysis for live variables given basic block graph. -- Muchnick, p. 445: A variable is "live" at a particular program point -- if there is a path to the exit along which its value may be used -- before it is redefined. It is "dead" if there is no such path. liveVariableAnalysis :: Data a => BBGr (Analysis a) -> InOutMap (Set Name) -- | Reaching definitions dataflow analysis. Reaching definitions are the -- set of variable-defining AST-block labels that may reach a program -- point. Suppose AST-block with label A defines a variable named v. -- Label A may reach another program point labeled P if there is at least -- one program path from label A to label P that does not redefine -- variable v. reachingDefinitions :: Data a => DefMap -> BBGr (Analysis a) -> InOutMap ASTBlockNodeSet -- | use-def map: map AST-block labels of variable-using AST-blocks to the -- AST-blocks that define those variables. genUDMap :: Data a => BlockMap a -> DefMap -> BBGr (Analysis a) -> InOutMap ASTBlockNodeSet -> UDMap -- | def-use map: map AST-block labels of defining AST-blocks to the -- AST-blocks that may use the definition. genDUMap :: Data a => BlockMap a -> DefMap -> BBGr (Analysis a) -> InOutMap ASTBlockNodeSet -> DUMap -- | Invert the DUMap into a UDMap duMapToUdMap :: DUMap -> UDMap -- | UDMap : use -> { definition } type UDMap = ASTBlockNodeMap ASTBlockNodeSet -- | DUMap : definition -> { use } type DUMap = ASTBlockNodeMap ASTBlockNodeSet -- | "Flows-To" analysis. Represent def-use map as a graph. genFlowsToGraph :: Data a => BlockMap a -> DefMap -> BBGr (Analysis a) -> InOutMap ASTBlockNodeSet -> FlowsGraph a -- | FlowsGraph : nodes as AST-block (numbered by label), edges showing -- which definitions contribute to which uses. type FlowsGraph a = Gr (Block (Analysis a)) () -- | Create a map (A -> Bs) where A "flows" or contributes towards the -- variables Bs. genVarFlowsToMap :: Data a => DefMap -> FlowsGraph a -> VarFlowsMap -- | Represent "flows" between variables type VarFlowsMap = Map Name (Set Name) -- | The map of all parameter variables and their corresponding values type ParameterVarMap = Map Name FValue -- | The map of all expressions and whether they are undecided (not present -- in map), a constant value (Just), or probably not constant -- (Nothing). type ConstExpMap = ASTExprNodeMap (Maybe FValue) -- | Generate a constant-expression map with information about the -- expressions (identified by insLabel numbering) in the ProgramFile pf -- (must have analysis initiated & basic blocks generated) . genConstExpMap :: forall a. Data a => ProgramFile (Analysis a) -> ConstExpMap -- | Get constant-expression information and put it into the AST analysis -- annotation. Must occur after analyseBBlocks. analyseConstExps :: forall a. Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a) -- | Annotate AST with constant-expression information based on given -- ParameterVarMap. analyseParameterVars :: forall a. Data a => ParameterVarMap -> ProgramFile (Analysis a) -> ProgramFile (Analysis a) -- | Build a BlockMap from the AST. This can only be performed after -- analyseBasicBlocks has operated, created basic blocks, and labeled all -- of the AST-blocks with unique numbers. genBlockMap :: Data a => ProgramFile (Analysis a) -> BlockMap a -- | Build a DefMap from the BlockMap. This allows us to quickly look up -- the AST-block labels that wrote into the given variable. genDefMap :: Data a => BlockMap a -> DefMap -- | BlockMap : AST-block label -> AST-block Each AST-block has been -- given a unique number label during analysis of basic blocks. The -- purpose of this map is to provide the ability to lookup AST-blocks by -- label. type BlockMap a = ASTBlockNodeMap (Block (Analysis a)) -- | DefMap : variable name -> { AST-block label } type DefMap = Map Name ASTBlockNodeSet -- | Create a call map showing the structure of the program. genCallMap :: Data a => ProgramFile (Analysis a) -> CallMap -- | CallMap : program unit name -> { name of function or subroutine } type CallMap = Map ProgramUnitName (Set Name) -- | For each loop in the program, find out which bblock nodes are part of -- the loop by looking through the backedges (m, n) where n is considered -- the 'loop-header', delete n from the map, and then do a -- reverse-depth-first traversal starting from m to find all the nodes of -- interest. Intersect this with the strongly-connected component -- containing m, in case of improper graphs with weird control -- transfers. loopNodes :: Graph gr => BackEdgeMap -> gr a b -> [BBNodeSet] -- | Find the edges that 'loop back' in the graph; ones where the target -- node dominates the source node. If the backedges are viewed as (m -- -> n) then n is considered the 'loop-header' genBackEdgeMap :: Graph gr => DomMap -> gr a b -> BackEdgeMap -- | The strongly connected component containing a given node. sccWith :: Graph gr => Node -> gr a b -> [Node] -- | BackEdgeMap : bblock node -> bblock node type BackEdgeMap = BBNodeMap BBNode -- | Similar to loopNodes except it creates a map from loop-header to the -- set of loop nodes, for each loop-header. genLoopNodeMap :: Graph gr => BackEdgeMap -> gr a b -> LoopNodeMap -- | LoopNodeMap : bblock node -> { bblock node } type LoopNodeMap = BBNodeMap BBNodeSet -- | For each loop in the program, figure out the names of the induction -- variables: the variables that are used to represent the current -- iteration of the loop. genInductionVarMap :: Data a => BackEdgeMap -> BBGr (Analysis a) -> InductionVarMap -- | Map of loop header nodes to the induction variables within that loop. type InductionVarMap = BBNodeMap (Set Name) -- | Generate an induction variable map that is indexed by the labels on -- AST-blocks within those loops. genInductionVarMapByASTBlock :: forall a. Data a => BackEdgeMap -> BBGr (Analysis a) -> InductionVarMapByASTBlock -- | InductionVarMapByASTBlock : AST-block label -> { name } type InductionVarMapByASTBlock = ASTBlockNodeMap (Set Name) -- | For every expression in a loop, try to derive its relationship to a -- basic induction variable. genDerivedInductionMap :: forall a. Data a => BackEdgeMap -> BBGr (Analysis a) -> DerivedInductionMap type DerivedInductionMap = ASTExprNodeMap InductionExpr data InductionExpr IETop :: InductionExpr IELinear :: !Name -> !Int -> !Int -> InductionExpr IEBottom :: InductionExpr -- | Show some information about dataflow analyses. showDataFlow :: (Data a, Out a, Show a) => ProgramFile (Analysis a) -> String -- | Outputs a DOT-formatted graph showing flow-to data starting at the -- given AST-Block node in the given Basic Block graph. showFlowsDOT :: (Data a, Out a, Show a) => ProgramFile (Analysis a) -> BBGr (Analysis a) -> ASTBlockNode -> Bool -> String type BBNodeMap = IntMap type BBNodeSet = IntSet type ASTBlockNodeMap = IntMap type ASTBlockNodeSet = IntSet type ASTExprNodeMap = IntMap type ASTExprNodeSet = IntSet instance Data.Data.Data Language.Fortran.Analysis.DataFlow.InductionExpr instance GHC.Generics.Generic Language.Fortran.Analysis.DataFlow.InductionExpr instance GHC.Classes.Ord Language.Fortran.Analysis.DataFlow.InductionExpr instance GHC.Classes.Eq Language.Fortran.Analysis.DataFlow.InductionExpr instance GHC.Show.Show Language.Fortran.Analysis.DataFlow.InductionExpr instance Data.Data.Data Language.Fortran.Analysis.DataFlow.IEFlow instance GHC.Generics.Generic Language.Fortran.Analysis.DataFlow.IEFlow instance GHC.Classes.Ord Language.Fortran.Analysis.DataFlow.IEFlow instance GHC.Classes.Eq Language.Fortran.Analysis.DataFlow.IEFlow instance GHC.Show.Show Language.Fortran.Analysis.DataFlow.IEFlow instance Control.DeepSeq.NFData Language.Fortran.Analysis.DataFlow.IEFlow instance Control.DeepSeq.NFData Language.Fortran.Analysis.DataFlow.InductionExpr -- | Format of Camfort precompiled files with information about Fortran -- modules. The ModuleMap stores information important to the -- renamer. The other data is up to you. -- -- Note that the encoder and decoder work on lists of ModFile so that one -- fsmod-file may contain information about multiple Fortran files. -- -- One typical usage might look like: -- --
-- let modFile1 = genModFile programFile -- let modFile2 = alterModFileData (const (Just ...)) "mydata" modFile1 -- let bytes = encodeModFile [modFile2] -- ... -- case decodeModFile bytes of -- Left error -> print error -- Right modFile3:otherModuleFiles -> ... -- where -- moduleMap = combinedModuleMap (modFile3:otherModuleFiles) -- myData = lookupModFileData "mydata" modFile3 -- renamedPF = analyseRenamesWithModuleMap moduleMap programFile --module Language.Fortran.Util.ModFile -- | The data stored in the "mod files" data ModFile -- | A set of decoded mod files. type ModFiles = [ModFile] -- | Starting point. emptyModFile :: ModFile -- | Empty set of mod files. (future proof: may not always be a list) emptyModFiles :: ModFiles -- | Standard ending of fortran-src-format "mod files" modFileSuffix :: String -- | Looks up the raw "other data" that may be stored in a ModFile by -- applications that make use of fortran-src. lookupModFileData :: String -> ModFile -> Maybe ByteString -- | Get a list of the labels present in the "other data" of a ModFile. -- More of a meta-programming / debugging feature. getLabelsModFileData :: ModFile -> [String] -- | Allows modificationinsertiondeletion of "other data" that may -- be stored in a ModFile by applications that make use of fortran-src. -- See alter for more information about the interface of this -- function. alterModFileData :: (Maybe ByteString -> Maybe ByteString) -> String -> ModFile -> ModFile alterModFileDataF :: Functor f => (Maybe ByteString -> f (Maybe ByteString)) -> String -> ModFile -> f ModFile -- | Generate a fresh ModFile from the module map, declaration map and type -- analysis of a given analysed and renamed ProgramFile. genModFile :: forall a. Data a => ProgramFile (Analysis a) -> ModFile -- | Extracts the module map, declaration map and type analysis from an -- analysed and renamed ProgramFile, then inserts it into the ModFile. regenModFile :: forall a. Data a => ProgramFile (Analysis a) -> ModFile -> ModFile -- | Convert ModFiles to a strict ByteString for writing to file. encodeModFile :: [ModFile] -> ByteString -- | Convert a strict ByteString to ModFiles, if possible. Revert the -- String aliases according to the StringMap. decodeModFile :: ByteString -> Either String [ModFile] decodeModFiles :: [FilePath] -> IO [(FilePath, ModFile)] decodeModFiles' :: [FilePath] -> IO ModFiles -- | Get the associated Fortran filename that was used to compile the -- ModFile. moduleFilename :: ModFile -> String -- | A map of aliases => strings, in order to save space and share -- structure for repeated strings. type StringMap = Map String String -- | Extract a string map from the given data, leaving behind aliased -- values in place of strings in the returned version. extractStringMap :: Data a => a -> (a, StringMap) -- | Extract the combined string map of ModFiles. Mainly internal use. combinedStringMap :: ModFiles -> StringMap -- | Context of a declaration: the ProgramUnit where it was declared. data DeclContext DCMain :: DeclContext DCBlockData :: DeclContext DCModule :: ProgramUnitName -> DeclContext -- | (uniqName, srcName) DCFunction :: (ProgramUnitName, ProgramUnitName) -> DeclContext -- | (uniqName, srcName) DCSubroutine :: (ProgramUnitName, ProgramUnitName) -> DeclContext -- | Map of unique variable name to the unique name of the program unit -- where it was defined, and the corresponding SrcSpan. type DeclMap = Map Name (DeclContext, SrcSpan) -- | Extract map of declared variables with their associated program unit -- and source span. extractDeclMap :: forall a. Data a => ProgramFile (Analysis a) -> DeclMap -- | Extract the combined declaration map from a set of ModFiles. Useful -- for parsing a Fortran file in a large context of other modules. combinedDeclMap :: ModFiles -> DeclMap -- | Extract all module maps (name -> environment) by collecting all of -- the stored module maps within the PUModule annotation. extractModuleMap :: forall a. Data a => ProgramFile (Analysis a) -> ModuleMap -- | Extract the combined module map from a set of ModFiles. Useful for -- parsing a Fortran file in a large context of other modules. combinedModuleMap :: ModFiles -> ModuleMap -- | Inside the module map, remove all imported declarations so that we can -- properly localise declarations to the originator file. localisedModuleMap :: ModuleMap -> ModuleMap -- | Extract the combined module map from a set of ModFiles. Useful for -- parsing a Fortran file in a large context of other modules. combinedTypeEnv :: ModFiles -> TypeEnv -- | A map of variables => their constant expression if known type ParamVarMap = ParameterVarMap -- | Extract a map of variables assigned to constant values. extractParamVarMap :: forall a. Data a => ProgramFile (Analysis a) -> ParamVarMap -- | Extract the combined string map of ModFiles. Mainly internal use. combinedParamVarMap :: ModFiles -> ParamVarMap -- | Create a map that links all unique variable/function names in the -- ModFiles to their corresponding *originating* filename (i.e., where -- they are declared) genUniqNameToFilenameMap :: FilePath -> ModFiles -> Map Name String -- | Status of mod-file compared to Fortran file. data TimestampStatus NoSuchFile :: TimestampStatus CompileFile :: TimestampStatus ModFileExists :: FilePath -> TimestampStatus -- | Compare the source file timestamp to the fsmod file timestamp, if it -- exists. checkTimestamps :: FilePath -> IO TimestampStatus instance GHC.Generics.Generic Language.Fortran.Util.ModFile.DeclContext instance Data.Data.Data Language.Fortran.Util.ModFile.DeclContext instance GHC.Show.Show Language.Fortran.Util.ModFile.DeclContext instance GHC.Classes.Eq Language.Fortran.Util.ModFile.DeclContext instance GHC.Classes.Ord Language.Fortran.Util.ModFile.DeclContext instance GHC.Generics.Generic Language.Fortran.Util.ModFile.ModFile instance Data.Data.Data Language.Fortran.Util.ModFile.ModFile instance GHC.Show.Show Language.Fortran.Util.ModFile.ModFile instance GHC.Classes.Eq Language.Fortran.Util.ModFile.ModFile instance Data.Binary.Class.Binary Language.Fortran.Util.ModFile.ModFile instance Data.Binary.Class.Binary Language.Fortran.Util.ModFile.DeclContext -- | Common interface to various Fortran parsers. -- -- Each parser exports various Happy-generated functions. All export a -- top-level ProgramFile parser. Most also export intermediate -- parsers e.g. for Statements and Expressions. Fixed form -- and free form parsers use different lexing schemes. And, due to -- headaches with Fortran's syntax, we usually want to enforce some -- post-parse transformations. -- -- This module provides a common wrapper over all that functionality. -- Internal combinators are exposed to assist in manually configuring -- parsers. module Language.Fortran.Parser byVer :: FortranVersion -> Parser (ProgramFile A0) byVerWithMods :: ModFiles -> FortranVersion -> Parser (ProgramFile A0) f66 :: Parser (ProgramFile A0) f77 :: Parser (ProgramFile A0) f77e :: Parser (ProgramFile A0) f77l :: Parser (ProgramFile A0) f90 :: Parser (ProgramFile A0) f95 :: Parser (ProgramFile A0) f2003 :: Parser (ProgramFile A0) byVerNoTransform :: FortranVersion -> Parser (ProgramFile A0) f66NoTransform :: Parser (ProgramFile A0) f77NoTransform :: Parser (ProgramFile A0) f77eNoTransform :: Parser (ProgramFile A0) f77lNoTransform :: Parser (ProgramFile A0) f90NoTransform :: Parser (ProgramFile A0) f95NoTransform :: Parser (ProgramFile A0) f2003NoTransform :: Parser (ProgramFile A0) f90Expr :: Parser (Expression A0) f77lIncludesNoTransform :: Parser [Block A0] -- | Obtain a Fortran parser by assuming the version from the filename -- provided. byVerFromFilename :: Parser (ProgramFile A0) byVerStmt :: FortranVersion -> Parser (Statement A0) f66StmtNoTransform :: Parser (Statement A0) f77StmtNoTransform :: Parser (Statement A0) f77eStmtNoTransform :: Parser (Statement A0) f77lStmtNoTransform :: Parser (Statement A0) f90StmtNoTransform :: Parser (Statement A0) f95StmtNoTransform :: Parser (Statement A0) f2003StmtNoTransform :: Parser (Statement A0) byVerInclude :: FortranVersion -> Parser [Block A0] f66IncludesNoTransform :: Parser [Block A0] f77IncludesNoTransform :: Parser [Block A0] f77eIncludesNoTransform :: Parser [Block A0] f77lIncludesNoTransform :: Parser [Block A0] f90IncludesNoTransform :: Parser [Block A0] f95IncludesNoTransform :: Parser [Block A0] f2003IncludesNoTransform :: Parser [Block A0] transformAs :: Data a => FortranVersion -> Parser (ProgramFile a) -> ModFiles -> Parser (ProgramFile a) -- | The default post-parse AST transformation for each Fortran version. -- -- Formed by composing transformations end-to-end. -- -- Note that some transformations are noncommutative e.g. labeled DO -- grouping must be done before block DO grouping. defaultTransformation :: Data a => FortranVersion -> Transform a () -- | Our common Fortran parser type takes a filename and input, and returns -- either a normalized error (tokens are printed) or an untransformed -- ProgramFile. type Parser a = String -> ByteString -> Either ParseErrorSimple a data ParseErrorSimple ParseErrorSimple :: Position -> String -> String -> ParseErrorSimple [errorPos] :: ParseErrorSimple -> Position [errorFilename] :: ParseErrorSimple -> String [errorMsg] :: ParseErrorSimple -> String type StateInit s = String -> FortranVersion -> ByteString -> ParseState s type ParserMaker ai tok a = Parse ai tok a -> FortranVersion -> Parser a makeParser :: (Loc ai, LastToken ai tok, Show tok) => StateInit ai -> ParserMaker ai tok a makeParserFixed :: ParserMaker AlexInput Token a makeParserFree :: ParserMaker AlexInput Token a initParseStateFixed :: StateInit AlexInput initParseStateFree :: StateInit AlexInput initParseStateFixedExpr :: StateInit AlexInput -- | Initialize free-form parser state with the lexer configured for -- standalone expression parsing. -- -- The free-form lexer needs a non-default start code for lexing -- standaloe expressions. initParseStateFreeExpr :: StateInit AlexInput -- | Convenience wrapper to easily use a parser unsafely. -- -- This throws a catchable runtime IO exception, which is used in the -- tests. parseUnsafe :: Parser a -> ByteString -> a collectTokensSafe :: forall a b. (Loc b, Tok a, LastToken b a, Show a) => Parse b a a -> ParseState b -> Maybe [a] collectTokens :: forall a b. (Loc b, Tok a, LastToken b a, Show a) => Parse b a a -> ParseState b -> [a] -- | May be used to lift parse results into IO and force unwrap. throwIOLeft :: (Exception e, MonadIO m) => Either e a -> m a byVerInlineIncludes :: FortranVersion -> [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f66InlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f77InlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f77eInlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f77lInlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f90InlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f95InlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) f2003InlineIncludes :: [FilePath] -> ModFiles -> String -> ByteString -> IO (ProgramFile A0) instance GHC.Exception.Type.Exception Language.Fortran.Parser.ParseErrorSimple instance GHC.Show.Show Language.Fortran.Parser.ParseErrorSimple -- | Generate a module use-graph. module Language.Fortran.Analysis.ModGraph genModGraph :: Maybe FortranVersion -> [FilePath] -> Maybe String -> [FilePath] -> IO ModGraph data ModGraph ModGraph :: Map String (Node, Maybe ModOrigin) -> Gr String () -> Int -> ModGraph [mgModNodeMap] :: ModGraph -> Map String (Node, Maybe ModOrigin) [mgGraph] :: ModGraph -> Gr String () [mgNumNodes] :: ModGraph -> Int data ModOrigin MOFile :: FilePath -> ModOrigin MOFSMod :: FilePath -> ModOrigin modGraphToList :: ModGraph -> [String] modGraphToDOT :: ModGraph -> String takeNextMods :: ModGraph -> [(Node, Maybe ModOrigin)] delModNodes :: [Node] -> ModGraph -> ModGraph instance GHC.Show.Show Language.Fortran.Analysis.ModGraph.ModOrigin instance Data.Data.Data Language.Fortran.Analysis.ModGraph.ModOrigin instance GHC.Classes.Eq Language.Fortran.Analysis.ModGraph.ModOrigin instance Data.Data.Data Language.Fortran.Analysis.ModGraph.ModGraph instance GHC.Classes.Eq Language.Fortran.Analysis.ModGraph.ModGraph instance GHC.Classes.Ord Language.Fortran.Analysis.ModGraph.ModOrigin