SymbItems.hs revision 9f93b2a8b552789cd939d599504d39732672dc84
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder{- |
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederModule : $Header$
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederDescription : syntactic csp-casl symbols
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederCopyright : (c) Christian Maeder, DFKI GmbH 2011
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederMaintainer : Christian.Maeder@dfki.de
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederStability : provisional
286f4deb69d3912337bb09dd7f81284d12912ce8Christian MaederPortability : portable
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-}
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maedermodule CspCASL.SymbItems where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport CspCASL.AS_CspCASL_Process
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport CspCASL.CspCASL_Keywords
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport CspCASL.Print_CspCASL
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport CASL.AS_Basic_CASL
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport CASL.ToDoc ()
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport Common.Doc
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport Common.DocUtils
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederimport Common.Id
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata SymbItems = SymbItems SymbKind [Symb] deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata SymbMapItems = SymbMapItems SymbKind [SymbMap] deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata SymbKind = CaslKind SYMB_KIND | ProcessKind | ChannelKind
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder deriving (Show, Eq, Ord)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata Symb = CspSymb Id (Maybe CspType)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder-- for channels with sorts we may re-use A_type that is ambiguous
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata CspType = CaslType TYPE | ProcType ProcProfile deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederdata SymbMap = SymbMap Symb (Maybe Symb) deriving (Show, Eq)
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederinstance Pretty SymbKind where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder pretty k = case k of
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder CaslKind c -> pretty c
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder ProcessKind -> keyword processS
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder ChannelKind -> keyword channelS
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederinstance Pretty CspType where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder pretty t = case t of
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder CaslType c -> colon <> pretty c
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder ProcType p -> printProcProfile p
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederinstance Pretty Symb where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder pretty (CspSymb i ms) = pretty i <+> pretty ms
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederinstance Pretty SymbMap where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder pretty (SymbMap s ms) = pretty s <+> case ms of
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder Nothing -> empty
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder Just t -> mapsto <+> pretty t
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederinstance Pretty SymbItems where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder pretty (SymbItems k syms) = pretty k <+> ppWithCommas syms
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maederinstance Pretty SymbMapItems where
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder pretty (SymbMapItems k syms) = pretty k <+> ppWithCommas syms
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder