fortran-src-0.1.0.1: Parser and anlyses for Fortran standards 66, 77, 90.

Safe HaskellSafe
LanguageHaskell2010

Language.Fortran.ParserMonad

Documentation

data ParseState a Source #

Instances

Show a => Show (ParseState a) Source # 
(Loc b, LastToken b c, Show c) => MonadState (ParseState b) (Parse b c) Source # 

Methods

get :: Parse b c (ParseState b) #

put :: ParseState b -> Parse b c () #

state :: (ParseState b -> (a, ParseState b)) -> Parse b c a #

data ParseError a b Source #

Instances

Show b => Show (ParseError a b) Source # 

Methods

showsPrec :: Int -> ParseError a b -> ShowS #

show :: ParseError a b -> String #

showList :: [ParseError a b] -> ShowS #

(Typeable * a, Typeable * b, Show a, Show b) => Exception (ParseError a b) Source # 
(Loc b, LastToken b c, Show c) => MonadError (ParseError b c) (Parse b c) Source # 

Methods

throwError :: ParseError b c -> Parse b c a #

catchError :: Parse b c a -> (ParseError b c -> Parse b c a) -> Parse b c a #

data ParseResult b c a Source #

Constructors

ParseOk a (ParseState b) 
ParseFailed (ParseError b c) 

class LastToken a b | a -> b where Source #

Minimal complete definition

getLastToken

Methods

getLastToken :: Show b => a -> Maybe b Source #

data Parse b c a Source #

Constructors

Parse 

Fields

Instances

(Loc b, LastToken b c, Show c) => MonadState (ParseState b) (Parse b c) Source # 

Methods

get :: Parse b c (ParseState b) #

put :: ParseState b -> Parse b c () #

state :: (ParseState b -> (a, ParseState b)) -> Parse b c a #

(Loc b, LastToken b c, Show c) => Monad (Parse b c) Source # 

Methods

(>>=) :: Parse b c a -> (a -> Parse b c b) -> Parse b c b #

(>>) :: Parse b c a -> Parse b c b -> Parse b c b #

return :: a -> Parse b c a #

fail :: String -> Parse b c a #

(Loc b, LastToken b c, Show c) => Functor (Parse b c) Source # 

Methods

fmap :: (a -> b) -> Parse b c a -> Parse b c b #

(<$) :: a -> Parse b c b -> Parse b c a #

(Loc b, LastToken b c, Show c) => Applicative (Parse b c) Source # 

Methods

pure :: a -> Parse b c a #

(<*>) :: Parse b c (a -> b) -> Parse b c a -> Parse b c b #

(*>) :: Parse b c a -> Parse b c b -> Parse b c b #

(<*) :: Parse b c a -> Parse b c b -> Parse b c a #

(Loc b, LastToken b c, Show c) => MonadError (ParseError b c) (Parse b c) Source # 

Methods

throwError :: ParseError b c -> Parse b c a #

catchError :: Parse b c a -> (ParseError b c -> Parse b c a) -> Parse b c a #

putAlex :: (Loc a, LastToken a b, Show b) => a -> Parse a b () Source #

getAlex :: (Loc a, LastToken a b, Show b) => Parse a b a Source #

popContext :: (Loc a, LastToken a b, Show b) => Parse a b () Source #

pushContext :: (Loc a, LastToken a b, Show b) => Context -> Parse a b () Source #

resetPar :: (Loc a, LastToken a b, Show b) => Parse a b () Source #

incPar :: (Loc a, LastToken a b, Show b) => Parse a b () Source #

decPar :: (Loc a, LastToken a b, Show b) => Parse a b () Source #

runParse :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> (a, ParseState b) Source #

evalParse :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> a Source #

execParse :: (Loc b, LastToken b c, Show c) => Parse b c a -> ParseState b -> ParseState b Source #

class Tok a where Source #

Minimal complete definition

eofToken

Methods

eofToken :: a -> Bool Source #

Instances

collectTokens :: forall a b. (Loc b, Tok a, LastToken b a, Show a) => Parse b a a -> ParseState b -> [a] Source #

collectTokensSafe :: forall a b. (Loc b, Tok a, LastToken b a, Show a) => Parse b a a -> ParseState b -> Maybe [a] Source #