camfort-1.1.1: CamFort - Cambridge Fortran infrastructure
Safe HaskellNone
LanguageHaskell2010

Camfort.Helpers.Syntax

Description

This module provides a number of helper functions for working with Fortran syntax that are useful between different analyses and transformations.

Synopsis

Variable renaming helpers

caml :: [Char] -> [Char] Source #

Comparison and ordering

data AnnotationFree t Source #

AnnotationFree is a data type that wraps other types and denotes terms which should be compared for equality modulo their annotations and source location information

Constructors

AnnotationFree 

Fields

Instances

Instances details
Eq (AnnotationFree a) => Eq (AnnotationFree [a]) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

(Eq (AnnotationFree a), Eq (AnnotationFree b)) => Eq (AnnotationFree (a, b)) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

Methods

(==) :: AnnotationFree (a, b) -> AnnotationFree (a, b) -> Bool #

(/=) :: AnnotationFree (a, b) -> AnnotationFree (a, b) -> Bool #

Eq (AnnotationFree BaseType) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

Methods

(==) :: AnnotationFree BaseType -> AnnotationFree BaseType -> Bool #

(/=) :: AnnotationFree BaseType -> AnnotationFree BaseType -> Bool #

Eq a => Eq (AnnotationFree (Expression a)) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

Methods

(==) :: AnnotationFree (Expression a) -> AnnotationFree (Expression a) -> Bool #

(/=) :: AnnotationFree (Expression a) -> AnnotationFree (Expression a) -> Bool #

Eq (AnnotationFree ConstructType) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

Methods

(==) :: AnnotationFree ConstructType -> AnnotationFree ConstructType -> Bool #

(/=) :: AnnotationFree ConstructType -> AnnotationFree ConstructType -> Bool #

Eq (AnnotationFree SemType) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

Methods

(==) :: AnnotationFree SemType -> AnnotationFree SemType -> Bool #

(/=) :: AnnotationFree SemType -> AnnotationFree SemType -> Bool #

Show t => Show (AnnotationFree t) Source # 
Instance details

Defined in Camfort.Helpers.Syntax

af :: t -> AnnotationFree t Source #

short-hand constructor for AnnotationFree

Accessor functions for extracting various pieces of information

extractVariable :: Expression a -> Maybe Name Source #

Extracts a string of the (root) variable name from an expression, e.g., extractVariable "v" = Just v extractVariable "v(i)" = Just v

SrcSpan Helpers

afterAligned :: SrcSpan -> Position Source #

deleteLine :: SrcSpan -> SrcSpan Source #

dropLine :: SrcSpan -> SrcSpan Source #

linesCovered :: Position -> Position -> Int Source #

toCol0 :: Position -> Position Source #

Orphan instances

Semigroup Int Source # 
Instance details

Methods

(<>) :: Int -> Int -> Int #

sconcat :: NonEmpty Int -> Int #

stimes :: Integral b => b -> Int -> Int #

Monoid Int Source #

Set a default monoid instances for Int

Instance details

Methods

mempty :: Int #

mappend :: Int -> Int -> Int #

mconcat :: [Int] -> Int #