AS_Annotation.der.hs revision f04a144ec0ad002400f820bd857352c2cc7c5e9d
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettModule : $Header$
e071fb22ea9923a2a4ff41184d80ca46b55ee932Till MossakowskiDescription : datastructures for annotations of (Het)CASL.
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettCopyright : (c) Klaus Luettich, Christian Maeder, and Uni Bremen 2002-2006
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettLicense : GPLv2 or higher, see LICENSE.txt
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettMaintainer : Christian.Maeder@dfki.de
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettStability : provisional
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettPortability : portable
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettDatastructures for annotations of (Het)CASL.
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett There is also a paramterized data type for an 'Annoted' 'item'.
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett See also chapter II.5 of the CASL Reference Manual.
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- DrIFT command
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{-! global: GetRange !-}
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- | start of an annote with its WORD or a comment
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata Annote_word = Annote_word String | Comment_start deriving (Show, Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- | line or group for 'Unparsed_anno'
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata Annote_text = Line_anno String | Group_anno [String]
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett deriving (Show, Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{- | formats to be displayed (may be extended in the future).
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettDrop 3 from the show result to get the string for parsing and printing -}
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata Display_format = DF_HTML | DF_LATEX | DF_RTF deriving (Show, Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- | swap the entries of a lookup table
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettswapTable :: [(a, b)] -> [(b, a)]
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettswapTable = map $ \ (a, b) -> (b, a)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- | drop the first 3 characters from the show result
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimbletttoTable :: (Show a) => [a] -> [(a, String)]
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimbletttoTable = map $ \ a -> (a, drop 3 $ show a)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- | a lookup table for the textual representation of display formats
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdisplay_format_table :: [(Display_format, String)]
2cf5a456da8bb3a2bbb695414d8304426e3bd277Andy Gimblettdisplay_format_table = toTable [ DF_HTML, DF_LATEX, DF_RTF ]
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{- | lookup the textual representation of a display format
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettin 'display_format_table' -}
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettlookupDisplayFormat :: Display_format -> String
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettlookupDisplayFormat df =
2cf5a456da8bb3a2bbb695414d8304426e3bd277Andy Gimblett fromMaybe (error "lookupDisplayFormat: unknown display format")
2cf5a456da8bb3a2bbb695414d8304426e3bd277Andy Gimblett $ lookup df display_format_table
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{- | precedence 'Lower' means less and 'BothDirections' means less and greater.
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett'Higher' means greater but this is syntactically not allowed in 'Prec_anno'.
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett'NoDirection' can also not be specified explicitly,
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettbut covers those ids that are not mentionend in precedences. -}
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata PrecRel = Higher | Lower | BothDirections | NoDirection
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett deriving (Show, Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- | either left or right associative
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata AssocEither = ALeft | ARight deriving (Show, Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{- | semantic (line) annotations without further information.
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettUse the same drop-3-trick as for the 'Display_format'. -}
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata Semantic_anno = SA_cons | SA_def | SA_implies | SA_mono | SA_implied
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | SA_mcons | SA_ccons
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett deriving (Show, Eq, Ord)