259e677d54077052680efe571d6280897801962aChristian MaederDescription : conversions to and from old SML aterm format
d5fe06af711a6912ae028ebf873eada4ee8733f8Christian MaederCopyright : (c) Klaus Luettich and Uni Bremen 2002-2004
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuLicense : GPLv2 or higher, see LICENSE.txt
34bff097c14521b5e57ce37279a34256e1f78aa5Klaus LuettichMaintainer : Christian.Maeder@dfki.de
306763c67bb99228487345b32ab8c5c6cd41f23cChristian MaederStability : provisional
698573ebc6be4bd63c295a3704fd9459a0c6699cChristian MaederPortability : non-portable (imports Logic.Grothendieck)
f3a94a197960e548ecd6520bb768cb0d547457bbChristian MaederThis module exports functions, that can convert an sml-CATS ATerm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers into the Haskell abstract syntax tree. So it contains all the
698573ebc6be4bd63c295a3704fd9459a0c6699cChristian Maeder necessary instances of ATermConvertible and a heuristic function
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers that calculates the new lists of Pos out of Region tuples.
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers the templates for the instances are automatically derived by
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers DrIFT. But there were made many hand written changes.
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers - p_flag from pos-TERM is not considered jet!
3bcd9d942601d59dd55a6069d8b2d1c33d7ced0eChristian Maedermodule ATC.Sml_cats ( ATermConvertibleSML
3bcd9d942601d59dd55a6069d8b2d1c33d7ced0eChristian Maeder , from_sml_ATermString
3bcd9d942601d59dd55a6069d8b2d1c33d7ced0eChristian Maeder , read_sml_ATerm
c64d33a7fbeae730cbe65193fe3cc24e7aa1ddd6Christian Maederimport Data.List (isPrefixOf)
ad270004874ce1d0697fb30d7309f180553bb315Christian Maederimport qualified Data.Map as Map
ef9e8535c168d3f774d9e74368a2317a9eda5826Christian Maeder-- better recompilation checking without 'import ATerm.Lib'
ab53b2d1773ac020b0df4cc9edeb0debe12e7a09cmaederimport Common.IRI (IRI, parseIRICurie, iriPos)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers-- the following module provides the ability to parse the "unparsed-anno"
35db0960aa2e2a13652381c756fae5fb2b27213bChristian Maederimport Text.ParserCombinators.Parsec (parse)
bccea164bdfc2ddc3d1e20749bb5477a46eab3a6Christian Maederimport Common.AnnoParser (annotations, parseAnno)
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maederimport Common.Utils (trimRight)
1544471d4ce2b4a5d9622e975f17e4081140e596Christian Maeder-- | cats creates latin1 files
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersread_sml_ATerm :: FilePath -> IO LIB_DEFN
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederread_sml_ATerm fn = liftM from_sml_ATermString $ readEncFile Latin1 fn
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- --- Convertible class for sml -----------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersclass ATermConvertibleSML t where
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder from_sml_ShATerm :: ATermTable -> t
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATermList :: ATermTable -> [t]
c64d33a7fbeae730cbe65193fe3cc24e7aa1ddd6Christian Maeder -- default function ignores the annotation part
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder from_sml_ShATermList = from_sml_ATermList from_sml_ShATerm
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maederfrom_sml_ATermList :: (ATermTable -> t) -> ATermTable -> [t]
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maederfrom_sml_ATermList f at = case getATerm at of
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder ShAList ats _ -> map (f . flip getATermByIndex1 at) ats
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder aterm -> from_sml_ShATermError "[a]" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermString :: ATermConvertibleSML a => String -> a
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATermString = from_sml_ShATerm . readATerm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ShATermError :: String -> ShATerm -> a
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ShATermError t u =
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder error ("Cannot convert Sml-ShATerm to " ++ t ++ ": " ++ err)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where err = case u of
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ShAAppl s l _ -> "!ShAAppl " ++ s ++ "("
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ++ show (length l) ++ ")"
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAList _ _ -> "!ShAList"
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> "!ShAInt"
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers-- basic instances -----------------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Bool where
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATerm att = case at of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "true" [] _ -> True
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ShAAppl "false" [] _ -> False
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "Bool" at
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where at = getATerm att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers-- for Integer derive : ATermConvertibleSML hand written!
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Integer where
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATerm att = case getATerm att of
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ShAInt x _ -> x
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder at -> from_sml_ShATermError "Integer" at
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Int where
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATerm att = integer2Int $ from_sml_ShATerm att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Char where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att = case at of
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder (ShAAppl s [] _) -> str2Char s
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "Char" at
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where at = getATerm att
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATermList att = case at of
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers (ShAAppl s [] _) -> read s
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "String" at
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where at = getATerm att
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederinstance (Ord a, ATermConvertibleSML a, ATermConvertibleSML b)
c64d33a7fbeae730cbe65193fe3cc24e7aa1ddd6Christian Maeder => ATermConvertibleSML (Map.Map a b) where
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder from_sml_ShATerm att = Map.fromList $ from_sml_ShATerm att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML a => ATermConvertibleSML [a] where
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder from_sml_ShATerm = from_sml_ShATermList
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederinstance (ATermConvertibleSML a, ATermConvertibleSML b)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder => ATermConvertibleSML (a, b) where
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATerm att = case at of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [x, y] _) -> (x', y')
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where x' = from_sml_ShATerm (getATermByIndex1 x att)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder y' = from_sml_ShATerm (getATermByIndex1 y att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "(a,b)" at
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where at = getATerm att
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederinstance (ATermConvertibleSML a, ATermConvertibleSML b, ATermConvertibleSML c)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder => ATermConvertibleSML (a, b, c) where
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATerm att = case at of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [a, b, c] _) -> (a', b', c')
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where a' = from_sml_ShATerm (getATermByIndex1 a att)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder b' = from_sml_ShATerm (getATermByIndex1 b att)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder c' = from_sml_ShATerm (getATermByIndex1 c att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "(a,b,c)" at
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where at = getATerm att
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederinstance (ATermConvertibleSML a, ATermConvertibleSML b,
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ATermConvertibleSML c, ATermConvertibleSML d)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder => ATermConvertibleSML (a, b, c, d) where
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder from_sml_ShATerm att = case at of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [a, b, c, d] _) -> (a', b', c', d')
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where a' = from_sml_ShATerm (getATermByIndex1 a att)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder b' = from_sml_ShATerm (getATermByIndex1 b att)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder c' = from_sml_ShATerm (getATermByIndex1 c att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder d' = from_sml_ShATerm (getATermByIndex1 d att)
fea14169cb07365fe4d12fea734d7b761ea8b287Christian Maeder _ -> from_sml_ShATermError "(a,b,c)" at
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where at = getATerm att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- --- instances of Id.hs ------------------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Token where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "token" [ aa ] _) ->
fea14169cb07365fe4d12fea734d7b761ea8b287Christian Maeder mkSimpleId $ from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "place" [] _) -> mkSimpleId Common.Id.place
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "Token" aterm
fea14169cb07365fe4d12fea734d7b761ea8b287Christian Maeder where aterm = getATerm att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Id where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "compound-id" [ aa, ab ] _) -> -- TOKEN_OR_MIXFIX,[ID]
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ATermTokenTup (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski ac' = nullRange
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Id aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "simple-id" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ATermTokenTup (getATermByIndex1 aa att)
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski ac' = nullRange
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Id aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "Id" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aterm = getATerm att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermTokenTup :: ATermTable -> [Token]
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermTokenTup att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [tops, _, _] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder from_sml_ShATerm (getATermByIndex1 tops att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "Token" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where aterm = getATerm att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- --- instances of AS_Annotation.hs -------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML Annotation where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "comment-line" [ aa ] _) ->
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder aa' = trimRight $ from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unparsed_anno Comment_start (Line_anno aa') ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "comment" [ aa ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = lines (from_sml_ShATerm (getATermByIndex1 aa att))
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unparsed_anno Comment_start (Group_anno aa') ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unparsed-anno" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder parse_anno pos_l
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (from_sml_ShATerm (getATermByIndex1 aa att))
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "annote-line" [ aa, ab ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unparsed_anno (Annote_word aa') (Line_anno ab') ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "annote-group" [ aa, ab ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unparsed_anno (Annote_word aa') (Group_anno ab') ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "display-anno" [ aa, ab ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab' = parse_disp_anno aa' pos_l
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder (trimRight $ from_sml_ShATerm (getATermByIndex1 ab att))
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "string-anno" [ aa, ab ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in String_anno aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "list-anno" [ aa, ab, ac ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ac' = from_sml_ShATerm (getATermByIndex1 ac att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in List_anno aa' ab' ac' ad'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "number-anno" [ aa ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Number_anno aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "floating-anno" [ aa, ab ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Float_anno aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "prec-anno" [ aa, ab, ac ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ab' = from_sml_ShATerm (getATermByIndex1 ab att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers ac' = from_sml_ShATerm (getATermByIndex1 ac att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Prec_anno (if aa' then Lower else BothDirections)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "lassoc-anno" [ aa ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Assoc_anno ALeft aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "rassoc-anno" [ aa ] _) ->
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Assoc_anno ARight aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "label-anno" [ aa ] _) ->
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder aa' = lines $ showId
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder (from_sml_ShATerm $ getATermByIndex1 aa att) ""
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Label aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "implies" [] _) ->
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Semantic_anno SA_implies aa'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "definitional" [] _) ->
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Semantic_anno SA_def aa'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "conservative" [] _) ->
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Semantic_anno SA_cons aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "mono" [] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder Semantic_anno SA_mono pos_l
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "Annotation" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-ANNO" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder{- - Well the following instance has to tie together things, that don't
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder- belong to each other. Because I can't declare instances for
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder- certain "Annoted types" -}
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance (ATermConvertibleSML a) => ATermConvertibleSML (Annoted a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl con as _ -> case con of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder -- Basic Items (including sig_items)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder "pos-BASIC-ITEMS" ->
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder case from_sml_ATermAnnotedBasic_Items att of
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski (bi, las) -> Annoted bi nullRange las []
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder -- L_.* constuctors from SML
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder "" -> Annoted (from_sml_ShATerm (getATermByIndex1
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (toAnnoList (last as) att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> -- "No appropiate constructor for Annoted found"
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder emptyAnno (from_sml_ShATerm att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "Annoted a" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aterm = getATerm att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder{- -- functions to convert annoted stuff ---------------------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederall these functions are called by instance ATermConvertibleSML Annoted a -}
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermAnnotedBasic_Items :: ATermConvertibleSML a =>
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ATermTable -> (a, [Annotation])
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermAnnotedBasic_Items att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers if isSig_items then
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (from_sml_ShATerm att, [])
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder else (from_sml_ShATerm att, annoList)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder where isSig_items =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl _ as _ -> -- pos-BASIC-ITEMS
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm $ getATermByIndex1 (last as) att of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "sig-items" _ _) -> True
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "{SIG,BASIC}_items" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder annoList = case getATerm att of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl _ as _) -> getAnnoList (last as) att
fea14169cb07365fe4d12fea734d7b761ea8b287Christian Maeder _ -> error "Wrong ATerm structure: BASIC_ITEMS"
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder{- getAnnoList and toAnnoList are only working with an AIndex as first
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederargument is given. If getAnnoList is called every ShAAppl that starts _
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederwith "pos-" is crossed without consideration. toAnnoList just calls
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederthe [Annotation] conversion directly. -}
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix ReckersgetAnnoList :: Int -> ATermTable -> [Annotation]
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix ReckersgetAnnoList ai att = case at of
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ShAAppl c as _ | isPrefixOf "pos-" c ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getAnnoList (last as) att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ShAAppl _ as _ -> toAnnoList (last as) att
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder _ -> error "wrong storage or missed 'pos-' contructor"
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where at = getATerm (getATermByIndex1 ai att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix ReckerstoAnnoList :: Int -> ATermTable -> [Annotation]
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix ReckerstoAnnoList ai att = from_sml_ShATerm $ getATermByIndex1 ai att
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowskiparse_anno :: Range -> String -> Annotation
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maederparse_anno _pos_l inp =
bccea164bdfc2ddc3d1e20749bb5477a46eab3a6Christian Maeder case parse (skip >> annotations) "" inp of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder Right [x] -> x
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> error ("something strange happend to \"" ++
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder inp ++ "\" during ATerm Conversion")
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowskiparse_disp_anno :: Id -> Range -> String -> Annotation
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersparse_disp_anno i pos_l inp =
bccea164bdfc2ddc3d1e20749bb5477a46eab3a6Christian Maeder case parseAnno (Unparsed_anno (Annote_word "display")
9271474a25bfadbf6d91b82ec60f614fb0dff492Christian Maeder (Group_anno [inp']) pos_l) pos of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder Left err -> error $ "internal parse error at " ++ show err
9271474a25bfadbf6d91b82ec60f614fb0dff492Christian Maeder pos = case rangeToList pos_l of
9271474a25bfadbf6d91b82ec60f614fb0dff492Christian Maeder [] -> newPos "" 0 0
9271474a25bfadbf6d91b82ec60f614fb0dff492Christian Maeder inp' = showId i $ ' ' : s_inp
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder s_inp = case reverse inp of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder rin | "%)" `isPrefixOf` rin -> reverse $ drop 2 rin
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder | otherwise -> inp
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- --- instances of AS_Basic_CASL.hs -------------------------------------
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (BASIC_SPEC a b c) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "basic-spec" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "BASIC_SPEC" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-BASIC-SPEC" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (BASIC_ITEMS a b c) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sig-items" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Sig_items aa'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "free-datatype" [ aa, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Free_datatype NonEmptySorts aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sort-gen" [ aa, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Sort_gen aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "var-items" [ aa, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Var_items aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "local-var-axioms" [ aa, ab, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Local_var_axioms aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "axiom-items" [ aa, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Axiom_items aa' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "BASIC_ITEMS" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-BASIC-ITEMS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (SIG_ITEMS a b) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sort-items" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder hd : tl = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList as hd : tl
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Sort_items NonEmptySorts aa'' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "op-items" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder hd : tl = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList as hd : tl
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_items aa'' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pred-items" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder hd : tl = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList as hd : tl
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Pred_items aa'' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "datatype-items" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder hd : tl = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList as hd : tl
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Datatype_items NonEmptySorts aa'' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SIG_ITEMS" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SIG-ITEMS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (SORT_ITEM a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sort-decl" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Sort_decl aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "subsort-decl" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Subsort_decl aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "subsort-defn" [ aa, ab, ac, ad, ae ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ATermSIMPLE_ID (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ad' = from_sml_ShATerm (getATermByIndex1 ad att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = toAnnoList ae att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ad'' = addRAnnoList as ad'
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Subsort_defn aa' ab' ac' ad'' ae'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "iso-decl" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Iso_decl aa' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SORT_ITEM" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SORT-ITEM" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (OP_ITEM a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "op-decl" [ aa, ab, ac ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_decl aa' ab' ac' ad'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "op-defn" [ aa, ab, ac, ad ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = from_sml_ShATerm (getATermByIndex1 ad att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ac'' = addRAnnoList as ac'
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_defn aa' ab' ac'' ad'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "OP_ITEM" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-OP-ITEM" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML OP_TYPE where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "total-op-type" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (aa', ps) = from_sml_ATermSORTS (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ac' = insertPos ps pos_l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_type Total aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "partial-op-type" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (aa', ps) = from_sml_ATermSORTS (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ac' = insertPos ps pos_l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_type Partial aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "OP_TYPE" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-OP-TYPE" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for the SML-datatype SORTS -------------------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATermSORTS :: ATermTable -> ([SORT], Range)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermSORTS att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sorts" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (from_sml_ShATerm (getATermByIndex1 aa att), pos_l)
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski _ -> from_sml_ShATermError "([SORT],Range)" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SORTS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML OP_HEAD where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "total-op-head" [ aa, ab ] _) ->
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder aa' = from_sml_ATermList from_sml_ATermARG_DECL
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_head Total aa' (Just ab') ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "partial-op-head" [ aa, ab ] _) ->
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder aa' = from_sml_ATermList from_sml_ATermARG_DECL
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Op_head Partial aa' (Just ab') ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "OP_HEAD" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-OP-HEAD" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maederfrom_sml_ATermARG_DECL :: ATermTable -> VAR_DECL
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maederfrom_sml_ATermARG_DECL att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- (ShAAppl "arg-decl" [ ShAAppl "" [aa,ab] _ ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [aa, ab] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ATermVARs (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Var_decl aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "ARG_DECL" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers aterm = case getATerm att' of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ShAAppl "arg-decl" [i] _ ->
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder getATerm $ getATermByIndex1 i att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder x -> from_sml_ShATermError "arg-decl" x
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-ARG-DECL" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (OP_ATTR a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "associative" [] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in Assoc_op_attr
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "commutative" [] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in Comm_op_attr
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "idempotent" [] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in Idem_op_attr
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-op-attr" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unit_op_attr aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "OP_ATTR" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-OP-ATTR" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (PRED_ITEM a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pred-decl" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Pred_decl aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pred-defn" [ aa, ab, ac, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Pred_defn aa' ab' ac' ad'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "PRED_ITEM" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-PRED-ITEM" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML PRED_TYPE where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pred-type" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (aa', ps) = from_sml_ATermSORTS (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab' = insertPos ps pos_l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Pred_type aa' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "PRED_TYPE" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-PRED-TYPE" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML PRED_HEAD where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pred-head" [ aa ] _) ->
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder aa' = from_sml_ATermList from_sml_ATermARG_DECL
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Pred_head aa' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "PRED_HEAD" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-PRED-HEAD" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML DATATYPE_DECL where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "datatype-decl" [ aa, ab, ac ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
6c4ee04931dded62728f3a9954b2799beed536e9Christian Maeder abh : abt = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = from_sml_ShATerm (getATermByIndex1 ac att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab'' = addLAnnoList as abh : abt
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Datatype_decl aa' ab'' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "DATATYPE_DECL" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-DATATYPE-DECL" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML ALTERNATIVE where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "total-construct" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Alt_construct Total aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "partial-construct" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Alt_construct Partial aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "subsort" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Subsorts aa' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "ALTERNATIVE" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-ALTERNATIVE" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML COMPONENTS where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "total-select" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Cons_select Total aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "partial-select" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Cons_select Partial aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sort-component" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "COMPONENTS" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-COMPONENTS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML VAR_DECL where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ATermVARs (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Var_decl aa' ab' nullRange
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "VAR_DECL" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (FORMULA a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "quantification" [ aa, ab, ac ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder pq = getPos (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ad' = insertPos pq pos_l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Quantification aa' ab' ac' ad'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "conjunction" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Junction Con aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "disjunction" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Junction Dis aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "implication" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Relation aa' Implication ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "equivalence" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Relation aa' Equivalence ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "negation" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Negation aa' ab'
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder -- the following things are from SML-type ATOM
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder (ShAAppl "atom" [i] _) ->
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder case getATerm (getATermByIndex1 i att') of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "ttrue" [] _) ->
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Atom True aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "ffalse" [] _) ->
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Atom False aa'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "predication" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ab', ps) = from_sml_ATermTERMS (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ac' = insertPos ps pos_l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Predication aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "definedness" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Definedness aa' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "existl-equation" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Equation aa' Existl ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "strong-equation" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Equation aa' Strong ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "membership" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Membership aa' ab' ac'
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers _ -> from_sml_ShATermError "FORMULA" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "FORMULA" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, _g_flag, att') = skipPosFlag "pos-FORMULA" att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for the SML-datatype TERMS -------------------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATermTERMS :: ATermTable -> ([TERM a], Range)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermTERMS att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "terms" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (from_sml_ShATerm (getATermByIndex1 aa att), pos_l)
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski _ -> from_sml_ShATermError "([TERM],Range)" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-TERMS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for SIMPLE_IDs and IRIs ----------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermSIMPLE_ID :: ATermTable -> SIMPLE_ID
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermSIMPLE_ID att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [ si, _ ] _) -> {- snd element is 'None'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (CASL.grm:((WORDS,None))) -}
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers let s = from_sml_ShATerm $ getATermByIndex1 si att
fea14169cb07365fe4d12fea734d7b761ea8b287Christian Maeder in mkSimpleId s
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers _ -> from_sml_ShATermError "SIMPLE_ID" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where aterm = getATerm att
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksafrom_sml_ATermIRI :: ATermTable -> IRI
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksafrom_sml_ATermIRI att =
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "" [ si, _ ] _) -> {- snd element is 'None'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (CASL.grm:((WORDS,None))) -}
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa let s = from_sml_ShATerm $ getATermByIndex1 si att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder in fromMaybe (error $ "parsing error: not an IRI \"" ++ s
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ++ "\" \n(from_sml_ATermIRI)")
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder $ parseIRICurie s
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa _ -> from_sml_ShATermError "IRI" aterm
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa where aterm = getATerm att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for [VAR] -------------------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermVARs :: ATermTable -> [VAR]
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermVARs att = map from_sml_ATermSIMPLE_ID att_list
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where att_list = case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAList l _ -> map getAtt l
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> from_sml_ShATermError "[VAR]" $ getATerm att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getAtt ai = getATermByIndex1 ai att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML QUANTIFIER where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "forall" [] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "exists" [] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in Existential
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "exists-uniquely" [] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in Unique_existential
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "QUANTIFIER" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-QUANTIFIER" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML PRED_SYMB where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "pred-symb" [ aa, ab ] _ ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in case getATerm $ getATermByIndex1 ab att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "None" [] _ -> Pred_name aa'
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ShAAppl "Some" [ aab ] _ ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder let aab' = from_sml_ShATerm (getATermByIndex1 aab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Qual_pred_name aa' aab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "Option" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "PRED_SYMB" aterm
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "pos-PRED-SYMB" [reg_i, item_i] _ ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
e07538a3c4dbc690e57f61aded6db89d876b2374Christian Maederinstance ATermConvertibleSML (TERM a) where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "var-or-const" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ATermSIMPLE_ID (getATermByIndex1 aa att)
9bfdf40cbc2c61dd8281904a03ac598d51e0a872Christian Maeder in varOrConst aa'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "qual-var" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Qual_var aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "application" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ab', ps) = from_sml_ATermTERMS (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ac' = insertPos ps pos_l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Application aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sorted-term" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Sorted_term aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "cast" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Cast aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "conditional" [ aa, ab, ac ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Conditional aa' ab' ac' ad'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "TERM" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, _p_flag, att') = skipPosFlag "pos-TERM" att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML OP_SYMB where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "op-symb" [ aa, ab ] _ ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in case getATerm $ getATermByIndex1 ab att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "None" [] _ -> Op_name aa'
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ShAAppl "Some" [ aab ] _ ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder let aab' = from_sml_ShATerm (getATermByIndex1 aab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Qual_op_name aa' aab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "Option" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "OP_SYMB" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-OP-SYMB" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SYMB_ITEMS where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "symb-items" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Symb_items aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SYMB_ITEMS" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SYMB-ITEMS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SYMB_MAP_ITEMS where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "symb-map-items" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Symb_map_items aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SYMB_MAP_ITEMS" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SYMB-MAP-ITEMS" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SYMB_KIND where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "implicitk" [] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "sortsk" [] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "opsk" [] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "predsk" [] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SYMB_KIND" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SYMB-KIND" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SYMB where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "symb-id" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder i = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa' = setFstPos pos_l i
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "qual-id" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Qual_id aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SYMB" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SYMB" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML TYPE where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "op-symb-type" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pred-symb-type" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "TYPE" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-TYPE" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SYMB_OR_MAP where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "symb" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "symb-or-map" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (aa', ab') = from_sml_ATermSYMB_MAP (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Symb_map aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SYMB_OR_MAP" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SYMB-OR-MAP" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for SYMB_MAP from SML -------------------------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATermSYMB_MAP :: ATermTable -> (SYMB, SYMB)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermSYMB_MAP att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "symb-map" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder in (aa', ab')
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "(SYMB,SYMB)" aterm
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-SYMB-MAP" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- --- instances of AS_Structured.hs -------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SPEC where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "basic" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa'' = G_basic_spec CASL aa'
97f7ac06b3cbf4fc22c0a9eef523b68ee34fc164Christian Maeder in group (Syntax.AS_Structured.Basic_spec aa''
97f7ac06b3cbf4fc22c0a9eef523b68ee34fc164Christian Maeder nullRange) group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "translation" [ aa, ab, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Translation aa' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "reduction" [ aa, ab, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Reduction aa' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "union-spec" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa' :: [(Annoted SPEC, [Annotation])]
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Union (toAnnotedList aa') ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "extension" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa' :: [(Annoted SPEC, [Annotation])]
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Extension (toAnnotedList aa') ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "free-spec" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList (toAnnoList ab att) aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Free_spec aa'' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "local-spec" [ aa, ab, ac, ad ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder sp1 = addLAnnoList (toAnnoList ab att) aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder sp2 = addLAnnoList (toAnnoList ad att) ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Local_spec sp1 sp2 pos_l) group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "closed-spec" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList (toAnnoList ab att) aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Closed_spec aa'' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "spec-inst" [ aa, ab ] _) ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
dc62afbf79603699b39b2387f48298634f642e67cmaeder in Spec_inst aa' ab' Nothing nullRange
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "SPEC" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder group s gf = if gf then Group s' pos_l else s
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder where s' = emptyAnno s
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, group_flag, att') = skipPosFlag "pos-SPEC" att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- - a helper function for [(Annoted a, [Annotation])] --------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaedertoAnnotedList :: [(Annoted a, [Annotation])] -> [Annoted a]
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaedertoAnnotedList = map merge
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder where merge (ai, as) = ai { l_annos = l_annos ai ++ as}
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML RENAMING where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "renaming" [ aa ] _) ->
0e9494f7ac18b504a9dab7e9f001d8a94bd3baaaChristian Maeder case from_sml_ShATerm (getATermByIndex1 aa att) of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = if null aa' then []
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder else [G_symb_map $ G_symb_map_items_list CASL aa']
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Renaming aa'' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "RENAMING" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-RENAMING" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML RESTRICTION where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "hide" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = case from_sml_ShATerm (getATermByIndex1 aa att) of
0e9494f7ac18b504a9dab7e9f001d8a94bd3baaaChristian Maeder aa' -> [G_symb_list $ G_symb_items_list CASL aa']
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Hidden aa'' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "reveal" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = G_symb_map_items_list CASL aa'
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Revealed aa'' ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "RESTRICTION" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-RESTRICTION" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers{- !!! This will be done by the instance of LIB_ITEM !!!
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML SPEC_DEFN where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML GENERICITY where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "genericity" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Genericity aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "GENERICITY" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-GENERICITY" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML PARAMS where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "params" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "PARAMS" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-PARAMS" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML IMPORTED where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "imports" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Imported aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "IMPORTED" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-IMPORTS" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML FIT_ARG where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "fit-spec" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab'' = case from_sml_ShATerm (getATermByIndex1 ab att) of
587fb54160b66128cf17e4c9bca7494a7f2c3c4aChristian Maeder ab' -> [G_symb_map $ G_symb_map_items_list CASL ab']
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Fit_spec aa' ab'' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "fit-view" [ aa, ab ] _) ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Fit_view aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "FIT_ARG" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-FIT-ARG" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers{- !!! This conversion is covered by the instance of LIB_ITEM !!!
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML VIEW_DEFN where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML VIEW_TYPE where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "view-type" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in View_type aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "VIEW_TYPE" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-VIEW-TYPE" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder{- --- instances of AS_Architecture.hs -----------------------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder!!! This conversion is covered by the instance of LIB_ITEM !!!
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML ARCH_SPEC_DEFN where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML ARCH_SPEC where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "basic-arch-spec" [ aa, ab, ac ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder hd : tl = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ATermRESULT_UNIT (getATermByIndex1 ab att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = toAnnoList ac att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList as hd : tl
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Basic_arch_spec aa'' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "named-arch-spec" [ aa ] _) ->
55b14de0878c596dc00920ecac65bab478e930e8Christian Maeder aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Arch_spec_name aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "ARCH_SPEC" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-ARCH-SPEC" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATermRESULT_UNIT :: ATermTable -> Annoted UNIT_EXPRESSION
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermRESULT_UNIT att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "result-unit" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- aa' :: UNIT_EXPRESSION
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = toAnnoList ab att
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Annoted aa' nullRange as []
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "RESULT-UNIT" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-RESULT-UNIT" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
fa3833ff4dad97e760264971215091d6f49d3766Christian Maederinstance ATermConvertibleSML UNIT_REF where
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder from_sml_ShATerm att =
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-decl-case" [ udl ] _) ->
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder let att1 = getATermByIndex1 udl att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ps, att2) = case getATerm att1 of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-DECL" [reg_i, item_i] _) ->
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder (posFromRegion reg_i att,
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder getATermByIndex1 item_i att1)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att1)
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder aterm2 = getATerm att2
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder in case aterm2 of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "unit-decl" [aa, ab, _] _ ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder let aa' = from_sml_ATermIRI $
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder getATermByIndex1 aa att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unit_ref aa' ab' ad'
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder _ -> from_sml_ShATermError "UNIT_DECL" aterm2
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder _ -> from_sml_ShATermError "UNIT-DECL-DEFN" aterm
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder aterm = getATerm att'
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-DECL-DEFN" [_, item_i] _) ->
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML UNIT_DECL_DEFN where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-decl-case" [ udl ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder let att1 = getATermByIndex1 udl att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ps, att2) = case getATerm att1 of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-DECL" [reg_i, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (posFromRegion reg_i att,
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att1)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att1)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm2 = getATerm att2
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in case aterm2 of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "unit-decl" [aa, ab, ac] _ ->
55b14de0878c596dc00920ecac65bab478e930e8Christian Maeder let aa' = from_sml_ATermIRI $ getATermByIndex1 aa att
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder ab' = from_sml_ShATerm $ getATermByIndex1 ab att
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder ac' = from_sml_ATermUNIT_IMPORTS $
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder getATermByIndex1 ac att
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder in Unit_decl aa' ab' ac' ad'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT_DECL" aterm2
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-defn-case" [ udn ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder from_sml_ATermUNIT_DEFN $ getATermByIndex1 udn att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "pos-UNIT-DEFN" _ _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder from_sml_ATermUNIT_DEFN att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (ShAAppl "unit-defn" _ _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder from_sml_ATermUNIT_DEFN att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT-DECL-DEFN" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-DECL-DEFN" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for the SML-datatype UNIT_IMPORTS ------------------------
fa3833ff4dad97e760264971215091d6f49d3766Christian Maederfrom_sml_ATermUNIT_IMPORTS :: ATermTable -> [Annoted UNIT_TERM]
fa3833ff4dad97e760264971215091d6f49d3766Christian Maederfrom_sml_ATermUNIT_IMPORTS att =
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-imports" [ aa ] _) ->
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder from_sml_ShATerm $ getATermByIndex1 aa att
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder _ -> from_sml_ShATermError "UNIT_IMPORTS" aterm
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder where aterm = getATerm att'
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-IMPORTS" [_, item_i] _) ->
fa3833ff4dad97e760264971215091d6f49d3766Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermUNIT_DEFN :: ATermTable -> UNIT_DECL_DEFN
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersfrom_sml_ATermUNIT_DEFN att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl "unit-defn" [aa, ab] _ ->
55b14de0878c596dc00920ecac65bab478e930e8Christian Maeder let aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unit_defn aa' ab' ac'
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers _ -> from_sml_ShATermError "UNIT_DEFN" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-DEFN" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers{- !!! This conversion is covered by the instance of LIB_ITEM !!!
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML UNIT_SPEC_DEFN where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML UNIT_SPEC where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-type-case" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (aa', ab') = from_sml_ATermUNIT_TYPE $ getATermByIndex1 aa att
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unit_type aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "spec-name-case" [ aa ] _) ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Spec_name aa'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "closed" [ aa ] _) ->
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Closed_unit_spec aa' ab'
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder _ -> from_sml_ShATermError "UNIT_SPEC" aterm
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-SPEC" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maederinstance ATermConvertibleSML REF_SPEC where
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder from_sml_ShATerm att =
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-type-case" [ aa ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (aa', ab') = from_sml_ATermUNIT_TYPE $ getATermByIndex1 aa att
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder in Unit_spec $ Unit_type aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "spec-name-case" [ aa ] _) ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder in (Unit_spec $ Spec_name aa')
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "arch-spec-case" [ aa, ab ] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ps = toAnnoList ab att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder aa'' = addLAnnoList ps aa'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa''' = case aa'' of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (Annoted (Basic_arch_spec {}) _ _ _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder emptyAnno (Group_arch_spec aa'' ab')
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Arch_unit_spec aa''' ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "closed" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder in (Unit_spec $ Closed_unit_spec aa' ab')
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT_SPEC" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-SPEC" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- a helper for the SML-datatype UNIT_TYPE ----------------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATermUNIT_TYPE :: ATermTable -> ([Annoted SPEC], Annoted SPEC)
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maederfrom_sml_ATermUNIT_TYPE att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-type" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder (from_sml_ShATerm $ getATermByIndex1 aa att,
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder from_sml_ShATerm $ getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT_TYPE" aterm
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers where aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-TYPE" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML UNIT_EXPRESSION where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-expression" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unit_expression aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT_EXPRESSION" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-EXPRESSION" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML UNIT_BINDING where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-binding" [ aa, ab ] _) ->
55b14de0878c596dc00920ecac65bab478e930e8Christian Maeder aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Unit_binding aa' ab' ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT_BINDING" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-UNIT-BINDING" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML UNIT_TERM where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-reduction" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Unit_reduction aa' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-translation" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Unit_translation aa' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "amalgamation" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Amalgamation aa' ab') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "local-unit" [ aa, ab ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Local_unit aa' ab' ac') group_flag
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-appl" [ aa, ab ] _) ->
55b14de0878c596dc00920ecac65bab478e930e8Christian Maeder aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in group (Unit_appl aa' ab' ac') group_flag
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "UNIT_TERM" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder group ut gf = if gf then Group_unit_term ut' pos_l else ut
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder where ut' = emptyAnno ut
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, group_flag, att') = skipPosFlag "pos-UNIT-TERM" att
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML FIT_ARG_UNIT where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "fit-arg-unit" [ aa, ab ] _) ->
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder case from_sml_ShATerm (getATermByIndex1 aa att) of
4e521879e36515b983525ff9a4ea82ba44e5bbffChristian Maeder aa' -> case from_sml_ShATerm (getATermByIndex1 ab att) of
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder ab' -> Fit_arg_unit aa' (if null ab' then [] else
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder [G_symb_map $ G_symb_map_items_list CASL ab']) pos_l
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "FIT_ARG_UNIT" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-FIT-ARG-UNIT" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- --- instances of AS_LIbrary.hs ----------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML LIB_DEFN where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "lib-defn" [ aa, ab, ad ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ad' = from_sml_ShATerm (getATermByIndex1 ad att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Lib_defn aa' ab' ac' ad'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "LIB_DEFN" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-LIB-DEFN" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckersinstance ATermConvertibleSML LIB_ITEM where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "spec-defn" [ aa, ab, ac, ad ] _) ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder as = toAnnoList ad att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ac'' = addLAnnoList as ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in Syntax.AS_Library.Spec_defn aa' ab' ac'' ad'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "view-defn" [ aa, ab, ac, ad, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder let -- the annotation list is lost !!!!
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ac' = from_sml_ShATerm (getATermByIndex1 ac att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ad'' = case from_sml_ShATerm (getATermByIndex1 ad att) of
0e9494f7ac18b504a9dab7e9f001d8a94bd3baaaChristian Maeder ad' -> [G_symb_map $ G_symb_map_items_list CASL ad']
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Syntax.AS_Library.View_defn aa' ab' ac' ad'' ae'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "arch-spec-defn" [ aa, ab, _ ] _) ->
55b14de0878c596dc00920ecac65bab478e930e8Christian Maeder aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Syntax.AS_Library.Arch_spec_defn aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "unit-spec-defn" [ aa, ab, _ ] _) ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in Syntax.AS_Library.Unit_spec_defn aa' ab' ac'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "download-items" [ aa, ab, _ ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder in Syntax.AS_Library.Download_items aa' (ItemMaps ab') ac'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "LIB_ITEM" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') = skipPos "pos-LIB-ITEM" att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -- helpers to skip nested "pos-"-constructors -----------------------
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederskipPos :: String -> ATermTable -> (Range, ATermTable)
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederskipPos mcon at =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case getATerm at of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl con [reg_i, item_i] _ | mcon == con ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder if pCon then skipPos mcon at'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder else (posFromRegion reg_i at, at')
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder where pCon = case getATerm at' of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ShAAppl con' _ _ | mcon == con' -> True
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder at' = getATermByIndex1 item_i at
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, at)
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederskipPosFlag :: String -> ATermTable -> (Range, Bool, ATermTable)
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederskipPosFlag mcon att =
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl con [reg_i, b_i, item_i] _ | mcon == con ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder if pCon then let (_r_pos_l, r_b, r_at') = skipPosFlag mcon at'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder in (pos_l, r_b || b, r_at')
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder else (pos_l, b, at')
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder where pCon = case getATerm at' of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ShAAppl con' _ _ | mcon == con' -> True
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder at' = getATermByIndex1 item_i att
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder pos_l = posFromRegion reg_i att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder b = from_sml_ShATerm $ getATermByIndex1 b_i att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, False, att)
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maederinstance ATermConvertibleSML ItemNameMap where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder ShAAppl "item-name" [aa] _ ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI $ getATermByIndex1 aa att
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder in ItemNameMap aa' Nothing
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder ShAAppl "item-name-map" [aa, ab] _ ->
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa aa' = from_sml_ATermIRI $ getATermByIndex1 aa att
ea8e98e298f33f9362293f392c8fb192722b8904Eugen Kuksa ab' = from_sml_ATermIRI $ getATermByIndex1 ab att
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder in ItemNameMap aa' $ Just ab'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder _ -> from_sml_ShATermError "ITEM_NAME_OR_MAP" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder att' = case getATerm att of
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder ShAAppl "pos-ITEM-NAME-OR-MAP" [_, item_i] _ ->
3fea26a73b8fa69b22dfd2653d8f7bdacb45b9c9Christian Maeder getATermByIndex1 item_i att
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maederinstance ATermConvertibleSML LibName where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "versioned-lib" [ aa, ab ] _) ->
ab53b2d1773ac020b0df4cc9edeb0debe12e7a09cmaeder aa' = fromSmlShATermToLibId (getATermByIndex1 aa att)
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder ab' = from_sml_ShATerm (getATermByIndex1 ab att)
ab53b2d1773ac020b0df4cc9edeb0debe12e7a09cmaeder in mkLibName aa' $ Just ab'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "lib" [ aa ] _) ->
ab53b2d1773ac020b0df4cc9edeb0debe12e7a09cmaeder iriLibName . fromSmlShATermToLibId $ getATermByIndex1 aa att
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder _ -> from_sml_ShATermError "LibName" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-LIB-NAME" [_, item_i] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder getATermByIndex1 item_i att
ab53b2d1773ac020b0df4cc9edeb0debe12e7a09cmaederfromSmlShATermToLibId :: ATermTable -> IRI
db6729e623b4053149084ccf4b35e5308ac7e359Christian MaederfromSmlShATermToLibId att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
0ce46d5315b16108b74d20b86aeff37c48f48828Christian Maeder (ShAAppl str [ aa ] _) | elem str ["path-name", "url"] ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
db6729e623b4053149084ccf4b35e5308ac7e359Christian Maeder in (fromMaybe (error "fromSmlShATermToLibId")
ab53b2d1773ac020b0df4cc9edeb0debe12e7a09cmaeder $ parseIRICurie aa') { iriPos = ab' }
db6729e623b4053149084ccf4b35e5308ac7e359Christian Maeder _ -> from_sml_ShATermError "LibId" aterm
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-LIB-ID" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maederinstance ATermConvertibleSML VersionNumber where
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers from_sml_ShATerm att =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case aterm of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "version" [ aa ] _) ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder aa' = from_sml_ShATerm (getATermByIndex1 aa att)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder in VersionNumber aa' ab'
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder _ -> from_sml_ShATermError "VersionNumber" aterm
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder aterm = getATerm att'
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (pos_l, att') =
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (ShAAppl "pos-VERSION" [reg_i, item_i] _) ->
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (posFromRegion reg_i att, getATermByIndex1 item_i att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> (nullRange, att)
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- -----------------------------------------------------------------------
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix Reckers-- some helpers for Annoted things --------------------------------------
e07538a3c4dbc690e57f61aded6db89d876b2374Christian MaederaddLAnnoList :: [Annotation] -> Annoted a -> Annoted a
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederaddLAnnoList as ani = ani {l_annos = as ++ l_annos ani }
e07538a3c4dbc690e57f61aded6db89d876b2374Christian MaederaddRAnnoList :: [Annotation] -> Annoted a -> Annoted a
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederaddRAnnoList as ani = ani {r_annos = r_annos ani ++ as }
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder-- - some helpers for Regions and Positions ------------------------------
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskiposFromRegion :: Int -> ATermTable -> Range
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederposFromRegion reg at = Range $ map (uncurry $ newPos "")
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder $ from_sml_ATerm_reg reg at
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskigetPos :: ATermTable -> Range
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix ReckersgetPos att = case getATerm att of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder ShAAppl _ (x : _) _ -> posFromRegion x att
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder _ -> nullRange
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski-- converts an aterm region information to Range
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATerm_reg :: Int -> ATermTable -> [(Int, Int)]
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maederfrom_sml_ATerm_reg reg_i at = [fst r, snd r]
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder where r :: ((Int, Int), (Int, Int)) -- Id.hs Region
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder r = from_sml_ShATerm r_at
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder r_at = getATermByIndex1 reg_i at
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskiinsertIM, insertPosAux :: [a] -> [a] -> [a]
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaederinsertIM ips ops | even $ length ops = let hl = length ops `div` 2
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder (fp, lp) = splitAt hl ops
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder in fp ++ ips ++ lp
9c84ea0239ba21e070e7d76d47d30713a3610327Christian Maeder | otherwise = error
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder "wrong call: length of snd list must be even"
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskiinsertPosAux = insertIM
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskiinsertPos :: Range -> Range -> Range
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskiinsertPos (Range l1) (Range l2) = Range (insertPosAux l1 l2)
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill MossakowskisetFstPos :: Range -> Id -> Id
94e112d16f89130a688db8b03ad3224903f5e97eChristian MaedersetFstPos (Range (p : _)) i = case i of
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder Id tops ids pos_l ->
0cb5f9c8582ad87ceef1c16b5d92347ae0878019Christian Maeder Id (setFstPos' tops) ids pos_l
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder where setFstPos' tops = case tops of
94e112d16f89130a688db8b03ad3224903f5e97eChristian Maeder hd : tl -> hd { tokPos = Range [p] } : tl
c1c5a93b6f5bf18be1f4a0a9da6c0e32ff00266cFelix ReckerssetFstPos _ _ = error "wrong call: setFstPos"