CSPM-Frontend-0.12.1.0: A CSP-M parser compatible with FDR-2.91

Copyright(c) Fontaine 2008 - 2011
LicenseBSD3
MaintainerFontaine@cs.uni-duesseldorf.de
Stabilityexperimental
PortabilityGHC-only
Safe HaskellNone
LanguageHaskell2010

Language.CSPM.Frontend

Description

Frontend contains some reexports from other modules

Synopsis

Documentation

parse :: SourceName -> [Token] -> Either ParseError ModuleFromParser Source #

The parse function parses a List of Token. It returns a ParseError or a Labled Module. The SourceName argument is currently not used.

parseFile :: FilePath -> IO ModuleFromParser Source #

Lex and parse a file and return a LModule, throw an exception in case of an error

benchmarkFrontend :: FilePath -> IO (ModuleFromParser, ModuleFromRenaming) Source #

Lex and parse File. | Return the module and print some timing infos

eitherToExc :: Exception a => Either a b -> IO b Source #

"eitherToExe" returns the Right part of Either or throws the Left part as an dynamic exception.

handleLexError :: (LexError -> IO a) -> IO a -> IO a Source #

Handle a dymanic exception of type LexError.

handleParseError :: (ParseError -> IO a) -> IO a -> IO a Source #

Handle a dymanic exception of type ParseError.

handleRenameError :: (RenameError -> IO a) -> IO a -> IO a Source #

Handle a dymanic exception of type RenameError.

data Token Source #

Instances

Eq Token Source # 

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #

Data Token Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Token -> c Token #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Token #

toConstr :: Token -> Constr #

dataTypeOf :: Token -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Token) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Token) #

gmapT :: (forall b. Data b => b -> b) -> Token -> Token #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Token -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Token -> r #

gmapQ :: (forall d. Data d => d -> u) -> Token -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Token -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Token -> m Token #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Token -> m Token #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Token -> m Token #

Ord Token Source # 

Methods

compare :: Token -> Token -> Ordering #

(<) :: Token -> Token -> Bool #

(<=) :: Token -> Token -> Bool #

(>) :: Token -> Token -> Bool #

(>=) :: Token -> Token -> Bool #

max :: Token -> Token -> Token #

min :: Token -> Token -> Token #

Show Token Source # 

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Generic Token Source # 

Associated Types

type Rep Token :: * -> * #

Methods

from :: Token -> Rep Token x #

to :: Rep Token x -> Token #

type Rep Token Source # 

lexInclude :: String -> IO (Either LexError [Token]) Source #

lex input-string and inport all includes files

lexPlain :: String -> Either LexError [Token] Source #

lex a String .

removeIgnoredToken :: [Token] -> [Token] Source #

Remove comments, whitespaces and unneeded newlines.

data Module a Source #

Instances

Eq (Module a) Source # 

Methods

(==) :: Module a -> Module a -> Bool #

(/=) :: Module a -> Module a -> Bool #

Data a => Data (Module a) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Module a -> c (Module a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Module a) #

toConstr :: Module a -> Constr #

dataTypeOf :: Module a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Module a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Module a)) #

gmapT :: (forall b. Data b => b -> b) -> Module a -> Module a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Module a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Module a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Module a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Module a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Module a -> m (Module a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Module a -> m (Module a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Module a -> m (Module a) #

Ord (Module a) Source # 

Methods

compare :: Module a -> Module a -> Ordering #

(<) :: Module a -> Module a -> Bool #

(<=) :: Module a -> Module a -> Bool #

(>) :: Module a -> Module a -> Bool #

(>=) :: Module a -> Module a -> Bool #

max :: Module a -> Module a -> Module a #

min :: Module a -> Module a -> Module a #

Show (Module a) Source # 

Methods

showsPrec :: Int -> Module a -> ShowS #

show :: Module a -> String #

showList :: [Module a] -> ShowS #

Generic (Module a) Source # 

Associated Types

type Rep (Module a) :: * -> * #

Methods

from :: Module a -> Rep (Module a) x #

to :: Rep (Module a) x -> Module a #

type Rep (Module a) Source # 

type ModuleFromRenaming = Module FromRenaming Source #

A module that has gone through renaming

data Labeled t Source #

Constructors

Labeled 

Fields

Instances

Eq t => Eq (Labeled t) Source # 

Methods

(==) :: Labeled t -> Labeled t -> Bool #

(/=) :: Labeled t -> Labeled t -> Bool #

Data t => Data (Labeled t) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Labeled t -> c (Labeled t) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Labeled t) #

toConstr :: Labeled t -> Constr #

dataTypeOf :: Labeled t -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Labeled t)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Labeled t)) #

gmapT :: (forall b. Data b => b -> b) -> Labeled t -> Labeled t #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Labeled t -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Labeled t -> r #

gmapQ :: (forall d. Data d => d -> u) -> Labeled t -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Labeled t -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Labeled t -> m (Labeled t) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Labeled t -> m (Labeled t) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Labeled t -> m (Labeled t) #

Ord t => Ord (Labeled t) Source # 

Methods

compare :: Labeled t -> Labeled t -> Ordering #

(<) :: Labeled t -> Labeled t -> Bool #

(<=) :: Labeled t -> Labeled t -> Bool #

(>) :: Labeled t -> Labeled t -> Bool #

(>=) :: Labeled t -> Labeled t -> Bool #

max :: Labeled t -> Labeled t -> Labeled t #

min :: Labeled t -> Labeled t -> Labeled t #

Show t => Show (Labeled t) Source # 

Methods

showsPrec :: Int -> Labeled t -> ShowS #

show :: Labeled t -> String #

showList :: [Labeled t] -> ShowS #

Generic (Labeled t) Source # 

Associated Types

type Rep (Labeled t) :: * -> * #

Methods

from :: Labeled t -> Rep (Labeled t) x #

to :: Rep (Labeled t) x -> Labeled t #

type Rep (Labeled t) Source # 
type Rep (Labeled t) = D1 (MetaData "Labeled" "Language.CSPM.AST" "CSPM-Frontend-0.12.1.0-2XObDhQeBFNG5DmoldftgD" False) (C1 (MetaCons "Labeled" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "nodeId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 NodeId)) ((:*:) (S1 (MetaSel (Just Symbol "srcLoc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SrcLoc)) (S1 (MetaSel (Just Symbol "unLabel") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 t)))))

data SrcLoc Source #

Instances

Eq SrcLoc Source # 

Methods

(==) :: SrcLoc -> SrcLoc -> Bool #

(/=) :: SrcLoc -> SrcLoc -> Bool #

Data SrcLoc Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc #

toConstr :: SrcLoc -> Constr #

dataTypeOf :: SrcLoc -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) #

gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r #

gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc #

Ord SrcLoc Source # 
Show SrcLoc Source # 
Generic SrcLoc Source # 

Associated Types

type Rep SrcLoc :: * -> * #

Methods

from :: SrcLoc -> Rep SrcLoc x #

to :: Rep SrcLoc x -> SrcLoc #

type Rep SrcLoc Source # 
type Rep SrcLoc = D1 (MetaData "SrcLoc" "Language.CSPM.SrcLoc" "CSPM-Frontend-0.12.1.0-2XObDhQeBFNG5DmoldftgD" False) ((:+:) ((:+:) (C1 (MetaCons "TokIdPos" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TokenId))) ((:+:) (C1 (MetaCons "TokIdSpan" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TokenId)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TokenId)))) (C1 (MetaCons "TokSpan" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Token)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Token)))))) ((:+:) (C1 (MetaCons "TokPos" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Token))) ((:+:) (C1 (MetaCons "NoLocation" PrefixI False) U1) (C1 (MetaCons "FixedLoc" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "fixedStartLine") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) ((:*:) (S1 (MetaSel (Just Symbol "fixedStartCol") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) (S1 (MetaSel (Just Symbol "fixedStartOffset") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "fixedLen") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) (S1 (MetaSel (Just Symbol "fixedEndLine") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int))) ((:*:) (S1 (MetaSel (Just Symbol "fixedEndCol") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) (S1 (MetaSel (Just Symbol "fixedEndOffset") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)))))))))

removeSourceLocations :: Data a => a -> a Source #

removeSourceLocations sets all locationsInfos to NoLocation

removeParens :: Data a => a -> a Source #

removeParens removes all occurences of of Parens, i.e. explicit parentheses from the AST

unUniqueIdent :: Data a => a -> a Source #

unUniqueIdent replaces the all UIdent with the Ident of the the new name, thus forgetting additional information like the bindingside, etc. Usefull to get a smaller AST.

computeFreeNames :: Data a => a -> FreeNames Source #

Compute the FreeNames of an Expression. This function does only work after renaming has been done. This implementation is inefficient.

setNodeIdsZero :: Data a => a -> a Source #

Set all NodeIds to zero.

frontendVersion :: Version Source #

The version of the CSPM-Frontend library