summaryrefslogtreecommitdiff
path: root/src/GF/Compile/Rename.hs
diff options
context:
space:
mode:
authorpeb <unknown>2005-02-09 19:45:54 +0000
committerpeb <unknown>2005-02-09 19:45:54 +0000
commit9afbd25b64607e68fe6275fb6b743159001ca984 (patch)
treec1c7f0f1bd7f83d721f4e55318160edd1f0eee1b /src/GF/Compile/Rename.hs
parentc467ef8d0323d896778c6ed68ce0b23441f3a65a (diff)
"Committed_by_peb"
Diffstat (limited to 'src/GF/Compile/Rename.hs')
-rw-r--r--src/GF/Compile/Rename.hs31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/GF/Compile/Rename.hs b/src/GF/Compile/Rename.hs
index 9dd5121c7..3f9533791 100644
--- a/src/GF/Compile/Rename.hs
+++ b/src/GF/Compile/Rename.hs
@@ -9,7 +9,17 @@
-- > CVS $Author $
-- > CVS $Revision $
--
--- (Description of the module)
+-- AR 14/5/2003
+-- The top-level function 'renameGrammar' does several things:
+--
+-- - extends each module symbol table by indirections to extended module
+--
+-- - changes unqualified and as-qualified imports to absolutely qualified
+--
+-- - goes through the definitions and resolves names
+--
+-- Dependency analysis between modules has been performed before this pass.
+-- Hence we can proceed by @fold@ing "from left to right".
-----------------------------------------------------------------------------
module Rename where
@@ -27,19 +37,10 @@ import Operations
import Monad
--- AR 14/5/2003
-
--- The top-level function $renameGrammar$ does several things:
--- * extends each module symbol table by indirections to extended module
--- * changes unqualified and as-qualified imports to absolutely qualified
--- * goes through the definitions and resolves names
--- Dependency analysis between modules has been performed before this pass.
--- Hence we can proceed by $fold$ing 'from left to right'.
-
renameGrammar :: SourceGrammar -> Err SourceGrammar
renameGrammar g = liftM (MGrammar . reverse) $ foldM renameModule [] (modules g)
--- this gives top-level access to renaming term input in the cc command
+-- | this gives top-level access to renaming term input in the cc command
renameSourceTerm :: SourceGrammar -> Ident -> Term -> Err Term
renameSourceTerm g m t = do
mo <- lookupErr m (modules g)
@@ -93,7 +94,7 @@ renameIdentTerm env@(act,imps) t =
IC "String" -> return $ const $ Q cPredefAbs cString
_ -> Bad s
---- would it make sense to optimize this by inlining?
+--- | would it make sense to optimize this by inlining?
renameIdentPatt :: Status -> Patt -> Err Patt
renameIdentPatt env p = do
let t = patt2term p
@@ -210,8 +211,7 @@ renameTerm env vars = ren vars where
return (p',t')
renpatt = renamePattern env
--- vars not needed in env, since patterns always overshadow old vars
-
+-- | vars not needed in env, since patterns always overshadow old vars
renamePattern :: Status -> Patt -> Err (Patt,[Ident])
renamePattern env patt = case patt of
@@ -263,8 +263,7 @@ renameContext b = renc [] where
_ -> return cont
ren = renameTerm b
--- vars not needed in env, since patterns always overshadow old vars
-
+-- | vars not needed in env, since patterns always overshadow old vars
renameEquation :: Status -> [Ident] -> Equation -> Err Equation
renameEquation b vs (ps,t) = do
(ps',vs') <- liftM unzip $ mapM (renamePattern b) ps