Commit b6fd2ed6 authored by László Domoszlai's avatar László Domoszlai

change imports Data.Map qualified to prevent name clashes due to newly exported functions

git-svn-id: https://svn.cs.ru.nl/repos/clean-sapl/branches/hierarchical@620 cb785ff4-4565-4a15-8565-04c4fcf96d79
parent 87c9b1b9
implementation module Sapl.Linker.SaplLinkerShared
import StdTuple, StdBool, StdInt, StdFile
import Data.Maybe, Data.Map, Text.StringAppender
import Data.Maybe, Text.StringAppender
from Data.Map import :: Map, :: Size
import qualified Data.Map as DM
from Data.Set import :: Set
import System.File, System.Directory, Data.Error
import Sapl.SaplTokenizer, Sapl.FastString
......@@ -64,13 +67,13 @@ read_line (lmap, startfn, id) line
# next = tl next // skip "="
# lmap = case hd next of
TOpenBracket # lmap = put type_name (LT_FUNC line DT_NO_DEPENDENCY) lmap
TOpenBracket # lmap = 'DM'.put type_name (LT_FUNC line DT_NO_DEPENDENCY) lmap
= parse_record (tl next) type_name lmap // constructors as redirects
// For ADTs substitute type name with numeric id (only constructor names used,
// and the type name can be identical to one of its constructors name which is not good here)
_ # tid = "_"+++toString id
# lmap = put tid (LT_FUNC line DT_NO_DEPENDENCY) lmap
# lmap = 'DM'.put tid (LT_FUNC line DT_NO_DEPENDENCY) lmap
= parse_ADT next tid lmap
= (lmap, startfn, id+1)
......@@ -79,11 +82,11 @@ read_line (lmap, startfn, id) line
[TAssignmentOp, (TIdentifier "StdMisc.undef"):_] // skip functions which are undefined
= lmap
[TAssignmentOp: ts]
= put name (LT_FUNC line (DT_NEED_PROCESS ts)) lmap
= 'DM'.put name (LT_FUNC line (DT_NEED_PROCESS ts)) lmap
[TCAFAssignmentOp: ts]
= put name (LT_FUNC line (DT_NEED_PROCESS ts)) lmap
= 'DM'.put name (LT_FUNC line (DT_NEED_PROCESS ts)) lmap
[TMacroAssignmentOp: ts]
= put name (LT_MACRO (macroBody ts) (DT_NEED_PROCESS ts)) lmap
= 'DM'.put name (LT_MACRO (macroBody ts) (DT_NEED_PROCESS ts)) lmap
= lmap // something wrong with this line: skip it
= (lmap, if (isNothing startfn && endsWith ".Start" name) (Just name) startfn, id+1)
......@@ -105,7 +108,7 @@ where
// Get contructor names from ADT definition
parse_ADT [(TIdentifier name):ts] fn lmap
= parse_ADT (skip_to_next_const ts) fn (put name (LT_REDIRECT fn) lmap)
= parse_ADT (skip_to_next_const ts) fn ('DM'.put name (LT_REDIRECT fn) lmap)
where
skip_to_next_const [TVerticalBar:ts] = ts
skip_to_next_const [_:ts] = skip_to_next_const ts
......@@ -119,7 +122,7 @@ parse_ADT [] _ lmap = lmap
// Get contructor names from record definition
parse_record [TIdentifier name:ts] fn lmap
= parse_record ts fn (put name (LT_REDIRECT fn) lmap)
= parse_record ts fn ('DM'.put name (LT_REDIRECT fn) lmap)
// Skip everything else (should be ",")
parse_record [_:ts] fn lmap
......@@ -138,7 +141,7 @@ where
// redirect always redirects to the same module, so it is safe to not
// to try to load the module
= generate_source_ lmap skipset loader name
(if (member name skipset) Nothing (get name lmap)) a world
(if (member name skipset) Nothing ('DM'.get name lmap)) a world
generate_source_ lmap skipset (lf,ls) fn (Just (LT_FUNC line dt)) a world
# skipset = insert fn skipset
......@@ -159,7 +162,7 @@ where
// macro can't have macro dependency. by design.
# (lmap, skipset, loader, a, world) = foldl (\(lmap, skipset, loader, a, world) t = generate_source lmap skipset loader t a world)
(lmap, skipset, loader, a, world) deps
= (put fn (LT_MACRO body DT_NO_DEPENDENCY) lmap, skipset, loader, a, world)
= ('DM'.put fn (LT_MACRO body DT_NO_DEPENDENCY) lmap, skipset, loader, a, world)
// try to load the module
generate_source_ lmap skipset loader fn Nothing a world
......@@ -212,4 +215,4 @@ substitute_macros lmap deps loader line a world
is_macro (_,(Just (LT_MACRO _ _))) = True
is_macro _ = False
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment