summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeb <unknown>2005-02-18 18:21:06 +0000
committerpeb <unknown>2005-02-18 18:21:06 +0000
commit9568d7a844ba6a1872a8e8f6ef002860057e62ab (patch)
tree9e25c6ed62e48101a2782d5fb8dcba68462dc613 /src
parent1c4f025320900897ae3acdab6982f7d595b98dd1 (diff)
"Committed_by_peb"
Diffstat (limited to 'src')
-rw-r--r--src/GF/API.hs6
-rw-r--r--src/GF/API/BatchTranslate.hs6
-rw-r--r--src/GF/API/GrammarToHaskell.hs6
-rw-r--r--src/GF/API/IOGrammar.hs6
-rw-r--r--src/GF/API/MyParser.hs6
-rw-r--r--src/GF/CF/CF.hs36
-rw-r--r--src/GF/CF/CFIdent.hs44
-rw-r--r--src/GF/CF/CFtoGrammar.hs10
-rw-r--r--src/GF/CF/CFtoSRG.hs6
-rw-r--r--src/GF/CF/CanonToCF.hs10
-rw-r--r--src/GF/CF/ChartParser.hs6
-rw-r--r--src/GF/CF/EBNF.hs10
-rw-r--r--src/GF/CF/PPrCF.hs10
-rw-r--r--src/GF/CF/PrLBNF.hs10
-rw-r--r--src/GF/CF/Profile.hs10
-rw-r--r--src/GF/CFGM/AbsCFG.hs13
-rw-r--r--src/GF/CFGM/PrintCFG.hs13
-rw-r--r--src/GF/CFGM/PrintCFGrammar.hs8
-rw-r--r--src/GF/Canon/AbsGFC.hs13
-rw-r--r--src/GF/Canon/CMacros.hs14
-rw-r--r--src/GF/Canon/CanonToGrammar.hs10
-rw-r--r--src/GF/Canon/GFC.hs21
-rw-r--r--src/GF/Canon/GetGFC.hs10
-rw-r--r--src/GF/Canon/Look.hs22
-rw-r--r--src/GF/Canon/MkGFC.hs10
-rw-r--r--src/GF/Canon/PrExp.hs10
-rw-r--r--src/GF/Canon/PrintGFC.hs13
-rw-r--r--src/GF/Canon/Share.hs6
-rw-r--r--src/GF/Canon/Unlex.hs6
-rw-r--r--src/GF/Compile/BackOpt.hs10
-rw-r--r--src/GF/Compile/CheckGrammar.hs12
-rw-r--r--src/GF/Compile/Compile.hs13
-rw-r--r--src/GF/Compile/Extend.hs13
-rw-r--r--src/GF/Compile/GetGrammar.hs14
-rw-r--r--src/GF/Compile/GrammarToCanon.hs14
-rw-r--r--src/GF/Compile/MkResource.hs12
-rw-r--r--src/GF/Compile/MkUnion.hs10
-rw-r--r--src/GF/Compile/ModDeps.hs18
-rw-r--r--src/GF/Compile/NewRename.hs14
-rw-r--r--src/GF/Compile/Optimize.hs12
-rw-r--r--src/GF/Compile/PGrammar.hs15
-rw-r--r--src/GF/Compile/PrOld.hs13
-rw-r--r--src/GF/Compile/Rebuild.hs12
-rw-r--r--src/GF/Compile/RemoveLiT.hs12
-rw-r--r--src/GF/Compile/Rename.hs17
-rw-r--r--src/GF/Compile/ShellState.hs10
-rw-r--r--src/GF/Compile/Update.hs17
-rw-r--r--src/GF/Data/ErrM.hs15
-rw-r--r--src/GF/Data/Glue.hs10
-rw-r--r--src/GF/Data/Map.hs26
-rw-r--r--src/GF/Data/Operations.hs136
-rw-r--r--src/GF/Data/OrdMap2.hs10
-rw-r--r--src/GF/Data/OrdSet.hs10
-rw-r--r--src/GF/Data/Parsers.hs27
-rw-r--r--src/GF/Data/RedBlack.hs6
-rw-r--r--src/GF/Data/SharedString.hs13
-rw-r--r--src/GF/Data/Str.hs32
-rw-r--r--src/GF/Data/Trie.hs8
-rw-r--r--src/GF/Data/Trie2.hs6
-rw-r--r--src/GF/Data/Zipper.hs61
-rw-r--r--src/GF/Fudgets/ArchEdit.hs6
-rw-r--r--src/GF/Fudgets/CommandF.hs6
-rw-r--r--src/GF/Fudgets/EventF.hs19
-rw-r--r--src/GF/Fudgets/FudgetOps.hs16
-rw-r--r--src/GF/Fudgets/UnicodeF.hs12
-rw-r--r--src/GF/Grammar/AbsCompute.hs26
-rw-r--r--src/GF/Grammar/Abstract.hs10
-rw-r--r--src/GF/Grammar/AppPredefined.hs13
-rw-r--r--src/GF/Grammar/Compute.hs20
-rw-r--r--src/GF/Grammar/Grammar.hs203
-rw-r--r--src/GF/Grammar/Lockfield.hs14
-rw-r--r--src/GF/Grammar/LookAbs.hs41
-rw-r--r--src/GF/Grammar/Lookup.hs25
-rw-r--r--src/GF/Grammar/MMacros.hs26
-rw-r--r--src/GF/Grammar/Macros.hs54
-rw-r--r--src/GF/Grammar/PatternMatch.hs21
-rw-r--r--src/GF/Grammar/PrGrammar.hs64
-rw-r--r--src/GF/Grammar/Refresh.hs14
-rw-r--r--src/GF/Grammar/ReservedWords.hs18
-rw-r--r--src/GF/Grammar/TC.hs22
-rw-r--r--src/GF/Grammar/TypeCheck.hs44
-rw-r--r--src/GF/Grammar/Unify.hs22
-rw-r--r--src/GF/Grammar/Values.hs34
-rw-r--r--src/GF/Infra/CheckM.hs15
-rw-r--r--src/GF/Infra/Comments.hs13
-rw-r--r--src/GF/Infra/Ident.hs24
-rw-r--r--src/GF/Infra/Modules.hs82
-rw-r--r--src/GF/Infra/Option.hs81
-rw-r--r--src/GF/Infra/ReadFiles.hs43
-rw-r--r--src/GF/Infra/UseIO.hs69
-rw-r--r--src/GF/Shell.hs6
-rw-r--r--src/GF/Shell/CommandL.hs6
-rw-r--r--src/GF/Shell/Commands.hs6
-rw-r--r--src/GF/Shell/JGF.hs6
-rw-r--r--src/GF/Shell/PShell.hs6
-rw-r--r--src/GF/Shell/ShellCommands.hs6
-rw-r--r--src/GF/Shell/SubShell.hs6
-rw-r--r--src/GF/Shell/TeachYourself.hs6
-rw-r--r--src/GF/Source/AbsGF.hs13
-rw-r--r--src/GF/Source/GrammarToSource.hs14
-rw-r--r--src/GF/Source/PrintGF.hs13
-rw-r--r--src/GF/Source/SkelGF.hs13
-rw-r--r--src/GF/Source/SourceToGrammar.hs12
-rw-r--r--src/GF/Source/TestGF.hs13
-rw-r--r--src/GF/Speech/PrGSL.hs13
-rw-r--r--src/GF/Speech/PrJSGF.hs22
-rw-r--r--src/GF/Speech/SRG.hs23
-rw-r--r--src/GF/Speech/TransformCFG.hs18
-rw-r--r--src/GF/System/Arch.hs21
-rw-r--r--src/GF/Text/Arabic.hs8
-rw-r--r--src/GF/Text/Devanagari.hs8
-rw-r--r--src/GF/Text/Ethiopic.hs16
-rw-r--r--src/GF/Text/ExtendedArabic.hs8
-rw-r--r--src/GF/Text/ExtraDiacritics.hs8
-rw-r--r--src/GF/Text/Greek.hs8
-rw-r--r--src/GF/Text/Hebrew.hs8
-rw-r--r--src/GF/Text/Hiragana.hs8
-rw-r--r--src/GF/Text/LatinASupplement.hs8
-rw-r--r--src/GF/Text/OCSCyrillic.hs8
-rw-r--r--src/GF/Text/Russian.hs12
-rw-r--r--src/GF/Text/Tamil.hs8
-rw-r--r--src/GF/Text/Text.hs39
-rw-r--r--src/GF/Text/UTF8.hs18
-rw-r--r--src/GF/Text/Unicode.hs14
-rw-r--r--src/GF/Translate/GFT.hs12
-rw-r--r--src/GF/UseGrammar/Custom.hs6
-rw-r--r--src/GF/UseGrammar/Editing.hs6
-rw-r--r--src/GF/UseGrammar/Generate.hs6
-rw-r--r--src/GF/UseGrammar/GetTree.hs6
-rw-r--r--src/GF/UseGrammar/Information.hs6
-rw-r--r--src/GF/UseGrammar/Linear.hs6
-rw-r--r--src/GF/UseGrammar/MoreCustom.hs6
-rw-r--r--src/GF/UseGrammar/Morphology.hs6
-rw-r--r--src/GF/UseGrammar/Paraphrases.hs6
-rw-r--r--src/GF/UseGrammar/Parsing.hs6
-rw-r--r--src/GF/UseGrammar/Randomized.hs6
-rw-r--r--src/GF/UseGrammar/RealMoreCustom.hs6
-rw-r--r--src/GF/UseGrammar/Session.hs6
-rw-r--r--src/GF/UseGrammar/TeachYourself.hs6
-rw-r--r--src/GF/UseGrammar/Tokenize.hs6
-rw-r--r--src/GF/UseGrammar/Transfer.hs6
-rw-r--r--src/GF/Visualization/VisualizeGrammar.hs19
-rw-r--r--src/haddock/haddock-check.perl13
-rw-r--r--src/haddock/haddock-script.csh45
-rw-r--r--src/tools/AlphaConvGF.hs12
-rw-r--r--src/tools/GFDoc.hs19
-rw-r--r--src/tools/Htmls.hs24
-rw-r--r--src/tools/MkHelpFile.hs20
-rw-r--r--src/tools/WriteF.hs12
149 files changed, 1519 insertions, 1161 deletions
diff --git a/src/GF/API.hs b/src/GF/API.hs
index cc3a8c206..4ab40b180 100644
--- a/src/GF/API.hs
+++ b/src/GF/API.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.27 $
--
-- Application Programmer's Interface to GF; also used by Shell. AR 10/11/2001
-----------------------------------------------------------------------------
diff --git a/src/GF/API/BatchTranslate.hs b/src/GF/API/BatchTranslate.hs
index 783cc7296..60a098d2b 100644
--- a/src/GF/API/BatchTranslate.hs
+++ b/src/GF/API/BatchTranslate.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- translate OCL, etc, files in batch mode
-----------------------------------------------------------------------------
diff --git a/src/GF/API/GrammarToHaskell.hs b/src/GF/API/GrammarToHaskell.hs
index 35f254b64..5be778662 100644
--- a/src/GF/API/GrammarToHaskell.hs
+++ b/src/GF/API/GrammarToHaskell.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- to write a GF abstract grammar into a Haskell module with translations from
-- data objects into GF trees. Example: GSyntax for Agda.
diff --git a/src/GF/API/IOGrammar.hs b/src/GF/API/IOGrammar.hs
index 6bebba83f..7abeead08 100644
--- a/src/GF/API/IOGrammar.hs
+++ b/src/GF/API/IOGrammar.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.14 $
--
-- for reading grammars and terms from strings and files
-----------------------------------------------------------------------------
diff --git a/src/GF/API/MyParser.hs b/src/GF/API/MyParser.hs
index a3a489bd2..447f5eb5f 100644
--- a/src/GF/API/MyParser.hs
+++ b/src/GF/API/MyParser.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- template to define your own parser (obsolete?)
-----------------------------------------------------------------------------
diff --git a/src/GF/CF/CF.hs b/src/GF/CF/CF.hs
index 962a7d8c7..5c126ef35 100644
--- a/src/GF/CF/CF.hs
+++ b/src/GF/CF/CF.hs
@@ -1,18 +1,38 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
--- context-free grammars. AR 15/12/1999 -- 30/3/2000 -- 2/6/2001 -- 3/12/2001
+-- context-free grammars. AR 15\/12\/1999 -- 30\/3\/2000 -- 2\/6\/2001 -- 3\/12\/2001
-----------------------------------------------------------------------------
-module CF where
+module CF (-- * Types
+ CF(..), CFRule, CFRuleGroup,
+ CFItem(..), CFTree(..), CFPredef, CFParser,
+ RegExp(..), CFWord,
+ -- * Functions
+ cfParseResults,
+ -- ** to construct CF grammars
+ emptyCF, emptyCFPredef, rules2CF, groupCFRules,
+ -- ** to construct rules
+ atomCFRule, atomCFTerm, atomRegExp, altsCFTerm,
+ -- ** to construct trees
+ atomCFTree, buildCFTree,
+ -- ** to decide whether a token matches a terminal item
+ matchCFTerm, satRegExp,
+ -- ** to analyse a CF grammar
+ catsOfCF, rulesOfCF, ruleGroupsOfCF, rulesForCFCat,
+ valCatCF, valItemsCF, valFunCF,
+ startCat, predefOfCF, appCFPredef, valCFItem,
+ cfTokens, wordsOfRegExp, forCFItem,
+ isCircularCF, predefRules
+ ) where
import Operations
import Str
@@ -182,10 +202,10 @@ forCFItem :: CFTok -> CFRule -> Bool
forCFItem a (_,(_, CFTerm r : _)) = satRegExp r a
forCFItem _ _ = False
+-- | we should make a test of circular chains, too
isCircularCF :: CFRule -> Bool
isCircularCF (_,(c', CFNonterm c:[])) = compatCF c' c
isCircularCF _ = False
---- we should make a test of circular chains, too
-- | coercion to the older predef cf type
predefRules :: CFPredef -> CFTok -> [CFRule]
diff --git a/src/GF/CF/CFIdent.hs b/src/GF/CF/CFIdent.hs
index 11748203a..c94678880 100644
--- a/src/GF/CF/CFIdent.hs
+++ b/src/GF/CF/CFIdent.hs
@@ -1,18 +1,35 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CFIdent
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.10 $
--
-- symbols (categories, functions) for context-free grammars.
-----------------------------------------------------------------------------
-module CFIdent where
+module CFIdent (-- * Tokens and categories
+ CFTok(..), CFCat(..),
+ tS, tC, tL, tI, tV, tM, tInt,
+ prCFTok,
+ -- * Function names and profiles
+ CFFun(..), Profile,
+ wordsCFTok,
+ -- * CF Functions
+ mkCFFun, varCFFun, consCFFun, string2CFFun, stringCFFun, intCFFun, dummyCFFun,
+ cfFun2String, cfFun2Ident, cfFun2Profile, metaCFFun,
+ -- * CF Categories
+ mkCIdent, ident2CFCat, string2CFCat, catVarCF, cat2CFCat, cfCatString, cfCatInt,
+ moduleOfCFCat, cfCat2Cat, cfCat2Ident, lexCFCat,
+ -- * CF Tokens
+ string2CFTok, str2cftoks,
+ -- * Comparisons
+ compatToks, compatTok, compatCFFun, compatCF
+ ) where
import Operations
import GFC
@@ -37,7 +54,13 @@ data CFTok =
-- | this type should be abstract
newtype CFCat = CFCat (CIdent,Label) deriving (Eq, Ord, Show)
-tS, tC, tL, tI, tV, tM :: String -> CFTok
+tS :: String -> CFTok
+tC :: String -> CFTok
+tL :: String -> CFTok
+tI :: String -> CFTok
+tV :: String -> CFTok
+tM :: String -> CFTok
+
tS = TS
tC = TC
tL = TL
@@ -91,8 +114,9 @@ stringCFFun = mkCFFun . AS
intCFFun :: Int -> CFFun
intCFFun = mkCFFun . AI . toInteger
+-- | used in lexer-by-need rules
dummyCFFun :: CFFun
-dummyCFFun = varCFFun $ identC "_" --- used in lexer-by-need rules
+dummyCFFun = varCFFun $ identC "_"
cfFun2String :: CFFun -> String
cfFun2String (CFFun (f,_)) = prt f
@@ -134,7 +158,10 @@ cat2CFCat :: (Ident,Ident) -> CFCat
cat2CFCat = uncurry idents2CFCat
-- | literals
+cfCatString :: CFCat
cfCatString = string2CFCat (prt cPredefAbs) "String"
+
+cfCatInt :: CFCat
cfCatInt = string2CFCat (prt cPredefAbs) "Int"
@@ -170,6 +197,7 @@ str2cftoks = map tS . words . sstr
compatToks :: [CFTok] -> [CFTok] -> Bool
compatToks ts us = and [compatTok t u | (t,u) <- zip ts us]
+compatTok :: CFTok -> CFTok -> Bool
compatTok (TM _ _) _ = True --- hack because metas are renamed
compatTok _ (TM _ _) = True
compatTok t u = any (`elem` (alts t)) (alts u) where
diff --git a/src/GF/CF/CFtoGrammar.hs b/src/GF/CF/CFtoGrammar.hs
index 14f11b52c..5ccbd7c1a 100644
--- a/src/GF/CF/CFtoGrammar.hs
+++ b/src/GF/CF/CFtoGrammar.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CFtoGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- 26\/1\/2000 -- 18\/4 -- 24\/3\/2004
-----------------------------------------------------------------------------
diff --git a/src/GF/CF/CFtoSRG.hs b/src/GF/CF/CFtoSRG.hs
index f8c7bddd5..9fe35b3ab 100644
--- a/src/GF/CF/CFtoSRG.hs
+++ b/src/GF/CF/CFtoSRG.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- This module prints a CF as a SRG (Speech Recognition Grammar).
-- Created : 21 January, 2001.
diff --git a/src/GF/CF/CanonToCF.hs b/src/GF/CF/CanonToCF.hs
index 41306c002..6b5f35488 100644
--- a/src/GF/CF/CanonToCF.hs
+++ b/src/GF/CF/CanonToCF.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CanonToCF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
-- AR 27\/1\/2000 -- 3\/12\/2001 -- 8\/6\/2003
-----------------------------------------------------------------------------
diff --git a/src/GF/CF/ChartParser.hs b/src/GF/CF/ChartParser.hs
index 4b2f2ceb1..71b25730c 100644
--- a/src/GF/CF/ChartParser.hs
+++ b/src/GF/CF/ChartParser.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- Bottom-up Kilbury chart parser from "Pure Functional Parsing", chapter 5.
-- OBSOLETE -- should use new MCFG parsers instead
diff --git a/src/GF/CF/EBNF.hs b/src/GF/CF/EBNF.hs
index bf54c59c2..773a2117d 100644
--- a/src/GF/CF/EBNF.hs
+++ b/src/GF/CF/EBNF.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : EBNF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/CF/PPrCF.hs b/src/GF/CF/PPrCF.hs
index 5f00e4b7e..cd91fa4da 100644
--- a/src/GF/CF/PPrCF.hs
+++ b/src/GF/CF/PPrCF.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PPrCF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.9 $
--
-- printing and parsing CF grammars, rules, and trees AR 26/1/2000 -- 9/6/2003
--
diff --git a/src/GF/CF/PrLBNF.hs b/src/GF/CF/PrLBNF.hs
index b86609a70..fbd9dba98 100644
--- a/src/GF/CF/PrLBNF.hs
+++ b/src/GF/CF/PrLBNF.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PrLBNF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.8 $
--
-- Printing CF grammars generated from GF as LBNF grammar for BNFC.
-- AR 26/1/2000 -- 9/6/2003 (PPrCF) -- 8/11/2003 -- 27/9/2004.
diff --git a/src/GF/CF/Profile.hs b/src/GF/CF/Profile.hs
index 8d5b79777..12aa5c385 100644
--- a/src/GF/CF/Profile.hs
+++ b/src/GF/CF/Profile.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Profile
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- restoring parse trees for discontinuous constituents, bindings, etc. AR 25/1/2001
-- revised 8/4/2002 for the new profile structure
diff --git a/src/GF/CFGM/AbsCFG.hs b/src/GF/CFGM/AbsCFG.hs
index e761eb38d..d66289ae9 100644
--- a/src/GF/CFGM/AbsCFG.hs
+++ b/src/GF/CFGM/AbsCFG.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module AbsCFG where
diff --git a/src/GF/CFGM/PrintCFG.hs b/src/GF/CFGM/PrintCFG.hs
index 206622d2f..db3ae74a4 100644
--- a/src/GF/CFGM/PrintCFG.hs
+++ b/src/GF/CFGM/PrintCFG.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module PrintCFG where
diff --git a/src/GF/CFGM/PrintCFGrammar.hs b/src/GF/CFGM/PrintCFGrammar.hs
index 2b9b75887..89e0be1a1 100644
--- a/src/GF/CFGM/PrintCFGrammar.hs
+++ b/src/GF/CFGM/PrintCFGrammar.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : PrintCFGrammar
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- Handles printing a CFGrammar in CFGM format.
-----------------------------------------------------------------------------
diff --git a/src/GF/Canon/AbsGFC.hs b/src/GF/Canon/AbsGFC.hs
index 19f66d168..058b4c97b 100644
--- a/src/GF/Canon/AbsGFC.hs
+++ b/src/GF/Canon/AbsGFC.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module AbsGFC where
diff --git a/src/GF/Canon/CMacros.hs b/src/GF/Canon/CMacros.hs
index 9ec753749..83d3aa54c 100644
--- a/src/GF/Canon/CMacros.hs
+++ b/src/GF/Canon/CMacros.hs
@@ -1,15 +1,17 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CMacros
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.20 $
--
-- Macros for building and analysing terms in GFC concrete syntax.
+--
+-- macros for concrete syntax in GFC that do not need lookup in a grammar
-----------------------------------------------------------------------------
module CMacros where
@@ -27,8 +29,6 @@ import Operations
import Char
import Monad
--- macros for concrete syntax in GFC that do not need lookup in a grammar
-
-- | how to mark subtrees, dep. on node, position, whether focus
type JustMarker = V.TrNode -> [Int] -> Bool -> (String, String)
diff --git a/src/GF/Canon/CanonToGrammar.hs b/src/GF/Canon/CanonToGrammar.hs
index 697ad2a8c..4ed1bd9be 100644
--- a/src/GF/Canon/CanonToGrammar.hs
+++ b/src/GF/Canon/CanonToGrammar.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CanonToGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.12 $
--
-- a decompiler. AR 12/6/2003 -- 19/4/2004
-----------------------------------------------------------------------------
diff --git a/src/GF/Canon/GFC.hs b/src/GF/Canon/GFC.hs
index 81a9abc78..a4765b304 100644
--- a/src/GF/Canon/GFC.hs
+++ b/src/GF/Canon/GFC.hs
@@ -1,18 +1,27 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GFC
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- canonical GF. AR 10\/9\/2002 -- 9\/5\/2003 -- 21\/9
-----------------------------------------------------------------------------
-module GFC where
+module GFC (Context,
+ CanonGrammar,
+ CanonModInfo,
+ CanonModule,
+ CanonAbs,
+ Info(..),
+ Printname,
+ mapInfoTerms,
+ setFlag
+ ) where
import AbsGFC
import PrintGFC
diff --git a/src/GF/Canon/GetGFC.hs b/src/GF/Canon/GetGFC.hs
index e38c44a76..4c2a29c98 100644
--- a/src/GF/Canon/GetGFC.hs
+++ b/src/GF/Canon/GetGFC.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GetGFC
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Canon/Look.hs b/src/GF/Canon/Look.hs
index 8c0056438..442bcf0f3 100644
--- a/src/GF/Canon/Look.hs
+++ b/src/GF/Canon/Look.hs
@@ -1,18 +1,28 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Look
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:06 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
-- lookup in GFC. AR 2003
-----------------------------------------------------------------------------
-module Look where
+module Look (lookupCncInfo,
+ lookupLin,
+ lookupLincat,
+ lookupPrintname,
+ lookupResInfo,
+ lookupGlobal,
+ lookupOptionsCan,
+ lookupParamValues,
+ allParamValues,
+ ccompute
+ ) where
import AbsGFC
import GFC
diff --git a/src/GF/Canon/MkGFC.hs b/src/GF/Canon/MkGFC.hs
index d1cf29e93..93813d1a2 100644
--- a/src/GF/Canon/MkGFC.hs
+++ b/src/GF/Canon/MkGFC.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : MkGFC
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Canon/PrExp.hs b/src/GF/Canon/PrExp.hs
index dbd2bdc95..04a607cc1 100644
--- a/src/GF/Canon/PrExp.hs
+++ b/src/GF/Canon/PrExp.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PrExp
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- print trees without qualifications
-----------------------------------------------------------------------------
diff --git a/src/GF/Canon/PrintGFC.hs b/src/GF/Canon/PrintGFC.hs
index d5a148aee..87b4bea31 100644
--- a/src/GF/Canon/PrintGFC.hs
+++ b/src/GF/Canon/PrintGFC.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module PrintGFC where
diff --git a/src/GF/Canon/Share.hs b/src/GF/Canon/Share.hs
index 8b4e7f2e6..26596a695 100644
--- a/src/GF/Canon/Share.hs
+++ b/src/GF/Canon/Share.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.10 $
--
-- Optimizations on GFC code: sharing, parametrization, value sets.
--
diff --git a/src/GF/Canon/Unlex.hs b/src/GF/Canon/Unlex.hs
index febf8f5c7..2a9fe118f 100644
--- a/src/GF/Canon/Unlex.hs
+++ b/src/GF/Canon/Unlex.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/02/17 10:22:10 $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:07 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- elementary text postprocessing. AR 21/11/2001
-----------------------------------------------------------------------------
diff --git a/src/GF/Compile/BackOpt.hs b/src/GF/Compile/BackOpt.hs
index 64068e93b..ed8d2b177 100644
--- a/src/GF/Compile/BackOpt.hs
+++ b/src/GF/Compile/BackOpt.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : Aarne Ranta
+-- Module : BackOpt
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- Optimizations on GF source code: sharing, parametrization, value sets.
--
diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs
index f4f1ccd40..7e6f3f117 100644
--- a/src/GF/Compile/CheckGrammar.hs
+++ b/src/GF/Compile/CheckGrammar.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : CheckGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.20 $
--
-- AR 4\/12\/1999 -- 1\/4\/2000 -- 8\/9\/2001 -- 15\/5\/2002 -- 27\/11\/2002 -- 18\/6\/2003
--
@@ -20,7 +20,7 @@
-- - tables are type-annotated
-----------------------------------------------------------------------------
-module CheckGrammar where
+module CheckGrammar (showCheckModule, justCheckLTerm) where
import Grammar
import Ident
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index f555de440..3cbd680d8 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -1,18 +1,19 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Compile
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.33 $
--
-- The top-level compilation chain from source file to gfc\/gfr.
-----------------------------------------------------------------------------
-module Compile where
+module Compile (compileModule, compileEnvShSt, compileOne
+ ) where
import Grammar
import Ident
diff --git a/src/GF/Compile/Extend.hs b/src/GF/Compile/Extend.hs
index af6ff0c43..d7ec35684 100644
--- a/src/GF/Compile/Extend.hs
+++ b/src/GF/Compile/Extend.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Extend
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.15 $
--
-- AR 14\/5\/2003 -- 11\/11
--
@@ -15,7 +15,8 @@
-- extends a module symbol table by indirections to the module it extends
-----------------------------------------------------------------------------
-module Extend where
+module Extend (extendModule, extendMod
+ ) where
import Grammar
import Ident
diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs
index 415cea55e..7537ec88e 100644
--- a/src/GF/Compile/GetGrammar.hs
+++ b/src/GF/Compile/GetGrammar.hs
@@ -1,18 +1,20 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GetGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.14 $
--
-- this module builds the internal GF grammar that is sent to the type checker
-----------------------------------------------------------------------------
-module GetGrammar where
+module GetGrammar (getSourceModule, getOldGrammar, getCFGrammar, getEBNFGrammar,
+ err2err
+ ) where
import Operations
import qualified ErrM as E ----
diff --git a/src/GF/Compile/GrammarToCanon.hs b/src/GF/Compile/GrammarToCanon.hs
index 2b3e31250..ca3235a66 100644
--- a/src/GF/Compile/GrammarToCanon.hs
+++ b/src/GF/Compile/GrammarToCanon.hs
@@ -1,18 +1,20 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GrammarToCanon
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.16 $
--
-- Code generator from optimized GF source code to GFC.
-----------------------------------------------------------------------------
-module GrammarToCanon where
+module GrammarToCanon (showGFC,
+ redModInfo, redQIdent
+ ) where
import Operations
import Zipper
diff --git a/src/GF/Compile/MkResource.hs b/src/GF/Compile/MkResource.hs
index 5237fb9d8..9e8baf9ef 100644
--- a/src/GF/Compile/MkResource.hs
+++ b/src/GF/Compile/MkResource.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : MkResource
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:08 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
-- Compile a gfc module into a "reuse" gfr resource, interface, or instance.
-----------------------------------------------------------------------------
-module MkResource where
+module MkResource (makeReuse) where
import Grammar
import Ident
diff --git a/src/GF/Compile/MkUnion.hs b/src/GF/Compile/MkUnion.hs
index 6aefdbc75..83a1db627 100644
--- a/src/GF/Compile/MkUnion.hs
+++ b/src/GF/Compile/MkUnion.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : MkUnion
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- building union of modules.
-- AR 1\/3\/2004 --- OBSOLETE 15\/9\/2004 with multiple inheritance
diff --git a/src/GF/Compile/ModDeps.hs b/src/GF/Compile/ModDeps.hs
index bc47e23a5..eaf5d7daf 100644
--- a/src/GF/Compile/ModDeps.hs
+++ b/src/GF/Compile/ModDeps.hs
@@ -1,20 +1,24 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : ModDeps
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
-- Check correctness of module dependencies. Incomplete.
--
--- AR 13/5/2003
+-- AR 13\/5\/2003
-----------------------------------------------------------------------------
-module ModDeps where
+module ModDeps (mkSourceGrammar,
+ moduleDeps,
+ openInterfaces,
+ requiredCanModules
+ ) where
import Grammar
import Ident
diff --git a/src/GF/Compile/NewRename.hs b/src/GF/Compile/NewRename.hs
index 60d079915..e55d37594 100644
--- a/src/GF/Compile/NewRename.hs
+++ b/src/GF/Compile/NewRename.hs
@@ -1,15 +1,15 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : NewRename
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- AR 14/5/2003
+-- AR 14\/5\/2003
--
-- The top-level function 'renameGrammar' does several things:
--
@@ -23,7 +23,7 @@
-- Hence we can proceed by @fold@ing "from left to right".
-----------------------------------------------------------------------------
-module Rename where
+module Rename (renameSourceTerm, renameModule) where
import Grammar
import Values
diff --git a/src/GF/Compile/Optimize.hs b/src/GF/Compile/Optimize.hs
index 1b0d5e464..b342a5b3f 100644
--- a/src/GF/Compile/Optimize.hs
+++ b/src/GF/Compile/Optimize.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Optimize
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.13 $
--
-- Top-level partial evaluation for GF source modules.
-----------------------------------------------------------------------------
-module Optimize where
+module Optimize (optimizeModule) where
import Grammar
import Ident
diff --git a/src/GF/Compile/PGrammar.hs b/src/GF/Compile/PGrammar.hs
index 02259d30c..4381f4b2e 100644
--- a/src/GF/Compile/PGrammar.hs
+++ b/src/GF/Compile/PGrammar.hs
@@ -1,18 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module PGrammar where
+module PGrammar (pTerm, pTrm, pTrms,
+ pMeta, pzIdent,
+ string2ident
+ ) where
---import LexGF
import ParGF
diff --git a/src/GF/Compile/PrOld.hs b/src/GF/Compile/PrOld.hs
index cba3eb536..8c0132fe7 100644
--- a/src/GF/Compile/PrOld.hs
+++ b/src/GF/Compile/PrOld.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PrOld
+-- Maintainer : GF
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- a hack to print gf2 into gf1 readable files
-- Works only for canonical grammars, printed into GFC. Otherwise we would have
@@ -15,7 +15,7 @@
-- --- printnames are not preserved, nor are lindefs
-----------------------------------------------------------------------------
-module PrOld where
+module PrOld (printGrammarOld, stripTerm) where
import PrGrammar
import CanonToGrammar
@@ -59,6 +59,7 @@ stripInfo (c,i) = case i of
stripContext co = [(x, stripTerm t) | (x,t) <- co]
+stripTerm :: Term -> Term
stripTerm t = case t of
Q _ c -> Vr c
QC _ c -> Vr c
diff --git a/src/GF/Compile/Rebuild.hs b/src/GF/Compile/Rebuild.hs
index c40df28ff..1dee8624c 100644
--- a/src/GF/Compile/Rebuild.hs
+++ b/src/GF/Compile/Rebuild.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Rebuild
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.9 $
--
-- Rebuild a source module from incomplete and its with-instance.
-----------------------------------------------------------------------------
-module Rebuild where
+module Rebuild (rebuildModule) where
import Grammar
import ModDeps
diff --git a/src/GF/Compile/RemoveLiT.hs b/src/GF/Compile/RemoveLiT.hs
index 1c10bd9ab..55a9693c9 100644
--- a/src/GF/Compile/RemoveLiT.hs
+++ b/src/GF/Compile/RemoveLiT.hs
@@ -1,19 +1,19 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : RemoveLiT
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- remove obsolete (Lin C) expressions before doing anything else. AR 21/6/2003
--
-- What the program does is replace the occurrences of Lin C with the actual
-- definition T given in lincat C = T ; with {s : Str} if no lincat is found.
--- The procedule is uncertain, if T contains another Lin.
+-- The procedure is uncertain, if T contains another Lin.
-----------------------------------------------------------------------------
module RemoveLiT (removeLiT) where
diff --git a/src/GF/Compile/Rename.hs b/src/GF/Compile/Rename.hs
index 3f9533791..a8c73cdbe 100644
--- a/src/GF/Compile/Rename.hs
+++ b/src/GF/Compile/Rename.hs
@@ -1,15 +1,15 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Rename
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.17 $
--
--- AR 14/5/2003
+-- AR 14\/5\/2003
-- The top-level function 'renameGrammar' does several things:
--
-- - extends each module symbol table by indirections to extended module
@@ -22,7 +22,10 @@
-- Hence we can proceed by @fold@ing "from left to right".
-----------------------------------------------------------------------------
-module Rename where
+module Rename (renameGrammar,
+ renameSourceTerm,
+ renameModule
+ ) where
import Grammar
import Values
diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs
index 8db6aa789..1586674ca 100644
--- a/src/GF/Compile/ShellState.hs
+++ b/src/GF/Compile/ShellState.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : ShellState
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.35 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Compile/Update.hs b/src/GF/Compile/Update.hs
index 289e516b8..14c62ef42 100644
--- a/src/GF/Compile/Update.hs
+++ b/src/GF/Compile/Update.hs
@@ -1,18 +1,23 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Update
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:09 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Update where
+module Update (updateRes, buildAnyTree, combineAnyInfos, unifyAnyInfo,
+ -- * these auxiliaries should be somewhere else
+ -- since they don't use the info types
+ groupInfos, sortInfos, combineInfos, unifyInfos,
+ tryInsert, unifAbsDefs, unifConstrs
+ ) where
import Ident
import Grammar
diff --git a/src/GF/Data/ErrM.hs b/src/GF/Data/ErrM.hs
index 0c0759215..60dd1826d 100644
--- a/src/GF/Data/ErrM.hs
+++ b/src/GF/Data/ErrM.hs
@@ -1,20 +1,19 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : ErrM
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- hack for BNFC generated files. AR 21/9/2003
-----------------------------------------------------------------------------
-module ErrM (
- module Operations
-) where
+module ErrM (module Operations
+ ) where
import Operations
diff --git a/src/GF/Data/Glue.hs b/src/GF/Data/Glue.hs
index 7f8fb6a94..eaa7244f0 100644
--- a/src/GF/Data/Glue.hs
+++ b/src/GF/Data/Glue.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Glue
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- AR 8-11-2003, using Markus Forsberg's implementation of Huet's @unglue@
-----------------------------------------------------------------------------
diff --git a/src/GF/Data/Map.hs b/src/GF/Data/Map.hs
index 107a2f6c9..1130db2ac 100644
--- a/src/GF/Data/Map.hs
+++ b/src/GF/Data/Map.hs
@@ -5,24 +5,23 @@
-- Stability : Stable
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Map
- (
+module Map (
Map,
empty,
isEmpty,
- (!), -- lookup operator.
- (!+), -- lookupMany operator.
- (|->), -- insert operator.
- (|->+), -- insertMany operator.
- (<+>), -- union operator.
- flatten --
+ (!),
+ (!+),
+ (|->),
+ (|->+),
+ (<+>),
+ flatten
) where
import RedBlack
@@ -38,20 +37,25 @@ infixl 4 <+>
empty :: Map key el
empty = emptyTree
+-- | lookup operator.
(!) :: Ord key => Map key el -> key -> Maybe el
fm ! e = lookupTree e fm
+-- | lookupMany operator.
(!+) :: Ord key => Map key el -> [key] -> [Maybe el]
fm !+ [] = []
fm !+ (e:es) = (lookupTree e fm): (fm !+ es)
+-- | insert operator.
(|->) :: Ord key => (key,el) -> Map key el -> Map key el
(x,y) |-> fm = insertTree (x,y) fm
+-- | insertMany operator.
(|->+) :: Ord key => [(key,el)] -> Map key el -> Map key el
[] |->+ fm = fm
((x,y):xs) |->+ fm = xs |->+ (insertTree (x,y) fm)
+-- | union operator.
(<+>) :: Ord key => Map key el -> Map key el -> Map key el
(<+>) fm1 fm2 = xs |->+ fm2
where xs = flatten fm1
diff --git a/src/GF/Data/Operations.hs b/src/GF/Data/Operations.hs
index 1b656f52c..ca75de352 100644
--- a/src/GF/Data/Operations.hs
+++ b/src/GF/Data/Operations.hs
@@ -1,18 +1,79 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Operations
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.15 $
--
--- (Description of the module)
+-- some auxiliary GF operations. AR 19\/6\/1998 -- 6\/2\/2001
+--
+-- Copyright (c) Aarne Ranta 1998-2000, under GNU General Public License (see GPL)
-----------------------------------------------------------------------------
-module Operations where
+module Operations (-- * misc functions
+ ifNull, onSnd,
+
+ -- * the Error monad
+ Err(..), err, maybeErr, testErr, errVal, errIn, derrIn,
+ performOps, repeatUntilErr, repeatUntil, okError, isNotError,
+ showBad, lookupErr, lookupErrMsg, lookupDefault, updateLookupList,
+ mapPairListM, mapPairsM, pairM, mapErr, mapErrN, foldErr,
+ (!?), errList, singleton,
+
+ -- ** checking
+ checkUnique, titleIfNeeded, errMsg, errAndMsg,
+
+ -- * a three-valued maybe type to express indirections
+ Perhaps(..), yes, may, nope,
+ mapP,
+ unifPerhaps, updatePerhaps, updatePerhapsHard,
+
+ -- * binary search trees
+ BinTree(..), isInBinTree, commonsInTree, justLookupTree,
+ lookupTree, lookupTreeEq, lookupTreeMany, updateTree,
+ updateTreeGen, updateTreeEq, updatesTree, updatesTreeNondestr, buildTree,
+ sorted2tree, mapTree, mapMTree, tree2list,
+ depthTree, mergeTrees,
+
+ -- * parsing
+ WParser, wParseResults, paragraphs,
+
+ -- * printing
+ indent, (+++), (++-), (++++), (+++++),
+ prUpper, prReplicate, prTList, prQuotedString, prParenth, prCurly,
+ prBracket, prArgList, prSemicList, prCurlyList, restoreEscapes,
+ numberedParagraphs, prConjList, prIfEmpty, wrapLines,
+
+ -- ** LaTeX code producing functions
+ dollar, mbox, ital, boldf, verbat, mkLatexFile,
+ begindocument, enddocument,
+
+ -- * extra
+ sortByLongest, combinations, mkTextFile, initFilePath,
+
+ -- * topological sorting with test of cyclicity
+ topoTest, topoSort,
+
+ -- * the generic fix point iterator
+ iterFix,
+
+ -- * association lists
+ updateAssoc, removeAssoc,
+
+ -- * chop into separator-separated parts
+ chunks, readIntArg,
+
+ -- * state monad with error; from Agda 6\/11\/2001
+ STM(..), appSTM, stm, stmr, readSTM, updateSTM, writeSTM, done,
+
+ -- * error monad class
+ ErrorMonad(..), checkAgain, checks, allChecks
+
+ ) where
import Char (isSpace, toUpper, isSpace, isDigit)
import List (nub, sortBy, sort, deleteBy, nubBy)
@@ -24,9 +85,6 @@ infixr 5 ++++
infixr 5 +++++
infixl 9 !?
--- some auxiliary GF operations. AR 19/6/1998 -- 6/2/2001
--- Copyright (c) Aarne Ranta 1998-2000, under GNU General Public License (see GPL)
-
ifNull :: b -> ([a] -> b) -> [a] -> b
ifNull b f xs = if null xs then b else f xs
@@ -35,7 +93,8 @@ onSnd f (x, y) = (x, f y)
-- the Error monad
-data Err a = Ok a | Bad String -- like Maybe type with error msgs
+-- | like @Maybe@ type with error msgs
+data Err a = Ok a | Bad String
deriving (Read, Show, Eq)
instance Monad Err where
@@ -43,17 +102,18 @@ instance Monad Err where
Ok a >>= f = f a
Bad s >>= f = Bad s
-instance Functor Err where -- added 2/10/2003 by PEB
+-- | added 2\/10\/2003 by PEB
+instance Functor Err where
fmap f (Ok a) = Ok (f a)
fmap f (Bad s) = Bad s
--- analogue of maybe
+-- | analogue of @maybe@
err :: (String -> b) -> (a -> b) -> Err a -> b
err d f e = case e of
Ok a -> f a
Bad s -> d s
--- add msg s to Maybe failures
+-- | add msg s to @Maybe@ failures
maybeErr :: String -> Maybe a -> Err a
maybeErr s = maybe (Bad s) Ok
@@ -66,7 +126,7 @@ errVal a = err (const a) id
errIn :: String -> Err a -> Err a
errIn msg = err (\s -> Bad (s ++++ "OCCURRED IN" ++++ msg)) return
--- used for extra error reports when developing GF
+-- | used for extra error reports when developing GF
derrIn :: String -> Err a -> Err a
derrIn m = errIn m -- id
@@ -121,14 +181,14 @@ mapPairsM f xys =
pairM :: Monad a => (b -> a c) -> (b,b) -> a (c,c)
pairM op (t1,t2) = liftM2 (,) (op t1) (op t2)
--- like mapM, but continue instead of halting with Err
+-- | like @mapM@, but continue instead of halting with 'Err'
mapErr :: (a -> Err b) -> [a] -> Err ([b], String)
mapErr f xs = Ok (ys, unlines ss)
where
(ys,ss) = ([y | Ok y <- fxs], [s | Bad s <- fxs])
fxs = map f xs
--- alternative variant, peb 9/6-04
+-- | alternative variant, peb 9\/6-04
mapErrN :: Int -> (a -> Err b) -> [a] -> Err ([b], String)
mapErrN maxN f xs = Ok (ys, unlines (errHdr : ss2))
where
@@ -139,8 +199,7 @@ mapErrN maxN f xs = Ok (ys, unlines (errHdr : ss2))
nss = length ss
fxs = map f xs
--- like foldM, but also return the latest value if fails
-
+-- | like @foldM@, but also return the latest value if fails
foldErr :: (a -> b -> Err a) -> a -> [b] -> Err (a, Maybe String)
foldErr f s xs = case xs of
[] -> return (s,Nothing)
@@ -148,7 +207,7 @@ foldErr f s xs = case xs of
Ok v -> foldErr f v xx
Bad m -> return $ (s, Just m)
--- !! with the error monad
+-- @!!@ with the error monad
(!?) :: [a] -> Int -> Err a
xs !? i = foldr (const . return) (Bad "too few elements in list") $ drop i xs
@@ -177,8 +236,7 @@ errAndMsg :: Err a -> Err (a,[String])
errAndMsg (Bad m) = Bad m
errAndMsg (Ok a) = return (a,[])
--- a three-valued maybe type to express indirections
-
+-- | a three-valued maybe type to express indirections
data Perhaps a b = Yes a | May b | Nope deriving (Show,Read,Eq,Ord)
yes = Yes
@@ -191,7 +249,7 @@ mapP f p = case p of
May b -> May b
Nope -> Nope
--- this is what happens when matching two values in the same module
+-- | this is what happens when matching two values in the same module
unifPerhaps :: (Eq a, Eq b, Show a, Show b) =>
Perhaps a b -> Perhaps a b -> Err (Perhaps a b)
unifPerhaps p1 p2 = case (p1,p2) of
@@ -200,7 +258,7 @@ unifPerhaps p1 p2 = case (p1,p2) of
_ -> if p1==p2 then return p1
else Bad ("update conflict between" ++++ show p1 ++++ show p2)
--- this is what happens when updating a module extension
+-- | this is what happens when updating a module extension
updatePerhaps :: (Eq a,Eq b, Show a, Show b) =>
b -> Perhaps a b -> Perhaps a b -> Err (Perhaps a b)
updatePerhaps old p1 p2 = case (p1,p2) of
@@ -209,7 +267,7 @@ updatePerhaps old p1 p2 = case (p1,p2) of
(_, May a) -> Bad "strange indirection"
_ -> unifPerhaps p1 p2
--- here the value is copied instead of referred to; used for oper types
+-- | here the value is copied instead of referred to; used for oper types
updatePerhapsHard :: (Eq a, Eq b, Show a, Show b) => b ->
Perhaps a b -> Perhaps a b -> Err (Perhaps a b)
updatePerhapsHard old p1 p2 = case (p1,p2) of
@@ -230,9 +288,9 @@ isInBinTree x tree = case tree of
| x > a -> isInBinTree x right
| x == a -> True
--- quick method to see if two trees have common elements
+-- | quick method to see if two trees have common elements
+--
-- the complexity is O(log |old|, |new|) so the heuristic is that new is smaller
-
commonsInTree :: (Ord a) => BinTree (a,b) -> BinTree (a,b) -> [(a,(b,b))]
commonsInTree old new = foldr inOld [] new' where
new' = tree2list new
@@ -266,13 +324,11 @@ lookupTreeMany pr (t:ts) x = case lookupTree pr x t of
_ -> lookupTreeMany pr ts x
lookupTreeMany pr [] x = Bad $ "failed to find" +++ pr x
--- destructive update
-
+-- | destructive update
updateTree :: (Ord a) => (a,b) -> BinTree (a,b) -> BinTree (a,b)
updateTree = updateTreeGen True
--- destructive or not
-
+-- | destructive or not
updateTreeGen :: (Ord a) => Bool -> (a,b) -> BinTree (a,b) -> BinTree (a,b)
updateTreeGen destr z@(x,y) tree = case tree of
NT -> BT z NT NT
@@ -419,8 +475,7 @@ prIfEmpty :: String -> String -> String -> String -> String
prIfEmpty em _ _ [] = em
prIfEmpty em nem1 nem2 s = nem1 ++ s ++ nem2
--- Thomas Hallgren's wrap lines
---- optWrapLines = if argFlag "wraplines" True then wrapLines 0 else id
+-- | Thomas Hallgren's wrap lines
wrapLines n "" = ""
wrapLines n s@(c:cs) =
if isSpace c
@@ -433,6 +488,8 @@ wrapLines n s@(c:cs) =
l = length w
_ -> s -- give up!!
+--- optWrapLines = if argFlag "wraplines" True then wrapLines 0 else id
+
-- LaTeX code producing functions
dollar s = '$' : s ++ "$"
@@ -468,8 +525,8 @@ sortByLongest = sortBy longer where
x' = length x
y' = length y
--- "combinations" is the same as "sequence"!!!
--- peb 30/5-04
+-- | 'combinations' is the same as @sequence@!!!
+-- peb 30\/5-04
combinations :: [[a]] -> [[a]]
combinations t = case t of
[] -> [[]]
@@ -527,8 +584,7 @@ topoSort g = reverse $ tsort 0 [ffs | ffs@(f,_) <- g, inDeg f == 0] [] where
inDeg f = length [t | (h,hs) <- g, t <- hs, t == f]
lx = length g
--- the generic fix point iterator
-
+-- | the generic fix point iterator
iterFix :: Eq a => ([a] -> [a]) -> [a] -> [a]
iterFix more start = iter start start
where
@@ -549,8 +605,7 @@ updateAssoc ab@(a,b) as = case as of
removeAssoc :: Eq a => a -> [(a,b)] -> [(a,b)]
removeAssoc a = filter ((/=a) . fst)
--- chop into separator-separated parts
-
+-- | chop into separator-separated parts
chunks :: String -> [String] -> [[String]]
chunks sep ws = case span (/= sep) ws of
(a,_:b) -> a : bs where bs = chunks sep b
@@ -608,7 +663,8 @@ instance ErrorMonad (STM s) where
handle (STM f) g = STM (\s -> (f s)
`handle` (\e -> let STM g' = (g e) in
g' s))
--- if the first check fails try another one
+
+-- | if the first check fails try another one
checkAgain :: ErrorMonad m => m a -> m a -> m a
checkAgain c1 c2 = handle_ c1 c2
diff --git a/src/GF/Data/OrdMap2.hs b/src/GF/Data/OrdMap2.hs
index 2d0f58f51..2fba5ac10 100644
--- a/src/GF/Data/OrdMap2.hs
+++ b/src/GF/Data/OrdMap2.hs
@@ -5,16 +5,16 @@
-- Stability : Obsolete
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- The class of finite maps, as described in
--- "Pure Functional Parsing", section 2.2.2
+-- \"Pure Functional Parsing\", section 2.2.2
-- and an example implementation,
-- derived from appendix A.2
--
--- /OBSOLETE/! this is only used in cf\/ChartParser.hs
+-- /OBSOLETE/! this is only used in module "ChartParser"
-----------------------------------------------------------------------------
module OrdMap2 (OrdMap(..), Map) where
diff --git a/src/GF/Data/OrdSet.hs b/src/GF/Data/OrdSet.hs
index f2a1ec115..526d5a53d 100644
--- a/src/GF/Data/OrdSet.hs
+++ b/src/GF/Data/OrdSet.hs
@@ -5,16 +5,16 @@
-- Stability : Obsolete
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- The class of ordered sets, as described in
--- "Pure Functional Parsing", section 2.2.1,
+-- \"Pure Functional Parsing\", section 2.2.1,
-- and an example implementation
-- derived from appendix A.1
--
--- /OBSOLETE/! this is only used in cf\/ChartParser.hs
+-- /OBSOLETE/! this is only used in module "ChartParser"
-----------------------------------------------------------------------------
module OrdSet (OrdSet(..), Set) where
diff --git a/src/GF/Data/Parsers.hs b/src/GF/Data/Parsers.hs
index 357868217..8804c55f3 100644
--- a/src/GF/Data/Parsers.hs
+++ b/src/GF/Data/Parsers.hs
@@ -5,16 +5,31 @@
-- Stability : Almost Obsolete
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- some parser combinators a` la Wadler and Hutton
+-- some parser combinators a la Wadler and Hutton.
-- no longer used in many places in GF
--- (only used in EBNF.hs)
+-- (only used in module "EBNF")
-----------------------------------------------------------------------------
-module Parsers where
+module Parsers (-- * Main types and functions
+ Parser, parseResults, parseResultErr,
+ -- * Basic combinators (on any token type)
+ (...), (.>.), (|||), (+||), literal, (***),
+ succeed, fails, (+..), (..+), (<<<), (|>),
+ many, some, longestOfMany, longestOfSome,
+ closure,
+ -- * Specific combinators (for @Char@ token type)
+ pJunk, pJ, jL, pTList, pTJList, pElem,
+ (....), item, satisfy, literals, lits,
+ pParenth, pCommaList, pOptCommaList,
+ pArgList, pArgList2,
+ pIdent, pLetter, pDigit, pLetters,
+ pAlphanum, pAlphaPlusChar,
+ pQuotedString, pIntc
+ ) where
import Operations
import Char
diff --git a/src/GF/Data/RedBlack.hs b/src/GF/Data/RedBlack.hs
index 635cbe3ad..309f6b601 100644
--- a/src/GF/Data/RedBlack.hs
+++ b/src/GF/Data/RedBlack.hs
@@ -5,9 +5,9 @@
-- Stability : Stable
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- Modified version of Osanaki's implementation.
-----------------------------------------------------------------------------
diff --git a/src/GF/Data/SharedString.hs b/src/GF/Data/SharedString.hs
index 55a676015..b92475881 100644
--- a/src/GF/Data/SharedString.hs
+++ b/src/GF/Data/SharedString.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module SharedString (shareString) where
diff --git a/src/GF/Data/Str.hs b/src/GF/Data/Str.hs
index 743d9edc9..bf92c83ed 100644
--- a/src/GF/Data/Str.hs
+++ b/src/GF/Data/Str.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Str
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
@@ -23,23 +23,23 @@ module Str (
import Operations
import List (isPrefixOf, isSuffixOf, intersperse)
--- abstract token list type. AR 2001, revised and simplified 20/4/2003
-
+-- | abstract token list type. AR 2001, revised and simplified 20\/4\/2003
newtype Str = Str [Tok] deriving (Read, Show, Eq, Ord)
data Tok =
TK String
- | TN Ss [(Ss, [String])] -- variants depending on next string
+ | TN Ss [(Ss, [String])] -- ^ variants depending on next string
--- | TP Ss [(Ss, [String])] -- variants depending on previous string
deriving (Eq, Ord, Show, Read)
-
--- notice that having both pre and post would leave to inconsistent situations:
--- pre {"x" ; "y" / "a"} ++ post {"b" ; "a" / "x"}
+-- ^ notice that having both pre and post would leave to inconsistent situations:
+--
+-- > pre {"x" ; "y" / "a"} ++ post {"b" ; "a" / "x"}
+--
-- always violates a condition expressed by the one or the other
--- a variant can itself be a token list, but for simplicity only a list of strings
--- i.e. not itself containing variants
+-- | a variant can itself be a token list, but for simplicity only a list of strings
+-- i.e. not itself containing variants
type Ss = [String]
-- matching functions in both ways
@@ -80,8 +80,7 @@ str2allStrings (Str st) = alls st where
sstr :: Str -> String
sstr = unwords . str2strings
--- to handle a list of variants
-
+-- | to handle a list of variants
sstrV :: [Str] -> String
sstrV ss = case ss of
[] -> "*"
@@ -127,8 +126,7 @@ glues ss tt = case (ss,tt) of
(_,[]) -> ss
_ -> init ss ++ [last ss ++ head tt] ++ tail tt
--- to create the list of all lexical items
-
+-- | to create the list of all lexical items
allItems :: Str -> [String]
allItems (Str s) = concatMap allOne s where
allOne t = case t of
diff --git a/src/GF/Data/Trie.hs b/src/GF/Data/Trie.hs
index e32b8560d..6c0e2933f 100644
--- a/src/GF/Data/Trie.hs
+++ b/src/GF/Data/Trie.hs
@@ -2,12 +2,12 @@
-- |
-- Module : Trie
-- Maintainer : Markus Forsberg
--- Stability : Obsolete???
+-- Stability : Obsolete
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Data/Trie2.hs b/src/GF/Data/Trie2.hs
index 08a6531be..bdd2b84b8 100644
--- a/src/GF/Data/Trie2.hs
+++ b/src/GF/Data/Trie2.hs
@@ -5,9 +5,9 @@
-- Stability : Stable
-- Portability : Haskell 98
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Data/Zipper.hs b/src/GF/Data/Zipper.hs
index 6d3766c51..c56552104 100644
--- a/src/GF/Data/Zipper.hs
+++ b/src/GF/Data/Zipper.hs
@@ -1,18 +1,57 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Zipper
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
--- Gérard Huet's zipper (JFP 7 (1997)). AR 10/8/2001
+-- Gérard Huet's zipper (JFP 7 (1997)). AR 10\/8\/2001
-----------------------------------------------------------------------------
-module Zipper where
+module Zipper (-- * types
+ Tr(..),
+ Path(..),
+ Loc(..),
+ -- * basic (original) functions
+ leaf,
+ goLeft, goRight, goUp, goDown,
+ changeLoc,
+ changeNode,
+ forgetNode,
+ -- * added sequential representation
+ goAhead,
+ goBack,
+ -- ** n-ary versions
+ goAheadN,
+ goBackN,
+ -- * added mappings between locations and trees
+ loc2tree,
+ loc2treeMarked,
+ tree2loc,
+ goRoot,
+ goLast,
+ goPosition,
+ -- * added some utilities
+ traverseCollect,
+ scanTree,
+ mapTr,
+ mapTrM,
+ mapPath,
+ mapPathM,
+ mapLoc,
+ mapLocM,
+ foldTr,
+ foldTrM,
+ mapSubtrees,
+ mapSubtreesM,
+ changeRoot,
+ nthSubtree,
+ arityTree
+ ) where
import Operations
@@ -56,7 +95,7 @@ forgetNode _ = Bad $ "not a one-branch tree"
-- added sequential representation
--- a successor function
+-- | a successor function
goAhead :: Loc a -> Err (Loc a)
goAhead s@(Loc (t,p)) = case (t,p) of
(Tr (_,_:_),Node (_,_,_:_)) -> goDown s
@@ -67,7 +106,7 @@ goAhead s@(Loc (t,p)) = case (t,p) of
Ok t' -> return t'
Bad _ -> goUp t >>= upsRight
--- a predecessor function
+-- | a predecessor function
goBack :: Loc a -> Err (Loc a)
goBack s@(Loc (t,p)) = case goLeft s of
Ok s' -> downRight s'
@@ -183,7 +222,7 @@ mapSubtreesM f t = do
ts' <- mapM (mapSubtreesM f) ts
return $ Tr (x, ts')
--- change the root without moving the pointer
+-- | change the root without moving the pointer
changeRoot :: (a -> a) -> Loc a -> Loc a
changeRoot f loc = case loc of
Loc (Tr (a,ts),Top) -> Loc (Tr (f a,ts),Top)
@@ -197,4 +236,4 @@ nthSubtree :: Int -> Tr a -> Err (Tr a)
nthSubtree n (Tr (a,ts)) = ts !? n
arityTree :: Tr a -> Int
-arityTree (Tr (_,ts)) = length ts \ No newline at end of file
+arityTree (Tr (_,ts)) = length ts
diff --git a/src/GF/Fudgets/ArchEdit.hs b/src/GF/Fudgets/ArchEdit.hs
index 9d8e905e0..74b31b5a9 100644
--- a/src/GF/Fudgets/ArchEdit.hs
+++ b/src/GF/Fudgets/ArchEdit.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:10 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Fudgets/CommandF.hs b/src/GF/Fudgets/CommandF.hs
index 69dcac051..568e82856 100644
--- a/src/GF/Fudgets/CommandF.hs
+++ b/src/GF/Fudgets/CommandF.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Fudgets/EventF.hs b/src/GF/Fudgets/EventF.hs
index 9c2ba19ee..f517ab22e 100644
--- a/src/GF/Fudgets/EventF.hs
+++ b/src/GF/Fudgets/EventF.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : EventF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
@@ -15,12 +15,13 @@
module EventF where
import AllFudgets
--- The first string is the name of the key (e.g., "Down" for the down arrow key)
+-- | The first string is the name of the key (e.g., "Down" for the down arrow key)
+--
-- The modifiers list shift, control and alt keys that were active while the
-- key was pressed.
+--
-- The last string is the text produced by the key (for keys that produce
-- printable characters, empty for control keys).
-
type KeyPress = ((String,[Modifiers]),String)
keyboardF :: F i o -> F i (Either KeyPress o)
@@ -34,10 +35,10 @@ keyboardF fud = idRightSP (concatMapSP post) >^^=< oeventF mask fud
EnterWindowMask, LeaveWindowMask -- because of CTT implementation
]
--- Output events:
+-- | Output events:
oeventF em fud = eventF em (idLeftF fud)
--- Feed events to argument fudget:
+-- | Feed events to argument fudget:
eventF eventmask = serCompLeftToRightF . groupF startcmds eventK
where
startcmds = [XCmd $ ChangeWindowAttributes [CWEventMask eventmask],
diff --git a/src/GF/Fudgets/FudgetOps.hs b/src/GF/Fudgets/FudgetOps.hs
index 2c1847105..ac50d3e77 100644
--- a/src/GF/Fudgets/FudgetOps.hs
+++ b/src/GF/Fudgets/FudgetOps.hs
@@ -1,23 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : FudgetOps
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
--- (Description of the module)
+-- auxiliary Fudgets for GF syntax editor
-----------------------------------------------------------------------------
module FudgetOps where
import Fudgets
--- auxiliary Fudgets for GF syntax editor
-
-- save and display
showAndSaveF fud = (writeFileF >+< textWindowF) >==< saveF fud
@@ -35,7 +33,7 @@ saveSP contents = getSP $ \msg -> case msg of
textWindowF = writeOutputF
--- to replace stringInputF by a pop-up slot behind a button
+-- | to replace stringInputF by a pop-up slot behind a button
popupStringInputF :: String -> String -> String -> F String String
popupStringInputF label deflt msg =
mapF snd
diff --git a/src/GF/Fudgets/UnicodeF.hs b/src/GF/Fudgets/UnicodeF.hs
index cd307d4ae..23ba29a2b 100644
--- a/src/GF/Fudgets/UnicodeF.hs
+++ b/src/GF/Fudgets/UnicodeF.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : UnicodeF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module UnicodeF where
+module UnicodeF (fudlogueWriteU) where
import Fudgets
import Operations
diff --git a/src/GF/Grammar/AbsCompute.hs b/src/GF/Grammar/AbsCompute.hs
index 2cf795ec1..da90f645d 100644
--- a/src/GF/Grammar/AbsCompute.hs
+++ b/src/GF/Grammar/AbsCompute.hs
@@ -1,18 +1,25 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : AbsCompute
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
--- (Description of the module)
+-- computation in abstract syntax w.r.t. explicit definitions.
+--
+-- old GF computation; to be updated
-----------------------------------------------------------------------------
-module AbsCompute where
+module AbsCompute (LookDef,
+ compute,
+ computeAbsTerm,
+ computeAbsTermIn,
+ beta
+ ) where
import Operations
@@ -24,16 +31,13 @@ import Compute
import Monad (liftM, liftM2)
--- computation in abstract syntax w.r.t. explicit definitions.
---- old GF computation; to be updated
-
compute :: GFCGrammar -> Exp -> Err Exp
compute = computeAbsTerm
computeAbsTerm :: GFCGrammar -> Exp -> Err Exp
computeAbsTerm gr = computeAbsTermIn (lookupAbsDef gr) []
---- a hack to make compute work on source grammar as well
+-- | a hack to make compute work on source grammar as well
type LookDef = Ident -> Ident -> Err (Maybe Term)
computeAbsTermIn :: LookDef -> [Ident] -> Exp -> Err Exp
diff --git a/src/GF/Grammar/Abstract.hs b/src/GF/Grammar/Abstract.hs
index eb7740ecc..dda7b3492 100644
--- a/src/GF/Grammar/Abstract.hs
+++ b/src/GF/Grammar/Abstract.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Abstract
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Grammar/AppPredefined.hs b/src/GF/Grammar/AppPredefined.hs
index e640feaf2..6b0e57a56 100644
--- a/src/GF/Grammar/AppPredefined.hs
+++ b/src/GF/Grammar/AppPredefined.hs
@@ -1,18 +1,19 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : AppPredefined
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.9 $
--
-- Predefined function type signatures and definitions.
-----------------------------------------------------------------------------
-module AppPredefined where
+module AppPredefined (isInPredefined, typPredefined, appPredefined
+ ) where
import Operations
import Grammar
diff --git a/src/GF/Grammar/Compute.hs b/src/GF/Grammar/Compute.hs
index 50f640b71..8f1920b72 100644
--- a/src/GF/Grammar/Compute.hs
+++ b/src/GF/Grammar/Compute.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Compute
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.13 $
--
--- Computation of source terms. Used in compilation and in 'cc' command.
+-- Computation of source terms. Used in compilation and in @cc@ command.
-----------------------------------------------------------------------------
-module Compute where
+module Compute (computeConcrete, computeTerm) where
import Operations
import Grammar
@@ -31,9 +31,8 @@ import AppPredefined
import List (nub,intersperse)
import Monad (liftM2, liftM)
--- computation of concrete syntax terms into normal form
+-- | computation of concrete syntax terms into normal form
-- used mainly for partial evaluation
-
computeConcrete :: SourceGrammar -> Term -> Err Term
computeConcrete g t = {- refreshTerm t >>= -} computeTerm g [] t
@@ -295,8 +294,7 @@ computeTerm gr = comp where
cs' <- mapM (compBranch g) [(p, f v) | (p,v) <- cs]
return $ S (T i cs') e
--- argument variables cannot be glued
-
+-- | argument variables cannot be glued
checkNoArgVars :: Term -> Err Term
checkNoArgVars t = case t of
Vr (IA _) -> Bad $ glueErrorMsg $ prt t
diff --git a/src/GF/Grammar/Grammar.hs b/src/GF/Grammar/Grammar.hs
index 8ab2356d2..f6ae9249f 100644
--- a/src/GF/Grammar/Grammar.hs
+++ b/src/GF/Grammar/Grammar.hs
@@ -1,18 +1,54 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Grammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- GF source abstract syntax used internally in compilation.
+--
+-- AR 23\/1\/2000 -- 30\/5\/2001 -- 4\/5\/2003
-----------------------------------------------------------------------------
-module Grammar where
+module Grammar (SourceGrammar,
+ SourceModInfo,
+ SourceModule,
+ SourceAbs,
+ SourceRes,
+ SourceCnc,
+ Info(..),
+ Perh,
+ MPr,
+ Type,
+ Cat,
+ Fun,
+ QIdent,
+ Term(..),
+ Patt(..),
+ TInfo(..),
+ Label(..),
+ MetaSymb(..),
+ Decl,
+ Context,
+ Equation,
+ Labelling,
+ Assign,
+ Case,
+ Cases,
+ LocalDef,
+ Param,
+ Altern,
+ Substitution,
+ Branch(..),
+ Con,
+ Trm,
+ wildPatt,
+ varLabel
+ ) where
import Str
import Ident
@@ -21,10 +57,7 @@ import Modules
import Operations
--- AR 23/1/2000 -- 30/5/2001 -- 4/5/2003
-
--- grammar as presented to the compiler
-
+-- | grammar as presented to the compiler
type SourceGrammar = MGrammar Ident Option Info
type SourceModInfo = ModInfo Ident Option Info
@@ -35,29 +68,39 @@ type SourceAbs = Module Ident Option Info
type SourceRes = Module Ident Option Info
type SourceCnc = Module Ident Option Info
--- judgements in abstract syntax
-
+-- | the constructors are judgements in
+--
+-- - abstract syntax (/ABS/)
+--
+-- - resource (/RES/)
+--
+-- - concrete syntax (/CNC/)
+--
+-- and indirection to module (/INDIR/)
data Info =
- AbsCat (Perh Context) (Perh [Term]) -- constructors; must be Id or QId
- | AbsFun (Perh Type) (Perh Term) -- Yes f = canonical
- | AbsTrans Term
+-- judgements in abstract syntax
+ AbsCat (Perh Context) (Perh [Term]) -- ^ (/ABS/) constructors; must be 'Id' or 'QId'
+ | AbsFun (Perh Type) (Perh Term) -- ^ (/ABS/) 'Yes f' = canonical
+ | AbsTrans Term -- ^ (/ABS/)
-- judgements in resource
- | ResParam (Perh [Param])
- | ResValue (Perh Type) -- to mark parameter constructors for lookup
- | ResOper (Perh Type) (Perh Term)
+ | ResParam (Perh [Param]) -- ^ (/RES/)
+ | ResValue (Perh Type) -- ^ (/RES/) to mark parameter constructors for lookup
+ | ResOper (Perh Type) (Perh Term) -- ^ (/RES/)
-- judgements in concrete syntax
- | CncCat (Perh Type) (Perh Term) MPr -- lindef ini'zed,
- | CncFun (Maybe (Ident,(Context,Type))) (Perh Term) MPr -- type info added at TC
+ | CncCat (Perh Type) (Perh Term) MPr -- ^ (/CNC/) lindef ini'zed,
+ | CncFun (Maybe (Ident,(Context,Type))) (Perh Term) MPr -- (/CNC/) type info added at 'TC'
--- indirection to module Ident; the Bool says if canonical
- | AnyInd Bool Ident
+-- indirection to module Ident
+ | AnyInd Bool Ident -- ^ (/INDIR/) the 'Bool' says if canonical
deriving (Read, Show)
-type Perh a = Perhaps a Ident -- to express indirection to other module
+-- | to express indirection to other module
+type Perh a = Perhaps a Ident
-type MPr = Perhaps Term Ident -- printname
+-- | printname
+type MPr = Perhaps Term Ident
type Type = Term
type Cat = QIdent
@@ -66,80 +109,81 @@ type Fun = QIdent
type QIdent = (Ident,Ident)
data Term =
- Vr Ident -- variable
- | Cn Ident -- constant
- | Con Ident -- constructor
- | EData -- to mark in definition that a fun is a constructor
- | Sort String -- basic type
- | EInt Int -- integer literal
- | K String -- string literal or token: "foo"
- | Empty -- the empty string []
-
- | App Term Term -- application: f a
- | Abs Ident Term -- abstraction: \x -> b
- | Meta MetaSymb -- metavariable: ?i (only parsable: ? = ?0)
- | Prod Ident Term Term -- function type: (x : A) -> B
- | Eqs [Equation] -- abstraction by cases: fn {x y -> b ; z u -> c}
+ Vr Ident -- ^ variable
+ | Cn Ident -- ^ constant
+ | Con Ident -- ^ constructor
+ | EData -- ^ to mark in definition that a fun is a constructor
+ | Sort String -- ^ basic type
+ | EInt Int -- ^ integer literal
+ | K String -- ^ string literal or token: @\"foo\"@
+ | Empty -- ^ the empty string @[]@
+
+ | App Term Term -- ^ application: @f a@
+ | Abs Ident Term -- ^ abstraction: @\x -> b@
+ | Meta MetaSymb -- ^ metavariable: @?i@ (only parsable: ? = ?0)
+ | Prod Ident Term Term -- ^ function type: @(x : A) -> B@
+ | Eqs [Equation] -- ^ abstraction by cases: @fn {x y -> b ; z u -> c}@
-- only used in internal representation
- | Typed Term Term -- type-annotated term
-
--- below this only for concrete syntax
- | RecType [Labelling] -- record type: { p : A ; ...}
- | R [Assign] -- record: { p = a ; ...}
- | P Term Label -- projection: r.p
- | ExtR Term Term -- extension: R ** {x : A} (both types and terms)
+ | Typed Term Term -- ^ type-annotated term
+--
+-- /below this, the constructors are only for concrete syntax/
+ | RecType [Labelling] -- ^ record type: @{ p : A ; ...}@
+ | R [Assign] -- ^ record: @{ p = a ; ...}@
+ | P Term Label -- ^ projection: @r.p@
+ | ExtR Term Term -- ^ extension: @R ** {x : A}@ (both types and terms)
- | Table Term Term -- table type: P => A
- | T TInfo [Case] -- table: table {p => c ; ...}
- | TSh TInfo [Cases] -- table with discjunctive patters (only back end opt)
- | V Type [Term] -- table given as course of values: table T [c1 ; ... ; cn]
- | S Term Term -- selection: t ! p
-
- | Let LocalDef Term -- local definition: let {t : T = a} in b
+ | Table Term Term -- ^ table type: @P => A@
+ | T TInfo [Case] -- ^ table: @table {p => c ; ...}@
+ | TSh TInfo [Cases] -- ^ table with discjunctive patters (only back end opt)
+ | V Type [Term] -- ^ table given as course of values: @table T [c1 ; ... ; cn]@
+ | S Term Term -- ^ selection: @t ! p@
- | Alias Ident Type Term -- constant and its definition, used in inlining
+ | Let LocalDef Term -- ^ local definition: @let {t : T = a} in b@
- | Q Ident Ident -- qualified constant from a package
- | QC Ident Ident -- qualified constructor from a package
+ | Alias Ident Type Term -- ^ constant and its definition, used in inlining
- | C Term Term -- concatenation: s ++ t
- | Glue Term Term -- agglutination: s + t
+ | Q Ident Ident -- ^ qualified constant from a package
+ | QC Ident Ident -- ^ qualified constructor from a package
- | FV [Term] -- alternatives in free variation: variants { s ; ... }
+ | C Term Term -- ^ concatenation: @s ++ t@
+ | Glue Term Term -- ^ agglutination: @s + t@
- | Alts (Term, [(Term, Term)]) -- alternatives by prefix: pre {t ; s/c ; ...}
- | Strs [Term] -- conditioning prefix strings: strs {s ; ...}
+ | FV [Term] -- ^ alternatives in free variation: @variants { s ; ... }@
- --- these three are obsolete
- | LiT Ident -- linearization type
- | Ready Str -- result of compiling; not to be parsed ...
- | Computed Term -- result of computing: not to be reopened nor parsed
+ | Alts (Term, [(Term, Term)]) -- ^ alternatives by prefix: @pre {t ; s\/c ; ...}@
+ | Strs [Term] -- ^ conditioning prefix strings: @strs {s ; ...}@
+--
+-- /below this, the last three constructors are obsolete/
+ | LiT Ident -- ^ linearization type
+ | Ready Str -- ^ result of compiling; not to be parsed ...
+ | Computed Term -- ^ result of computing: not to be reopened nor parsed
deriving (Read, Show, Eq, Ord)
data Patt =
- PC Ident [Patt] -- constructor pattern: C p1 ... pn C
- | PP Ident Ident [Patt] -- package constructor pattern: P.C p1 ... pn P.C
- | PV Ident -- variable pattern: x
- | PW -- wild card pattern: _
- | PR [(Label,Patt)] -- record pattern: {r = p ; ...} -- only concrete
- | PString String -- string literal pattern: "foo" -- only abstract
- | PInt Int -- integer literal pattern: 12 -- only abstract
- | PT Type Patt -- type-annotated pattern
+ PC Ident [Patt] -- ^ constructor pattern: @C p1 ... pn@ @C@
+ | PP Ident Ident [Patt] -- ^ package constructor pattern: @P.C p1 ... pn@ @P.C@
+ | PV Ident -- ^ variable pattern: @x@
+ | PW -- ^ wild card pattern: @_@
+ | PR [(Label,Patt)] -- ^ record pattern: @{r = p ; ...}@ -- only concrete
+ | PString String -- ^ string literal pattern: @\"foo\"@ -- only abstract
+ | PInt Int -- ^ integer literal pattern: @12@ -- only abstract
+ | PT Type Patt -- ^ type-annotated pattern
deriving (Read, Show, Eq, Ord)
--- to guide computation and type checking of tables
+-- | to guide computation and type checking of tables
data TInfo =
- TRaw -- received from parser; can be anything
- | TTyped Type -- type annontated, but can be anything
- | TComp Type -- expanded
- | TWild Type -- just one wild card pattern, no need to expand
+ TRaw -- ^ received from parser; can be anything
+ | TTyped Type -- ^ type annontated, but can be anything
+ | TComp Type -- ^ expanded
+ | TWild Type -- ^ just one wild card pattern, no need to expand
deriving (Read, Show, Eq, Ord)
+-- | record label
data Label =
LIdent String
| LVar Int
- deriving (Read, Show, Eq, Ord) -- record label
+ deriving (Read, Show, Eq, Ord)
newtype MetaSymb = MetaSymb Int deriving (Read, Show, Eq, Ord)
@@ -158,10 +202,11 @@ type Altern = (Term, [(Term, Term)])
type Substitution = [(Ident, Term)]
--- branches à la Alfa
+-- | branches à la Alfa
newtype Branch = Branch (Con,([Ident],Term)) deriving (Eq, Ord,Show,Read)
type Con = Ident ---
+varLabel :: Int -> Label
varLabel = LVar
wildPatt :: Patt
diff --git a/src/GF/Grammar/Lockfield.hs b/src/GF/Grammar/Lockfield.hs
index f7ec081bd..6ad6db206 100644
--- a/src/GF/Grammar/Lockfield.hs
+++ b/src/GF/Grammar/Lockfield.hs
@@ -1,15 +1,17 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Lockfield
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- Creating and using lock fields in reused resource grammars.
+--
+-- AR 8\/2\/2005 detached from 'compile/MkResource'
-----------------------------------------------------------------------------
module Lockfield (lockRecType, unlockRecord, lockLabel, isLockLabel) where
@@ -21,8 +23,6 @@ import PrGrammar
import Operations
--- AR 8/2/2005 detached from compile/MkResource
-
lockRecType :: Ident -> Type -> Err Type
lockRecType c t@(RecType rs) =
let lab = lockLabel c in
diff --git a/src/GF/Grammar/LookAbs.hs b/src/GF/Grammar/LookAbs.hs
index d2e40ed6f..cb6ec89ad 100644
--- a/src/GF/Grammar/LookAbs.hs
+++ b/src/GF/Grammar/LookAbs.hs
@@ -1,18 +1,35 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : LookAbs
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.12 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module LookAbs where
+module LookAbs (GFCGrammar,
+ lookupAbsDef,
+ lookupFunType,
+ lookupCatContext,
+ lookupTransfer,
+ isPrimitiveFun,
+ lookupRef,
+ refsForType,
+ funRulesOf,
+ allCatsOf,
+ allBindCatsOf,
+ funsForType,
+ funsOnType,
+ funsOnTypeFs,
+ allDefs,
+ lookupFunTypeSrc,
+ lookupCatContextSrc
+ ) where
import Operations
import qualified GFC as C
@@ -62,8 +79,7 @@ lookupCatContext gr m c = errIn ("looking up context of cat" +++ prt c) $ do
_ -> prtBad "unknown category" c
_ -> Bad $ prt m +++ "is not an abstract module"
--- lookup for transfer function: transfer-module-name, category name
-
+-- | lookup for transfer function: transfer-module-name, category name
lookupTransfer :: GFCGrammar -> Ident -> Ident -> Err Term
lookupTransfer gr m c = errIn ("looking up transfer of cat" +++ prt c) $ do
mi <- lookupModule gr m
@@ -77,7 +93,7 @@ lookupTransfer gr m c = errIn ("looking up transfer of cat" +++ prt c) $ do
_ -> Bad $ prt m +++ "is not a transfer module"
----- should be revised (20/9/2003)
+-- | should be revised (20\/9\/2003)
isPrimitiveFun :: GFCGrammar -> Fun -> Bool
isPrimitiveFun gr (m,c) = case lookupAbsDef gr m c of
Ok (Just (Eqs [])) -> True -- is canonical
@@ -85,8 +101,7 @@ isPrimitiveFun gr (m,c) = case lookupAbsDef gr m c of
_ -> True -- has no definition
--- looking up refinement terms
-
+-- | looking up refinement terms
lookupRef :: GFCGrammar -> Binds -> Term -> Err Val
lookupRef gr binds at = case at of
Q m f -> lookupFunType gr m f >>= return . vClos
@@ -147,8 +162,7 @@ allDefs gr = [((i,c),d) | (i, ModMod m) <- modules gr,
isModAbs m,
(c, C.AbsFun _ d) <- tree2list (jments m)]
--- this is needed at compile time
-
+-- | this is needed at compile time
lookupFunTypeSrc :: Grammar -> Ident -> Ident -> Err Type
lookupFunTypeSrc gr m c = do
mi <- lookupModule gr m
@@ -161,6 +175,7 @@ lookupFunTypeSrc gr m c = do
_ -> prtBad "cannot find type of" c
_ -> Bad $ prt m +++ "is not an abstract module"
+-- | this is needed at compile time
lookupCatContextSrc :: Grammar -> Ident -> Ident -> Err Context
lookupCatContextSrc gr m c = do
mi <- lookupModule gr m
diff --git a/src/GF/Grammar/Lookup.hs b/src/GF/Grammar/Lookup.hs
index d0c8434ce..60b0ff73d 100644
--- a/src/GF/Grammar/Lookup.hs
+++ b/src/GF/Grammar/Lookup.hs
@@ -1,18 +1,29 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Lookup
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.12 $
--
-- Lookup in source (concrete and resource) when compiling.
+--
+-- lookup in resource and concrete in compiling; for abstract, use 'Look'
-----------------------------------------------------------------------------
-module Lookup where
+module Lookup (lookupResDef,
+ lookupResType,
+ lookupParams,
+ lookupParamValues,
+ lookupFirstTag,
+ allParamValues,
+ lookupAbsDef,
+ lookupLincat,
+ opersForType
+ ) where
import Operations
import Abstract
@@ -22,8 +33,6 @@ import Lockfield
import List (nub)
import Monad
--- lookup in resource and concrete in compiling; for abstract, use Look
-
lookupResDef :: SourceGrammar -> Ident -> Ident -> Err Term
lookupResDef gr = look True where
look isTop m c = do
diff --git a/src/GF/Grammar/MMacros.hs b/src/GF/Grammar/MMacros.hs
index e5532cbbf..acffa5298 100644
--- a/src/GF/Grammar/MMacros.hs
+++ b/src/GF/Grammar/MMacros.hs
@@ -1,15 +1,15 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : MMacros
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
--- (Description of the module)
+-- some more abstractions on grammars, esp. for Edit
-----------------------------------------------------------------------------
module MMacros where
@@ -27,8 +27,6 @@ import Macros
import Monad
--- some more abstractions on grammars, esp. for Edit
-
nodeTree (Tr (n,_)) = n
argsTree (Tr (_,ts)) = ts
@@ -69,7 +67,7 @@ changeMetaSubst f (N (b,a,v,(c,m),x)) = N (b,a,v,(c, f m),x)
changeAtom :: (Atom -> Atom) -> TrNode -> TrNode
changeAtom f (N (b,a,v,(c,m),x)) = N (b,f a,v,(c, m),x)
------- on the way to Edit
+-- * on the way to Edit
uTree :: Tree
uTree = Tr (uNode, []) -- unknown tree
@@ -139,7 +137,7 @@ substTerm ss g c = case c of
metaSubstExp :: MetaSubst -> [(Meta,Exp)]
metaSubstExp msubst = [(m, errVal (meta2exp m) (val2expSafe v)) | (m,v) <- msubst]
--- belong here rather than to computation
+-- * belong here rather than to computation
substitute :: [Var] -> Substitution -> Exp -> Err Exp
substitute v s = return . substTerm v s
@@ -245,7 +243,7 @@ fun2wrap oldvars ((fun,i),typ) exp = do
let vars = mkFreshVars (length cont) oldvars
return $ mkAbs vars $ if n==i then exp else mExp
--- weak heuristics: sameness of value category
+-- | weak heuristics: sameness of value category
compatType :: Val -> Type -> Bool
compatType v t = errVal True $ do
cat1 <- val2cat v
@@ -269,8 +267,7 @@ identVar (Vr x) = return x
identVar _ = Bad "not a variable"
--- light-weight rename for user interaction; also change names of internal vars
-
+-- | light-weight rename for user interaction; also change names of internal vars
qualifTerm :: Ident -> Term -> Term
qualifTerm m = qualif [] where
qualif xs t = case t of
@@ -287,8 +284,7 @@ string2var s = case s of
c:'_':i -> identV (readIntArg i,[c]) ---
_ -> zIdent s
--- reindex variables so that they tell nesting depth level
-
+-- | reindex variables so that they tell nesting depth level
reindexTerm :: Term -> Term
reindexTerm = qualif (0,[]) where
qualif dg@(d,g) t = case t of
diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs
index 62a15a511..ace3faf79 100644
--- a/src/GF/Grammar/Macros.hs
+++ b/src/GF/Grammar/Macros.hs
@@ -1,15 +1,19 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Macros
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:12 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.17 $
--
-- Macros for constructing and analysing source code terms.
+--
+-- operations on terms and types not involving lookup in or reference to grammars
+--
+-- AR 7\/12\/1999 - 9\/5\/2000 -- 4\/6\/2001
-----------------------------------------------------------------------------
module Macros where
@@ -23,10 +27,6 @@ import PrGrammar
import Monad (liftM)
import Char (isDigit)
--- AR 7/12/1999 - 9/5/2000 -- 4/6/2001
-
--- operations on terms and types not involving lookup in or reference to grammars
-
firstTypeForm :: Type -> Err (Context, Type)
firstTypeForm t = case t of
Prod x a b -> do
@@ -366,7 +366,7 @@ varX i = identV (i,"x")
mkFreshVar :: [Ident] -> Ident
mkFreshVar olds = varX (maxVarIndex olds + 1)
--- trying to preserve a given symbol
+-- | trying to preserve a given symbol
mkFreshVarX :: [Ident] -> Ident -> Ident
mkFreshVarX olds x = if (elem x olds) then (varX (maxVarIndex olds + 1)) else x
@@ -376,22 +376,22 @@ maxVarIndex = maximum . ((-1):) . map varIndex
mkFreshVars :: Int -> [Ident] -> [Ident]
mkFreshVars n olds = [varX (maxVarIndex olds + i) | i <- [1..n]]
---- quick hack for refining with var in editor
+-- | quick hack for refining with var in editor
freshAsTerm :: String -> Term
freshAsTerm s = Vr (varX (readIntArg s))
--- create a terminal for concrete syntax
+-- | create a terminal for concrete syntax
string2term :: String -> Term
string2term = ccK
ccK = K
ccC = C
--- create a terminal from identifier
+-- | create a terminal from identifier
ident2terminal :: Ident -> Term
ident2terminal = ccK . prIdent
--- create a constant
+-- | create a constant
string2CnTrm :: String -> Term
string2CnTrm = Cn . zIdent
@@ -441,7 +441,7 @@ mkFreshMetasInTrm metas = fst . rms minMeta where
_ -> (trm,meta)
minMeta = if null metas then 0 else (maximum (map metaSymbInt metas) + 1)
--- decides that a term has no metavariables
+-- | decides that a term has no metavariables
isCompleteTerm :: Term -> Bool
isCompleteTerm t = case t of
Meta _ -> False
@@ -492,7 +492,7 @@ redirectTerm n t = case t of
Q _ f -> Q n f
_ -> composSafeOp (redirectTerm n) t
--- to gather s-fields; assumes term in normal form, preserves label
+-- | to gather s-fields; assumes term in normal form, preserves label
allLinFields :: Term -> Err [[(Label,Term)]]
allLinFields trm = case unComputed trm of
---- R rs -> return [[(l,t) | (l,(Just ty,t)) <- rs, isStrType ty]] -- good
@@ -502,24 +502,24 @@ allLinFields trm = case unComputed trm of
return $ concat lts
_ -> prtBad "fields can only be sought in a record not in" trm
----- deprecated
+-- | deprecated
isLinLabel l = case l of
LIdent ('s':cs) | all isDigit cs -> True
_ -> False
--- to gather ultimate cases in a table; preserves pattern list
+-- | to gather ultimate cases in a table; preserves pattern list
allCaseValues :: Term -> [([Patt],Term)]
allCaseValues trm = case unComputed trm of
T _ cs -> [(p:ps, t) | (p,t0) <- cs, (ps,t) <- allCaseValues t0]
_ -> [([],trm)]
--- to gather all linearizations; assumes normal form, preserves label and args
+-- | to gather all linearizations; assumes normal form, preserves label and args
allLinValues :: Term -> Err [[(Label,[([Patt],Term)])]]
allLinValues trm = do
lts <- allLinFields trm
mapM (mapPairsM (return . allCaseValues)) lts
--- to mark str parts of fields in a record f by a function f
+-- | to mark str parts of fields in a record f by a function f
markLinFields :: (Term -> Term) -> Term -> Term
markLinFields f t = case t of
R r -> R $ map mkField r
@@ -530,7 +530,7 @@ markLinFields f t = case t of
T i cs -> T i [(p, mkTbl v) | (p,v) <- cs]
_ -> f t
--- to get a string from a term that represents a sequence of terminals
+-- | to get a string from a term that represents a sequence of terminals
strsFromTerm :: Term -> Err [Str]
strsFromTerm t = case unComputed t of
K s -> return [str s]
@@ -558,13 +558,12 @@ strsFromTerm t = case unComputed t of
Alias _ _ d -> strsFromTerm d --- should not be needed...
_ -> prtBad "cannot get Str from term" t
--- to print an Str-denoting term as a string; if the term is of wrong type, the error msg
+-- | to print an Str-denoting term as a string; if the term is of wrong type, the error msg
stringFromTerm :: Term -> String
stringFromTerm = err id (ifNull "" (sstr . head)) . strsFromTerm
--- to define compositional term functions
-
+-- | to define compositional term functions
composSafeOp :: (Term -> Term) -> Term -> Term
composSafeOp op trm = case composOp (mkMonadic op) trm of
Ok t -> t
@@ -572,6 +571,7 @@ composSafeOp op trm = case composOp (mkMonadic op) trm of
where
mkMonadic f = return . f
+-- | to define compositional term functions
composOp :: Monad m => (Term -> m Term) -> Term -> m Term
composOp co trm =
case trm of
@@ -686,8 +686,7 @@ collectOp co trm = case trm of
Strs tt -> concatMap co tt
_ -> [] -- covers K, Vr, Cn, Sort, Ready
--- to find the word items in a term
-
+-- | to find the word items in a term
wordsInTerm :: Term -> [String]
wordsInTerm trm = filter (not . null) $ case trm of
K s -> [s]
@@ -705,8 +704,7 @@ defaultLinType = mkRecType linLabel [typeStr]
metaTerms :: [Term]
metaTerms = map (Meta . MetaSymb) [0..]
--- from GF1, 20/9/2003
-
+-- | from GF1, 20\/9\/2003
isInOneType :: Type -> Bool
isInOneType t = case t of
Prod _ a b -> a == b
diff --git a/src/GF/Grammar/PatternMatch.hs b/src/GF/Grammar/PatternMatch.hs
index 88e0f0441..2fcf4440a 100644
--- a/src/GF/Grammar/PatternMatch.hs
+++ b/src/GF/Grammar/PatternMatch.hs
@@ -1,18 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PatternMatch
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
--- (Description of the module)
+-- pattern matching for both concrete and abstract syntax. AR -- 16\/6\/2003
-----------------------------------------------------------------------------
-module PatternMatch where
+module PatternMatch (matchPattern,
+ testOvershadow,
+ findMatch
+ ) where
import Operations
import Grammar
@@ -23,8 +26,6 @@ import PrGrammar
import List
import Monad
--- pattern matching for both concrete and abstract syntax. AR -- 16/6/2003
-
matchPattern :: [(Patt,Term)] -> Term -> Err (Term, Substitution)
matchPattern pts term =
@@ -105,7 +106,7 @@ varsOfPatt p = case p of
PT _ q -> varsOfPatt q
_ -> []
--- to search matching parameter combinations in tables
+-- | to search matching parameter combinations in tables
isMatchingForms :: [Patt] -> [Term] -> Bool
isMatchingForms ps ts = all match (zip ps ts') where
match (PC c cs, (Cn d, ds)) = c == d && isMatchingForms cs ds
diff --git a/src/GF/Grammar/PrGrammar.hs b/src/GF/Grammar/PrGrammar.hs
index 51a0e9e42..4f77470fe 100644
--- a/src/GF/Grammar/PrGrammar.hs
+++ b/src/GF/Grammar/PrGrammar.hs
@@ -1,18 +1,36 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PrGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
--- (Description of the module)
+-- AR 7\/12\/1999 - 1\/4\/2000 - 10\/5\/2003
+--
+-- printing and prettyprinting class
+--
+-- 8\/1\/2004:
+-- Usually followed principle: 'prt_' for displaying in the editor, 'prt'
+-- in writing grammars to a file. For some constructs, e.g. 'prMarkedTree',
+-- only the former is ever needed.
-----------------------------------------------------------------------------
-module PrGrammar where
+module PrGrammar (Print(..),
+ prtBad,
+ prGrammar, prModule,
+ prContext, prParam,
+ prQIdent, prQIdent_,
+ prRefinement, prTermOpt,
+ prt_Tree, prMarkedTree, prTree,
+ tree2string, prprTree,
+ prConstrs, prConstraints,
+ prMetaSubst, prEnv, prMSubst,
+ prExp, prPatt, prOperSignature
+ ) where
import Operations
import Zipper
@@ -30,15 +48,14 @@ import Str
import List (intersperse)
--- AR 7/12/1999 - 1/4/2000 - 10/5/2003
-
--- printing and prettyprinting class
-
class Print a where
prt :: a -> String
- prt2 :: a -> String -- printing with parentheses, if needed
- prpr :: a -> [String] -- pretty printing
- prt_ :: a -> String -- printing without ident qualifications
+ -- | printing with parentheses, if needed
+ prt2 :: a -> String
+ -- | pretty printing
+ prpr :: a -> [String]
+ -- | printing without ident qualifications
+ prt_ :: a -> String
prt2 = prt
prt_ = prt
prpr = return . prt
@@ -48,11 +65,14 @@ class Print a where
--- in writing grammars to a file. For some constructs, e.g. prMarkedTree,
--- only the former is ever needed.
--- to show terms etc in error messages
+-- | to show terms etc in error messages
prtBad :: Print a => String -> a -> Err b
prtBad s a = Bad (s +++ prt a)
+prGrammar :: SourceGrammar -> String
prGrammar = P.printTree . trGrammar
+
+prModule :: (Ident, SourceModInfo) -> String
prModule = P.printTree . trModule
instance Print Term where
@@ -108,7 +128,7 @@ instance Print a => Print (Tr a) where
prt (Tr (n, trees)) = prt n +++ unwords (map prt2 trees)
prt2 t@(Tr (_,args)) = if null args then prt t else prParenth (prt t)
--- we cannot define the method prt_ in this way
+-- | we cannot define the method prt_ in this way
prt_Tree :: Tree -> String
prt_Tree = prt_ . tree2exp
@@ -133,7 +153,8 @@ prMarkedTree = prf 1 where
prTree :: Tree -> [String]
prTree = prMarkedTree . mapTr (\n -> (n,False))
--- a pretty-printer for parsable output
+-- | a pretty-printer for parsable output
+tree2string :: Tree -> String
tree2string = unlines . prprTree
prprTree :: Tree -> [String]
@@ -204,8 +225,7 @@ prQIdent (m,f) = prt m ++ "." ++ prt f
prQIdent_ :: QIdent -> String
prQIdent_ (_,f) = prt f
--- print terms without qualifications
-
+-- | print terms without qualifications
prExp :: Term -> String
prExp e = case e of
App f a -> pr1 f +++ pr2 a
@@ -232,10 +252,12 @@ prPatt p = case p of
A.PC _ (_:_) -> prParenth $ prPatt p
_ -> prPatt p
--- option -strip strips qualifications
+-- | option @-strip@ strips qualifications
+prTermOpt :: Options -> Term -> String
prTermOpt opts = if oElem nostripQualif opts then prt else prExp
---- to get rid of brackets in the editor
+-- | to get rid of brackets in the editor
+prRefinement :: Term -> String
prRefinement t = case t of
Q m c -> prQIdent (m,c)
QC m c -> prQIdent (m,c)
diff --git a/src/GF/Grammar/Refresh.hs b/src/GF/Grammar/Refresh.hs
index 7de909b69..d2736e433 100644
--- a/src/GF/Grammar/Refresh.hs
+++ b/src/GF/Grammar/Refresh.hs
@@ -1,18 +1,20 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Refresh
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Refresh where
+module Refresh (refreshTerm, refreshTermN,
+ refreshModule
+ ) where
import Operations
import Grammar
diff --git a/src/GF/Grammar/ReservedWords.hs b/src/GF/Grammar/ReservedWords.hs
index cc3efebe1..79ef2d1c7 100644
--- a/src/GF/Grammar/ReservedWords.hs
+++ b/src/GF/Grammar/ReservedWords.hs
@@ -1,25 +1,23 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : ReservedWords
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- (Description of the module)
+-- reserved words of GF. (c) Aarne Ranta 19\/3\/2002 under Gnu GPL.
+-- modified by Markus Forsberg 9\/4.
+-- modified by AR 12\/6\/2003 for GF2 and GFC
-----------------------------------------------------------------------------
module ReservedWords (isResWord, isResWordGFC) where
import List
--- reserved words of GF. (c) Aarne Ranta 19/3/2002 under Gnu GPL
--- modified by Markus Forsberg 9/4.
--- modified by AR 12/6/2003 for GF2 and GFC
-
isResWord :: String -> Bool
isResWord s = isInTree s resWordTree
diff --git a/src/GF/Grammar/TC.hs b/src/GF/Grammar/TC.hs
index c263f769b..e44a28e97 100644
--- a/src/GF/Grammar/TC.hs
+++ b/src/GF/Grammar/TC.hs
@@ -1,18 +1,24 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : TC
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
--- (Description of the module)
+-- Thierry Coquand's type checking algorithm that creates a trace
-----------------------------------------------------------------------------
-module TC where
+module TC (AExp(..),
+ Theory,
+ checkExp,
+ inferExp,
+ eqVal,
+ whnf
+ ) where
import Operations
import Abstract
@@ -20,8 +26,6 @@ import AbsCompute
import Monad
--- Thierry Coquand's type checking algorithm that creates a trace
-
data AExp =
AVr Ident Val
| ACn QIdent Val
diff --git a/src/GF/Grammar/TypeCheck.hs b/src/GF/Grammar/TypeCheck.hs
index c842b3952..9f5f0ba18 100644
--- a/src/GF/Grammar/TypeCheck.hs
+++ b/src/GF/Grammar/TypeCheck.hs
@@ -1,18 +1,37 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : TypeCheck
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.13 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module TypeCheck where
+module TypeCheck (-- * top-level type checking functions; TC should not be called directly.
+ annotate, annotateIn,
+ justTypeCheck, checkIfValidExp,
+ reduceConstraints,
+ splitConstraints,
+ possibleConstraints,
+ reduceConstraintsNode,
+ performMetaSubstNode,
+ -- * some top-level batch-mode checkers for the compiler
+ justTypeCheckSrc,
+ grammar2theorySrc,
+ checkContext,
+ checkTyp,
+ checkEquation,
+ checkConstrs,
+ editAsTermCommand,
+ exp2termCommand,
+ exp2termlistCommand,
+ tree2termlistCommand
+ ) where
import Operations
import Zipper
@@ -35,14 +54,14 @@ import List (nub) ---
annotate :: GFCGrammar -> Exp -> Err Tree
annotate gr exp = annotateIn gr [] exp Nothing
--- type check in empty context, return a list of constraints
+-- | type check in empty context, return a list of constraints
justTypeCheck :: GFCGrammar -> Exp -> Val -> Err Constraints
justTypeCheck gr e v = do
(_,constrs0) <- checkExp (grammar2theory gr) (initTCEnv []) e v
constrs1 <- reduceConstraints (lookupAbsDef gr) 0 constrs0
return $ fst $ splitConstraints gr constrs1
--- type check in empty context, return the expression itself if valid
+-- | type check in empty context, return the expression itself if valid
checkIfValidExp :: GFCGrammar -> Exp -> Err Exp
checkIfValidExp gr e = do
(_,_,constrs0) <- inferExp (grammar2theory gr) (initTCEnv []) e
@@ -63,11 +82,11 @@ annotateIn gr gamma exp = maybe (infer exp) (check exp) where
c' <- reduceConstraints (lookupAbsDef gr) (length gamma) c
aexp2tree (a,c')
--- invariant way of creating TCEnv from context
+-- | invariant way of creating TCEnv from context
initTCEnv gamma =
(length gamma,[(x,VGen i x) | ((x,_),i) <- zip gamma [0..]], gamma)
--- process constraints after eqVal by computing by defs
+-- | process constraints after eqVal by computing by defs
reduceConstraints :: LookDef -> Int -> Constraints -> Err Constraints
reduceConstraints look i = liftM concat . mapM redOne where
redOne (u,v) = do
@@ -92,7 +111,7 @@ computeVal look v = case v of
compt = computeAbsTermIn look
compv = computeVal look
--- take apart constraints that have the form (? <> t), usable as solutions
+-- | take apart constraints that have the form (? <> t), usable as solutions
splitConstraints :: GFCGrammar -> Constraints -> (Constraints,MetaSubst)
splitConstraints gr = splitConstraintsGen (lookupAbsDef gr)
@@ -141,10 +160,11 @@ performMetaSubstNode subst n@(N (b,a,v,(c,m),s)) = let
Meta m -> errVal e $ maybe (return e) val2expSafe $ lookup m subst
_ -> composSafeOp metaSubstExp e
+reduceConstraintsNode :: GFCGrammar -> TrNode -> TrNode
reduceConstraintsNode gr = changeConstrs red where
red cs = errVal cs $ reduceConstraints (lookupAbsDef gr) 0 cs
--- weak heuristic to narrow down menus; not used for TC. 15/11/2001
+-- | weak heuristic to narrow down menus; not used for TC. 15\/11\/2001.
-- the age-old method from GF 0.9
possibleConstraints :: GFCGrammar -> Constraints -> Bool
possibleConstraints gr = and . map (possibleConstraint gr)
diff --git a/src/GF/Grammar/Unify.hs b/src/GF/Grammar/Unify.hs
index b2e34aeea..8ee248ee9 100644
--- a/src/GF/Grammar/Unify.hs
+++ b/src/GF/Grammar/Unify.hs
@@ -1,18 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Unify
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
--- (Description of the module)
+-- (c) Petri Mäenpää & Aarne Ranta, 1998--2001
+--
+-- brute-force adaptation of the old-GF program AR 21\/12\/2001 ---
+-- the only use is in 'TypeCheck.splitConstraints'
-----------------------------------------------------------------------------
-module Unify where
+module Unify (unifyVal) where
import Abstract
@@ -20,11 +23,6 @@ import Operations
import List (partition)
--- (c) Petri Mäenpää & Aarne Ranta, 1998--2001
-
--- brute-force adaptation of the old-GF program AR 21/12/2001 ---
--- the only use is in TypeCheck.splitConstraints
-
unifyVal :: Constraints -> Err (Constraints,MetaSubst)
unifyVal cs0 = do
let (cs1,cs2) = partition notSolvable cs0
diff --git a/src/GF/Grammar/Values.hs b/src/GF/Grammar/Values.hs
index b99fef467..fdbce53de 100644
--- a/src/GF/Grammar/Values.hs
+++ b/src/GF/Grammar/Values.hs
@@ -1,18 +1,27 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Values
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Values where
+module Values (-- * values used in TC type checking
+ Exp, Val(..), Env,
+ -- * annotated tree used in editing
+ Tree, TrNode(..), Atom(..), Binds, Constraints, MetaSubst,
+ -- * for TC
+ valAbsInt, valAbsString, vType,
+ isPredefCat,
+ cType, cPredefAbs, cInt, cString,
+ eType, tree2exp, loc2treeFocus
+ ) where
import Operations
import Zipper
@@ -45,19 +54,28 @@ type MetaSubst = [(MetaSymb,Val)]
-- for TC
-valAbsInt, valAbsString :: Val
+valAbsInt :: Val
valAbsInt = VCn (cPredefAbs, cInt)
+
+valAbsString :: Val
valAbsString = VCn (cPredefAbs, cString)
vType :: Val
vType = VType
-cType,cPredefAbs,cInt,cString :: Ident
+cType :: Ident
cType = identC "Type" --- #0
+
+cPredefAbs :: Ident
cPredefAbs = identC "PredefAbs"
+
+cInt :: Ident
cInt = identC "Int"
+
+cString :: Ident
cString = identC "String"
+isPredefCat :: Ident -> Bool
isPredefCat c = elem c [cInt,cString]
eType :: Exp
diff --git a/src/GF/Infra/CheckM.hs b/src/GF/Infra/CheckM.hs
index 8f0657e27..52802d59b 100644
--- a/src/GF/Infra/CheckM.hs
+++ b/src/GF/Infra/CheckM.hs
@@ -1,18 +1,23 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : CheckM
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module CheckM where
+module CheckM (Check,
+ checkError, checkCond, checkWarn, checkUpdate, checkInContext,
+ checkUpdates, checkReset, checkResets, checkGetContext,
+ checkLookup, checkStart, checkErr, checkVal, checkIn,
+ prtFail
+ ) where
import Operations
import Grammar
diff --git a/src/GF/Infra/Comments.hs b/src/GF/Infra/Comments.hs
index 919b7dd12..c90224a81 100644
--- a/src/GF/Infra/Comments.hs
+++ b/src/GF/Infra/Comments.hs
@@ -1,22 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Comments
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- (Description of the module)
+-- comment removal
-----------------------------------------------------------------------------
module Comments ( remComments
) where
--- | comment removal : line tails prefixed by -- as well as chunks in {- ... -}
-
+-- | comment removal : line tails prefixed by -- as well as chunks in @{- ... -}@
remComments :: String -> String
remComments s =
case s of
diff --git a/src/GF/Infra/Ident.hs b/src/GF/Infra/Ident.hs
index 659084b1b..b805e551f 100644
--- a/src/GF/Infra/Ident.hs
+++ b/src/GF/Infra/Ident.hs
@@ -1,18 +1,26 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Ident
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Ident where
+module Ident (-- * Identifiers
+ Ident(..), prIdent,
+ identC, identV, identA, identAV, identW,
+ argIdent, strVar, wildIdent, isWildIdent,
+ newIdent, mkIdent, varIndex,
+ -- * refreshing identifiers
+ IdState, initIdStateN, initIdState,
+ lookVar, refVar, refVarPlus
+ ) where
import Operations
-- import Monad
@@ -23,8 +31,8 @@ import Operations
data Ident =
IC String -- ^ raw identifier after parsing, resolved in Rename
| IW -- ^ wildcard
-
--- below this line: internal representation never returned by the parser
+--
+-- below this constructor: internal representation never returned by the parser
| IV (Int,String) -- ^ /INTERNAL/ variable
| IA (String,Int) -- ^ /INTERNAL/ argument of cat at position
| IAV (String,Int,Int) -- ^ /INTERNAL/ argument of cat with bindings at position
diff --git a/src/GF/Infra/Modules.hs b/src/GF/Infra/Modules.hs
index 2f14095a9..cabba0c3b 100644
--- a/src/GF/Infra/Modules.hs
+++ b/src/GF/Infra/Modules.hs
@@ -1,18 +1,39 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Modules
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.19 $
--
-- Datastructures and functions for modules, common to GF and GFC.
+--
+-- AR 29\/4\/2003
+--
+-- The same structure will be used in both source code and canonical.
+-- The parameters tell what kind of data is involved.
+-- Invariant: modules are stored in dependency order
-----------------------------------------------------------------------------
-module Modules where
+module Modules (MGrammar(..), ModInfo(..), Module(..), ModuleType(..), MReuseType(..),
+ extendm, updateMGrammar, updateModule, replaceJudgements,
+ addOpenQualif, flagsModule, allFlags, mapModules,
+ MainGrammar(..), MainConcreteSpec(..), OpenSpec(..), OpenQualif(..),
+ oSimple, oQualif,
+ ModuleStatus(..),
+ openedModule, allOpens, depPathModule, allDepsModule, partOfGrammar,
+ allExtends, allExtendsPlus, allExtensions, searchPathModule, addModule,
+ emptyMGrammar, emptyModInfo, emptyModule,
+ IdentM(..),
+ typeOfModule, abstractOfConcrete, abstractModOfConcrete,
+ lookupModule, lookupModuleType, lookupModMod, lookupInfo,
+ allModMod, isModAbs, isModRes, isModCnc, isModTrans,
+ sameMType, isCompilableModule, isCompleteModule,
+ allAbstracts, greatestAbstract, allResources, greatestResource, allConcretes
+ ) where
import Ident
import Option
@@ -46,25 +67,23 @@ data Module i f a = Module {
}
deriving Show
--- encoding the type of the module
+-- | encoding the type of the module
data ModuleType i =
MTAbstract
| MTTransfer (OpenSpec i) (OpenSpec i)
| MTResource
| MTConcrete i
-
- -- up to this, also used in GFC. Below, source only.
-
+ -- ^ up to this, also used in GFC. Below, source only.
| MTInterface
| MTInstance i
| MTReuse (MReuseType i)
- | MTUnion (ModuleType i) [(i,[i])] --- not meant to be recursive
+ | MTUnion (ModuleType i) [(i,[i])] -- ^ not meant to be recursive
deriving (Eq,Show)
data MReuseType i = MRInterface i | MRInstance i i | MRResource i
deriving (Show,Eq)
--- previously: single inheritance
+-- | previously: single inheritance
extendm :: Module i f a -> Maybe i
extendm m = case extends m of
[i] -> Just i
@@ -72,7 +91,7 @@ extendm m = case extends m of
-- destructive update
---- dep order preserved since old cannot depend on new
+-- | dep order preserved since old cannot depend on new
updateMGrammar :: Ord i => MGrammar i f a -> MGrammar i f a -> MGrammar i f a
updateMGrammar old new = MGrammar $
[(i,m) | (i,m) <- os, notElem i (map fst ns)] ++ ns
@@ -114,8 +133,8 @@ data MainGrammar i = MainGrammar {
data MainConcreteSpec i = MainConcreteSpec {
concretePrintname :: i ,
concreteName :: i ,
- transferIn :: Maybe (OpenSpec i) , -- if there is an in-transfer
- transferOut :: Maybe (OpenSpec i) -- if there is an out-transfer
+ transferIn :: Maybe (OpenSpec i) , -- ^ if there is an in-transfer
+ transferOut :: Maybe (OpenSpec i) -- ^ if there is an out-transfer
}
deriving Show
@@ -147,7 +166,7 @@ allOpens m = case mtype m of
MTTransfer a b -> a : b : opens m
_ -> opens m
--- initial dependency list
+-- | initial dependency list
depPathModule :: Ord i => Module i f a -> [OpenSpec i]
depPathModule m = fors m ++ exts m ++ opens m where
fors m = case mtype m of
@@ -157,7 +176,7 @@ depPathModule m = fors m ++ exts m ++ opens m where
_ -> []
exts m = map oSimple $ extends m
--- all dependencies
+-- | all dependencies
allDepsModule :: Ord i => MGrammar i f a -> Module i f a -> [OpenSpec i]
allDepsModule gr m = iterFix add os0 where
os0 = depPathModule m
@@ -165,7 +184,7 @@ allDepsModule gr m = iterFix add os0 where
m <- depPathModule n]
mods = modules gr
--- select just those modules that a given one depends on, including itself
+-- | select just those modules that a given one depends on, including itself
partOfGrammar :: Ord i => MGrammar i f a -> (i,ModInfo i f a) -> MGrammar i f a
partOfGrammar gr (i,m) = MGrammar [mo | mo@(j,_) <- mods, elem j modsFor]
where
@@ -175,7 +194,7 @@ partOfGrammar gr (i,m) = MGrammar [mo | mo@(j,_) <- mods, elem j modsFor]
_ -> [i] ---- ModWith?
--- all modules that a module extends, directly or indirectly
+-- | all modules that a module extends, directly or indirectly
allExtends :: (Show i,Ord i) => MGrammar i f a -> i -> [i]
allExtends gr i = case lookupModule gr i of
Ok (ModMod m) -> case extends m of
@@ -183,7 +202,7 @@ allExtends gr i = case lookupModule gr i of
is -> i : concatMap (allExtends gr) is
_ -> []
--- this plus that an instance extends its interface
+-- | this plus that an instance extends its interface
allExtendsPlus :: (Show i,Ord i) => MGrammar i f a -> i -> [i]
allExtendsPlus gr i = case lookupModule gr i of
Ok (ModMod m) -> i : concatMap (allExtendsPlus gr) (exts m)
@@ -191,7 +210,7 @@ allExtendsPlus gr i = case lookupModule gr i of
where
exts m = extends m ++ [j | MTInstance j <- [mtype m]]
--- conversely: all modules that extend a given module, incl. instances of interface
+-- | conversely: all modules that extend a given module, incl. instances of interface
allExtensions :: (Show i,Ord i) => MGrammar i f a -> i -> [i]
allExtensions gr i = case lookupModule gr i of
Ok (ModMod m) -> let es = exts i in es ++ concatMap (allExtensions gr) es
@@ -201,11 +220,11 @@ allExtensions gr i = case lookupModule gr i of
|| elem (MTInstance i) [mtype m]]
mods = [(j,m) | (j,ModMod m) <- modules gr]
--- initial search path: the nonqualified dependencies
+-- | initial search path: the nonqualified dependencies
searchPathModule :: Ord i => Module i f a -> [i]
searchPathModule m = [i | OSimple _ i <- depPathModule m]
--- a new module can safely be added to the end, since nothing old can depend on it
+-- | a new module can safely be added to the end, since nothing old can depend on it
addModule :: Ord i =>
MGrammar i f a -> i -> ModInfo i f a -> MGrammar i f a
addModule gr name mi = MGrammar $ (modules gr ++ [(name,mi)])
@@ -219,8 +238,7 @@ emptyModInfo = ModMod emptyModule
emptyModule :: Module i f a
emptyModule = Module MTResource MSComplete [] [] [] NT
--- we store the module type with the identifier
-
+-- | we store the module type with the identifier
data IdentM i = IdentM {
identM :: i ,
typeM :: ModuleType i
@@ -310,38 +328,38 @@ sameMType m n = case (m,n) of
(MTInterface,MTResource) -> True
_ -> m == n
--- don't generate code for interfaces and for incomplete modules
+-- | don't generate code for interfaces and for incomplete modules
isCompilableModule m = case m of
ModMod m -> case mtype m of
MTInterface -> False
_ -> mstatus m == MSComplete
_ -> False ---
--- interface and "incomplete M" are not complete
+-- | interface and "incomplete M" are not complete
isCompleteModule :: (Eq i) => Module i f a -> Bool
isCompleteModule m = mstatus m == MSComplete && mtype m /= MTInterface
--- all abstract modules
+-- | all abstract modules
allAbstracts :: Eq i => MGrammar i f a -> [i]
allAbstracts gr = [i | (i,ModMod m) <- modules gr, mtype m == MTAbstract]
--- the last abstract in dependency order (head of list)
+-- | the last abstract in dependency order (head of list)
greatestAbstract :: Eq i => MGrammar i f a -> Maybe i
greatestAbstract gr = case allAbstracts gr of
[] -> Nothing
a:_ -> return a
--- all resource modules
+-- | all resource modules
allResources :: MGrammar i f a -> [i]
allResources gr = [i | (i,ModMod m) <- modules gr, isModRes m]
--- the greatest resource in dependency order
+-- | the greatest resource in dependency order
greatestResource :: MGrammar i f a -> Maybe i
greatestResource gr = case allResources gr of
[] -> Nothing
a -> return $ head a
--- all concretes for a given abstract
+-- | all concretes for a given abstract
allConcretes :: Eq i => MGrammar i f a -> i -> [i]
allConcretes gr a = [i | (i, ModMod m) <- modules gr, mtype m == MTConcrete a]
diff --git a/src/GF/Infra/Option.hs b/src/GF/Infra/Option.hs
index 4d3cf5393..af2f53735 100644
--- a/src/GF/Infra/Option.hs
+++ b/src/GF/Infra/Option.hs
@@ -1,18 +1,72 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Option
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.19 $
--
-- Options and flags used in GF shell commands and files.
+--
+-- The types 'Option' and 'Options' should be kept abstract, but:
+--
+-- - The constructor 'Opt' is used in "ShellCommands" and "GrammarToSource"
+--
+-- - The constructor 'Opts' us udes in "API", "Shell" and "ShellCommands"
-----------------------------------------------------------------------------
-module Option where
+module Option (-- * all kinds of options, should be kept abstract
+ Option(..), Options(..), OptFun, OptFunId,
+ noOptions, iOpt, aOpt, iOpts, oArg, oElem, eqOpt,
+ getOptVal, getOptInt, optIntOrAll, optIntOrN, optIntOrOne,
+ changeOptVal, addOption, addOptions, concatOptions,
+ removeOption, removeOptions, options, unionOptions,
+
+ -- * parsing options, with prefix pre (e.g. \"-\")
+ getOptions, pOption, isOption,
+
+ -- * printing options, without prefix
+ prOpt, prOpts,
+
+ -- * a suggestion for option names
+ -- ** parsing
+ strictParse, forgiveParse, ignoreParse, literalParse,
+ rawParse, firstParse, dontParse,
+ -- ** grammar formats
+ showAbstr, showXML, showOld, showLatex, showFullForm,
+ showEBNF, showCF, showWords, showOpts,
+ isCompiled, isHaskell, noCompOpers, retainOpers, defaultGrOpts,
+ newParser, noCF, checkCirc, noCheckCirc, lexerByNeed,
+ -- ** linearization
+ allLin, firstLin, distinctLin, dontLin, showRecord, showStruct,
+ xmlLin, latexLin, tableLin, defaultLinOpts, useUTF8, showLang, withMetas,
+ -- ** other
+ beVerbose, showInfo, beSilent, emitCode, getHelp, doMake, doBatch,
+ notEmitCode, makeMulti, beShort, wholeGrammar, makeFudget, byLines, byWords,
+ analMorpho, doTrace, noCPU, doCompute, optimizeCanon, optimizeValues,
+ stripQualif, nostripQualif, showAll, fromSource,
+ -- ** mainly for stand-alone
+ useUnicode, optCompute, optCheck, optParaphrase, forJava,
+ -- ** for edit session
+ allLangs, absView,
+ -- ** options that take arguments
+ useTokenizer, useUntokenizer, useParser, withFun, firstCat, gStartCat,
+ useLanguage, useResource, speechLanguage, useFont,
+ grammarFormat, grammarPrinter, filterString, termCommand, transferFun,
+ forForms, menuDisplay, sizeDisplay, typeDisplay,
+ noDepTypes, extractGr, pathList, uniCoding,
+ useName, useAbsName, useCncName, useResName, useFile, useOptimizer,
+ markLin, markOptXML, markOptJava, markOptStruct, markOptFocus,
+ -- ** refinement order
+ nextRefine, firstRefine, lastRefine,
+ -- ** Boolean flags
+ flagYes, flagNo, caseYesNo,
+ -- ** integer flags
+ flagDepth, flagAlts, flagLength, flagNumber, flagRawtrees
+ ) where
import List (partition)
import Char (isDigit)
@@ -25,11 +79,20 @@ newtype Options = Opts [Option] deriving (Eq,Show,Read)
noOptions :: Options
noOptions = Opts []
-iOpt o = Opt (o,[]) -- simple option -o
-aOpt o a = Opt (o,[a]) -- option with argument -o=a
+iOpt :: String -> Option
+iOpt o = Opt (o,[])
+-- ^ simple option -o
+
+aOpt :: String -> String -> Option
+aOpt o a = Opt (o,[a])
+-- ^ option with argument -o=a
+
+iOpts :: [Option] -> Options
iOpts = Opts
-oArg s = s -- value of option argument
+oArg :: String -> String
+oArg s = s
+-- ^ value of option argument
oElem :: Option -> Options -> Bool
oElem o (Opts os) = elem o os
diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs
index 7fd81386e..d65ffedfb 100644
--- a/src/GF/Infra/ReadFiles.hs
+++ b/src/GF/Infra/ReadFiles.hs
@@ -1,26 +1,28 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : ReadFiles
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.19 $
--
-- Decide what files to read as function of dependencies and time stamps.
+--
+-- make analysis for GF grammar modules. AR 11\/6\/2003--24\/2\/2004
+--
+-- to find all files that have to be read, put them in dependency order, and
+-- decide which files need recompilation. Name @file.gf@ is returned for them,
+-- and @file.gfc@ or @file.gfr@ otherwise.
-----------------------------------------------------------------------------
-module ReadFiles
---- where
-
---
-(
---
-getAllFiles,fixNewlines,ModName,getOptionsFromFile,
---
-gfcFile,gfFile,gfrFile,isGFC,resModName,isOldFile) where
+module ReadFiles (-- * Heading 1
+ getAllFiles,fixNewlines,ModName,getOptionsFromFile,
+ -- * Heading 2
+ gfcFile,gfFile,gfrFile,isGFC,resModName,isOldFile
+ ) where
import Arch (selectLater, modifiedFiles, ModTime, getModTime,laterModTime)
@@ -34,12 +36,6 @@ import Monad
import List
import Directory
--- make analysis for GF grammar modules. AR 11/6/2003--24/2/2004
-
--- to find all files that have to be read, put them in dependency order, and
--- decide which files need recompilation. Name file.gf is returned for them,
--- and file.gfc or file.gfr otherwise.
-
type ModName = String
type ModEnv = [(ModName,ModTime)]
@@ -292,15 +288,14 @@ lexs s = x:xs where
(x,y) = head $ lex s
xs = if null y then [] else lexs y
--- options can be passed to the compiler by comments in --#, in the main file
-
+-- | options can be passed to the compiler by comments in @--#@, in the main file
getOptionsFromFile :: FilePath -> IO Options
getOptionsFromFile file = do
s <- readFileIf file
let ls = filter (isPrefixOf "--#") $ lines s
return $ fst $ getOptions "-" $ map (unwords . words . drop 3) ls
--- check if old GF file
+-- | check if old GF file
isOldFile :: FilePath -> IO Bool
isOldFile f = do
s <- readFileIf f
@@ -312,7 +307,7 @@ isOldFile f = do
--- old GF tolerated newlines in quotes. No more supported!
+-- | old GF tolerated newlines in quotes. No more supported!
fixNewlines :: String -> String
fixNewlines s = case s of
'"':cs -> '"':mk cs
diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs
index e68fd7949..5d4c147e0 100644
--- a/src/GF/Infra/UseIO.hs
+++ b/src/GF/Infra/UseIO.hs
@@ -1,18 +1,60 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : UseIO
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.8 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module UseIO where
+module UseIO (prOptCPU,
+ putCPU,
+ putPoint,
+ putPoint',
+ readFileIf,
+ FileName,
+ InitPath,
+ FullPath,
+ getFilePath,
+ readFileIfPath,
+ doesFileExistPath,
+ extendPathEnv,
+ pFilePaths,
+ prefixPathName,
+ justInitPath,
+ nameAndSuffix,
+ unsuffixFile, fileBody,
+ fileSuffix,
+ justFileName,
+ suffixFile,
+ justModuleName,
+ getLineWell,
+ putStrFlush,
+ putStrLnFlush,
+ -- * a generic quiz session
+ QuestionsAndAnswers,
+ teachDialogue,
+ -- * IO monad with error; adapted from state monad
+ IOE(..),
+ appIOE,
+ ioe,
+ ioeIO,
+ ioeErr,
+ ioeBad,
+ useIOE,
+ foldIOE,
+ putStrLnE,
+ putStrE,
+ putPointE,
+ putPointEVerb,
+ readFileIOE,
+ readFileLibraryIOE
+ ) where
import Operations
import Arch (prCPU)
@@ -35,7 +77,7 @@ putIfVerbW opts msg =
then putStr (' ' : msg)
else return ()
--- obsolete with IOE monad
+-- | obsolete with IOE monad
errIO :: a -> Err a -> IO a
errIO = errOptIO noOptions
@@ -95,7 +137,7 @@ doesFileExistPath paths file = do
mpfile <- ioeIO $ getFilePath paths file
return $ maybe False (const True) mpfile
--- path in environment variable has lower priority
+-- | path in environment variable has lower priority
extendPathEnv :: String -> [FilePath] -> IO [FilePath]
extendPathEnv var ps = do
s <- catch (getEnv var) (const (return ""))
@@ -243,7 +285,7 @@ putPointE opts msg act = do
return a
-}
--- forces verbosity
+-- | forces verbosity
putPointEVerb :: Options -> String -> IOE a -> IOE a
putPointEVerb opts = putPointE (addOption beVerbose opts)
@@ -252,9 +294,10 @@ readFileIOE :: FilePath -> IOE (String)
readFileIOE f = ioe $ catch (readFile f >>= return . return)
(\_ -> return (Bad (reportOn f))) where
reportOn f = "File " ++ f ++ " not found."
-
--- like readFileIOE but look also in the GF library if file not found
--- intended semantics: if file is not found, try $GF_LIB_PATH/file
+
+-- | like readFileIOE but look also in the GF library if file not found
+--
+-- intended semantics: if file is not found, try @\$GF_LIB_PATH\/file@
-- (even if file is an absolute path, but this should always fail)
-- it returns not only contents of the file, but also the path used
readFileLibraryIOE :: String -> FilePath -> IOE (FilePath, String)
@@ -281,7 +324,7 @@ readFileLibraryIOE ini f =
_ -> ini ++ file -- relative path name
--- example
+-- | example
koeIOE :: IO ()
koeIOE = useIOE () $ do
s <- ioeIO $ getLine
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 1874bc4d5..775494362 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.32 $
--
-- GF shell command interpreter.
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/CommandL.hs b/src/GF/Shell/CommandL.hs
index 4c5ec4a94..e7b78c222 100644
--- a/src/GF/Shell/CommandL.hs
+++ b/src/GF/Shell/CommandL.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.13 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/Commands.hs b/src/GF/Shell/Commands.hs
index 64a23d26f..a8162c48b 100644
--- a/src/GF/Shell/Commands.hs
+++ b/src/GF/Shell/Commands.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.34 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/JGF.hs b/src/GF/Shell/JGF.hs
index ff274db97..17bd563e9 100644
--- a/src/GF/Shell/JGF.hs
+++ b/src/GF/Shell/JGF.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.9 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/PShell.hs b/src/GF/Shell/PShell.hs
index dd797be5e..cc5731ff2 100644
--- a/src/GF/Shell/PShell.hs
+++ b/src/GF/Shell/PShell.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.17 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/ShellCommands.hs b/src/GF/Shell/ShellCommands.hs
index c28bcad48..b7e678e4c 100644
--- a/src/GF/Shell/ShellCommands.hs
+++ b/src/GF/Shell/ShellCommands.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.22 $
--
-- The datatype of shell commands and the list of their options.
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/SubShell.hs b/src/GF/Shell/SubShell.hs
index a389d4b76..cad79fce0 100644
--- a/src/GF/Shell/SubShell.hs
+++ b/src/GF/Shell/SubShell.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Shell/TeachYourself.hs b/src/GF/Shell/TeachYourself.hs
index 3e2cf86c3..0a006c4ac 100644
--- a/src/GF/Shell/TeachYourself.hs
+++ b/src/GF/Shell/TeachYourself.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Source/AbsGF.hs b/src/GF/Source/AbsGF.hs
index c8b218c2a..30f77b4cb 100644
--- a/src/GF/Source/AbsGF.hs
+++ b/src/GF/Source/AbsGF.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module AbsGF where
diff --git a/src/GF/Source/GrammarToSource.hs b/src/GF/Source/GrammarToSource.hs
index 24826c7f7..cea8fb517 100644
--- a/src/GF/Source/GrammarToSource.hs
+++ b/src/GF/Source/GrammarToSource.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GrammarToSource
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:20 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.16 $
--
-- From internal source syntax to BNFC-generated (used for printing).
-----------------------------------------------------------------------------
@@ -21,9 +21,9 @@ import Option
import qualified AbsGF as P
import Ident
--- AR 13/5/2003
+-- | AR 13\/5\/2003
+--
-- translate internal to parsable and printable source
-
trGrammar :: SourceGrammar -> P.Grammar
trGrammar (MGrammar ms) = P.Gr (map trModule ms) -- no includes
diff --git a/src/GF/Source/PrintGF.hs b/src/GF/Source/PrintGF.hs
index f8c4a3e13..f51dbbdee 100644
--- a/src/GF/Source/PrintGF.hs
+++ b/src/GF/Source/PrintGF.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module PrintGF where
diff --git a/src/GF/Source/SkelGF.hs b/src/GF/Source/SkelGF.hs
index cadb89f28..3283dd702 100644
--- a/src/GF/Source/SkelGF.hs
+++ b/src/GF/Source/SkelGF.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
module SkelGF where
diff --git a/src/GF/Source/SourceToGrammar.hs b/src/GF/Source/SourceToGrammar.hs
index bdd1b54d3..fd25fe2fd 100644
--- a/src/GF/Source/SourceToGrammar.hs
+++ b/src/GF/Source/SourceToGrammar.hs
@@ -1,15 +1,15 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : SourceToGrammar
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.20 $
--
--- (Description of the module)
+-- based on the skeleton Haskell module generated by the BNF converter
-----------------------------------------------------------------------------
module SourceToGrammar where
diff --git a/src/GF/Source/TestGF.hs b/src/GF/Source/TestGF.hs
index 1766bdc36..645f3a94b 100644
--- a/src/GF/Source/TestGF.hs
+++ b/src/GF/Source/TestGF.hs
@@ -1,16 +1,3 @@
-----------------------------------------------------------------------
--- |
--- Module : (Module)
--- Maintainer : (Maintainer)
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
---
--- (Description of the module)
------------------------------------------------------------------------------
-- automatically generated by BNF Converter
module Main where
diff --git a/src/GF/Speech/PrGSL.hs b/src/GF/Speech/PrGSL.hs
index 21e4b21e5..3c2d5b479 100644
--- a/src/GF/Speech/PrGSL.hs
+++ b/src/GF/Speech/PrGSL.hs
@@ -1,20 +1,19 @@
----------------------------------------------------------------------
-- |
-- Module : PrGSL
--- Maintainer : Bjorn Bringert (bringert@cs.chalmers.se)
+-- Maintainer : BB
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.10 $
--
-- This module prints a CFG as a Nuance GSL 2.0 grammar.
--
------------------------------------------------------------------------------
-
--- FIXME: remove / warn / fail if there are int / string literal
+-- FIXME: remove \/ warn \/ fail if there are int \/ string literal
-- categories in the grammar
+-----------------------------------------------------------------------------
module PrGSL (gslPrinter) where
diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs
index 761a59d2e..86aa8311c 100644
--- a/src/GF/Speech/PrJSGF.hs
+++ b/src/GF/Speech/PrJSGF.hs
@@ -1,15 +1,20 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : PrJSGF
+-- Maintainer : BB
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
--- (Description of the module)
+-- This module prints a CFG as a JSGF grammar.
+--
+-- FIXME: remove \/ warn \/ fail if there are int \/ string literal
+-- categories in the grammar
+--
+-- FIXME: convert to UTF-8
-----------------------------------------------------------------------------
{-
@@ -28,11 +33,6 @@
**************************************************************
-}
--- FIXME: remove / warn / fail if there are int / string literal
--- categories in the grammar
-
--- FIXME: convert to UTF-8
-
module PrJSGF (jsgfPrinter) where
import SRG
diff --git a/src/GF/Speech/SRG.hs b/src/GF/Speech/SRG.hs
index 890b4de81..ca91a4139 100644
--- a/src/GF/Speech/SRG.hs
+++ b/src/GF/Speech/SRG.hs
@@ -1,15 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : SRG
+-- Maintainer : BB
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- (Description of the module)
+-- Representation of, conversion to, and utilities for
+-- printing of a general Speech Recognition Grammar.
+--
+-- FIXME: remove \/ warn \/ fail if there are int \/ string literal
+-- categories in the grammar
+--
+-- FIXME: figure out name prefix from grammar name
-----------------------------------------------------------------------------
{-
@@ -30,11 +36,6 @@
**************************************************************
-}
--- FIXME: remove / warn / fail if there are int / string literal
--- categories in the grammar
-
--- FIXME: figure out name prefix from grammar name
-
module SRG where
import Ident
diff --git a/src/GF/Speech/TransformCFG.hs b/src/GF/Speech/TransformCFG.hs
index 2fa797089..b61b3aa67 100644
--- a/src/GF/Speech/TransformCFG.hs
+++ b/src/GF/Speech/TransformCFG.hs
@@ -1,15 +1,17 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : TransformCFG
+-- Maintainer : BB
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
--- (Description of the module)
+-- This module does some useful transformations on CFGs.
+--
+-- FIXME: remove cycles
-----------------------------------------------------------------------------
{-
@@ -43,10 +45,8 @@ import Data.Maybe (fromJust)
import Debug.Trace
--- FIXME: remove cycles
-
--- not very nice to get replace the structured CFCat type with a simple string
+-- | not very nice to get replace the structured CFCat type with a simple string
type CFRule_ = Rule CFName String Token
type CFRules = FiniteMap String [CFRule_]
diff --git a/src/GF/System/Arch.hs b/src/GF/System/Arch.hs
index 363caeb96..d18b12332 100644
--- a/src/GF/System/Arch.hs
+++ b/src/GF/System/Arch.hs
@@ -1,15 +1,15 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Arch
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:10 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
--- (Description of the module)
+-- architecture\/compiler dependent definitions for unix\/hbc
-----------------------------------------------------------------------------
module Arch (
@@ -50,8 +50,7 @@ fetchCommand s = do
Just s -> do addHistory s
return s
--- selects the one with the later modification time of two
-
+-- | selects the one with the later modification time of two
selectLater :: FilePath -> FilePath -> IO FilePath
selectLater x y = do
ex <- doesFileExist x
@@ -66,9 +65,9 @@ selectLater x y = do
ty <- getModificationTime y
return $ if tx < ty then y else x
--- a file is considered modified also if it has not been read yet
--- new 23/2/2004: the environment ofs has just module names
-
+-- | a file is considered modified also if it has not been read yet
+--
+-- new 23\/2\/2004: the environment ofs has just module names
modifiedFiles :: [(FilePath,ModTime)] -> [FilePath] -> IO [FilePath]
modifiedFiles ofs fs = do
filterM isModified fs
diff --git a/src/GF/Text/Arabic.hs b/src/GF/Text/Arabic.hs
index 2e245c217..1b829981f 100644
--- a/src/GF/Text/Arabic.hs
+++ b/src/GF/Text/Arabic.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Arabic
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:13 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Devanagari.hs b/src/GF/Text/Devanagari.hs
index a66477449..86bcc3811 100644
--- a/src/GF/Text/Devanagari.hs
+++ b/src/GF/Text/Devanagari.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Devanagari
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Ethiopic.hs b/src/GF/Text/Ethiopic.hs
index 520dbb540..e67f8f1a2 100644
--- a/src/GF/Text/Ethiopic.hs
+++ b/src/GF/Text/Ethiopic.hs
@@ -1,22 +1,20 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Ethiopic
+-- Maintainer : HH
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
--- (Description of the module)
+-- Ascii-Unicode decoding for Ethiopian.
+-- Copyright (c) Harald Hammarström 2003 under Gnu General Public License
-----------------------------------------------------------------------------
module Ethiopic (mkEthiopic) where
--- Ascii-Unicode decoding for Ethiopian
--- Copyright (c) Harald Hammarström 2003 under Gnu General Public License
-
mkEthiopic :: String -> String
mkEthiopic = digraphWordToUnicode . adHocToDigraphWord
diff --git a/src/GF/Text/ExtendedArabic.hs b/src/GF/Text/ExtendedArabic.hs
index 4625a5a97..1b77248e3 100644
--- a/src/GF/Text/ExtendedArabic.hs
+++ b/src/GF/Text/ExtendedArabic.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : ExtendedArabic
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/ExtraDiacritics.hs b/src/GF/Text/ExtraDiacritics.hs
index 03b9dd4ff..f9e484b59 100644
--- a/src/GF/Text/ExtraDiacritics.hs
+++ b/src/GF/Text/ExtraDiacritics.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : ExtraDiacritics
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Greek.hs b/src/GF/Text/Greek.hs
index 68d0a6e2a..191bc0985 100644
--- a/src/GF/Text/Greek.hs
+++ b/src/GF/Text/Greek.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Greek
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Hebrew.hs b/src/GF/Text/Hebrew.hs
index c5e8c7b89..6c7db2677 100644
--- a/src/GF/Text/Hebrew.hs
+++ b/src/GF/Text/Hebrew.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Hebrew
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Hiragana.hs b/src/GF/Text/Hiragana.hs
index 69b534128..877a22930 100644
--- a/src/GF/Text/Hiragana.hs
+++ b/src/GF/Text/Hiragana.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Hiragana
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/LatinASupplement.hs b/src/GF/Text/LatinASupplement.hs
index 0bb070a00..1952aa8a7 100644
--- a/src/GF/Text/LatinASupplement.hs
+++ b/src/GF/Text/LatinASupplement.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : LatinASupplement
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:14 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/OCSCyrillic.hs b/src/GF/Text/OCSCyrillic.hs
index 894a29e14..c82d3bc91 100644
--- a/src/GF/Text/OCSCyrillic.hs
+++ b/src/GF/Text/OCSCyrillic.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : OSCyrillic
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Russian.hs b/src/GF/Text/Russian.hs
index 14753f964..dd8751848 100644
--- a/src/GF/Text/Russian.hs
+++ b/src/GF/Text/Russian.hs
@@ -1,24 +1,24 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Russian
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:15 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
module Russian (mkRussian, mkRusKOI8) where
--- an ad hoc ASCII encoding. Delimiters: /_ _/
+-- | an ad hoc ASCII encoding. Delimiters: @\/_ _\/@
mkRussian :: String -> String
mkRussian = unwords . (map mkRussianWord) . words
--- the KOI8 encoding, incomplete. Delimiters: /* */
+-- | the KOI8 encoding, incomplete. Delimiters: @\/* *\/@
mkRusKOI8 :: String -> String
mkRusKOI8 = unwords . (map mkRussianKOI8) . words
diff --git a/src/GF/Text/Tamil.hs b/src/GF/Text/Tamil.hs
index ec8d78ef1..47623bac5 100644
--- a/src/GF/Text/Tamil.hs
+++ b/src/GF/Text/Tamil.hs
@@ -1,13 +1,13 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
+-- Module : Tamil
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Text/Text.hs b/src/GF/Text/Text.hs
index fe1165748..3aee3b378 100644
--- a/src/GF/Text/Text.hs
+++ b/src/GF/Text/Text.hs
@@ -1,28 +1,37 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Text
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
--- (Description of the module)
+-- elementary text postprocessing. AR 21\/11\/2001.
+--
+-- This is very primitive indeed. The functions should work on
+-- token lists and not on strings. AR 5\/12\/2002
+--
+-- XML hack 14\/8\/2004; not in use yet
-----------------------------------------------------------------------------
-module Text where
+module Text (untokWithXML,
+ exceptXML,
+ formatAsTextLit,
+ formatAsCodeLit,
+ formatAsText,
+ formatAsCode,
+ performBinds,
+ unStringLit,
+ concatRemSpace
+ ) where
import Operations
import Char
--- elementary text postprocessing. AR 21/11/2001
--- This is very primitive indeed. The functions should work on
--- token lists and not on strings. AR 5/12/2002
--- XML hack 14/8/2004; not in use yet
-
--- does not apply untokenizer within XML tags --- heuristic "< "
+-- | does not apply untokenizer within XML tags --- heuristic "< "
-- this function is applied from top level...
untokWithXML :: (String -> String) -> String -> String
untokWithXML unt s = case s of
@@ -35,7 +44,7 @@ untokWithXML unt s = case s of
where
unto = untokWithXML unt
--- ... whereas this one is embedded on a branch
+-- | ... whereas this one is embedded on a branch
exceptXML :: (String -> String) -> String -> String
exceptXML unt s = '<':beg ++ ">" ++ unt (drop 1 rest) where
(beg,rest) = span (/='>') s
@@ -103,4 +112,4 @@ concatRemSpace s = case s of
c : cs | isSpace c -> concatRemSpace cs
c :cs -> c : concatRemSpace cs
_ -> s
--} \ No newline at end of file
+-}
diff --git a/src/GF/Text/UTF8.hs b/src/GF/Text/UTF8.hs
index 34116ffd9..32f5b49ff 100644
--- a/src/GF/Text/UTF8.hs
+++ b/src/GF/Text/UTF8.hs
@@ -1,23 +1,21 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : UTF8
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- (Description of the module)
+-- From the Char module supplied with HBC.
+-- code by Thomas Hallgren (Jul 10 1999)
-----------------------------------------------------------------------------
module UTF8 (decodeUTF8, encodeUTF8) where
--- From the Char module supplied with HBC.
--- code by Thomas Hallgren (Jul 10 1999)
-
--- Take a Unicode string and encode it as a string
+-- | Take a Unicode string and encode it as a string
-- with the UTF8 method.
decodeUTF8 :: String -> String
decodeUTF8 "" = ""
diff --git a/src/GF/Text/Unicode.hs b/src/GF/Text/Unicode.hs
index e2775eb91..76bb6929c 100644
--- a/src/GF/Text/Unicode.hs
+++ b/src/GF/Text/Unicode.hs
@@ -1,16 +1,16 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Unicode
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.11 $
--
--- ad hoc Unicode conversions from different alphabets
--- AR 12/4/2000, 18/9/2001, 30/5/2002, 26/1/2004
+-- ad hoc Unicode conversions from different alphabets.
+-- AR 12\/4\/2000, 18\/9\/2001, 30\/5\/2002, 26\/1\/2004
-----------------------------------------------------------------------------
module Unicode (mkUnicode, treat) where
diff --git a/src/GF/Translate/GFT.hs b/src/GF/Translate/GFT.hs
index 76faff240..b36e44cd2 100644
--- a/src/GF/Translate/GFT.hs
+++ b/src/GF/Translate/GFT.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GFT
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Main where
+module Main (main) where
import ShellState
import GetGFC
diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs
index 12b9b2ca9..47c3edb6c 100644
--- a/src/GF/UseGrammar/Custom.hs
+++ b/src/GF/UseGrammar/Custom.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.41 $
--
-- A database for customizable GF shell commands.
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Editing.hs b/src/GF/UseGrammar/Editing.hs
index a1437f5cb..155c26ba7 100644
--- a/src/GF/UseGrammar/Editing.hs
+++ b/src/GF/UseGrammar/Editing.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.10 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Generate.hs b/src/GF/UseGrammar/Generate.hs
index a5c92e0e6..3a816b7c6 100644
--- a/src/GF/UseGrammar/Generate.hs
+++ b/src/GF/UseGrammar/Generate.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/GetTree.hs b/src/GF/UseGrammar/GetTree.hs
index c3e1c73c3..1b47c3148 100644
--- a/src/GF/UseGrammar/GetTree.hs
+++ b/src/GF/UseGrammar/GetTree.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Information.hs b/src/GF/UseGrammar/Information.hs
index 8227773d4..9c1b29eb1 100644
--- a/src/GF/UseGrammar/Information.hs
+++ b/src/GF/UseGrammar/Information.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Linear.hs b/src/GF/UseGrammar/Linear.hs
index 5788fcd2b..a4835cc8c 100644
--- a/src/GF/UseGrammar/Linear.hs
+++ b/src/GF/UseGrammar/Linear.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.13 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/MoreCustom.hs b/src/GF/UseGrammar/MoreCustom.hs
index f4686f880..872f888cd 100644
--- a/src/GF/UseGrammar/MoreCustom.hs
+++ b/src/GF/UseGrammar/MoreCustom.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Morphology.hs b/src/GF/UseGrammar/Morphology.hs
index 418bce001..135546680 100644
--- a/src/GF/UseGrammar/Morphology.hs
+++ b/src/GF/UseGrammar/Morphology.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- Morphological analyser constructed from a GF grammar.
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Paraphrases.hs b/src/GF/UseGrammar/Paraphrases.hs
index e08b9b80e..b4132c607 100644
--- a/src/GF/UseGrammar/Paraphrases.hs
+++ b/src/GF/UseGrammar/Paraphrases.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Parsing.hs b/src/GF/UseGrammar/Parsing.hs
index 095aac655..72b65b7df 100644
--- a/src/GF/UseGrammar/Parsing.hs
+++ b/src/GF/UseGrammar/Parsing.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.13 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Randomized.hs b/src/GF/UseGrammar/Randomized.hs
index d2e26a18b..26ef5d032 100644
--- a/src/GF/UseGrammar/Randomized.hs
+++ b/src/GF/UseGrammar/Randomized.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/RealMoreCustom.hs b/src/GF/UseGrammar/RealMoreCustom.hs
index 02fad139c..f0e4a9a1e 100644
--- a/src/GF/UseGrammar/RealMoreCustom.hs
+++ b/src/GF/UseGrammar/RealMoreCustom.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Session.hs b/src/GF/UseGrammar/Session.hs
index 9b4478d11..b2414bdf8 100644
--- a/src/GF/UseGrammar/Session.hs
+++ b/src/GF/UseGrammar/Session.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/TeachYourself.hs b/src/GF/UseGrammar/TeachYourself.hs
index dcea983ba..d09c33514 100644
--- a/src/GF/UseGrammar/TeachYourself.hs
+++ b/src/GF/UseGrammar/TeachYourself.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:22 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Tokenize.hs b/src/GF/UseGrammar/Tokenize.hs
index a425509fc..97cce8546 100644
--- a/src/GF/UseGrammar/Tokenize.hs
+++ b/src/GF/UseGrammar/Tokenize.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.9 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/UseGrammar/Transfer.hs b/src/GF/UseGrammar/Transfer.hs
index dfc08be13..d9823df58 100644
--- a/src/GF/UseGrammar/Transfer.hs
+++ b/src/GF/UseGrammar/Transfer.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
diff --git a/src/GF/Visualization/VisualizeGrammar.hs b/src/GF/Visualization/VisualizeGrammar.hs
index 7aa9b0fcc..f1f8b65a9 100644
--- a/src/GF/Visualization/VisualizeGrammar.hs
+++ b/src/GF/Visualization/VisualizeGrammar.hs
@@ -1,19 +1,20 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : VisualizeGrammar
+-- Maintainer : BB
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.7 $
--
--- (Description of the module)
+-- Print a graph of module dependencies in Graphviz DOT format
-----------------------------------------------------------------------------
--- Print a graph of module dependencies in Graphviz DOT format
-module VisualizeGrammar where
+module VisualizeGrammar ( visualizeCanonGrammar,
+ visualizeSourceGrammar
+ ) where
import qualified Modules as M
import GFC
@@ -78,7 +79,7 @@ fromModType t = case t of
M.MTReuse rt -> error "Can't visualize reuse modules yet" -- FIXME
M.MTUnion _ _ -> error "Can't visualize union modules yet" -- FIXME
--- FIXME: there is something odd about OQualif with 'with' modules,
+-- | FIXME: there is something odd about OQualif with 'with' modules,
-- both names seem to be the same.
openName :: M.OpenSpec Ident -> String
openName (M.OSimple q i) = prIdent i
diff --git a/src/haddock/haddock-check.perl b/src/haddock/haddock-check.perl
index b65fbcc68..81901fa52 100644
--- a/src/haddock/haddock-check.perl
+++ b/src/haddock/haddock-check.perl
@@ -8,8 +8,10 @@
# - transforming hard space to ordinary space
# limitations:
-# - does not check that type aliases are put in the export list
# - there might be some problems with nested comments
+# - cannot handle type signatures for several functions
+# (i.e. "a, b, c :: t")
+# but on the other hand -- haddock has some problems with these too...
$operSym = qr/[\!\#\$\%\&\*\+\.\/\<\=\>\?\@\\\^\|\-\~\:]+/;
$funSym = qr/[a-z]\w*\'*/;
@@ -34,6 +36,15 @@ for $file (@ARGV) {
print "-- $file\n";
+ # substituting hard spaces for ordinary spaces
+ $nchars = tr/\240/ /;
+ if ($nchars > 0) {
+ print " ! Substituted $nchars hard spaces\n";
+ open F, ">$file.hs";
+ print F $_;
+ close F;
+ }
+
# the module header
s/^(--+\s*\n)+//s;
unless (s/^-- \|\s*\n//s) {
diff --git a/src/haddock/haddock-script.csh b/src/haddock/haddock-script.csh
index 54e20e9e3..dd96a0f88 100644
--- a/src/haddock/haddock-script.csh
+++ b/src/haddock/haddock-script.csh
@@ -2,8 +2,8 @@
######################################################################
# Author: Peter Ljunglöf
-# Time-stamp: "2005-02-04, 11:02"
-# CVS $Date: 2005/02/04 10:10:28 $
+# Time-stamp: "2005-02-18, 14:26"
+# CVS $Date: 2005/02/18 19:21:06 $
# CVS $Author: peb $
#
# a script for producing documentation through Haddock
@@ -13,7 +13,9 @@ set base = `pwd`
set docdir = $base/haddock
set resourcedir = $base/haddock-resources
-set dirs = (. api compile grammar infra shell source canonical useGrammar cf newparsing parsers notrace cfgm speech visualization for-hugs for-ghc)
+#set dirs = (. api compile grammar infra shell source canonical useGrammar cf newparsing parsers notrace cfgm speech visualization for-hugs for-ghc)
+
+set files = (`find $base -name '*.hs' -not -path '*/conversions/*' -not -path '*/parsing/*' -not -path '*/for-*' -not -path '*/haddock*' -not -name 'Lex[GC]*' -not -name 'Par[GC]*'` $base/for-ghc-nofud/*.hs)
######################################################################
@@ -21,20 +23,21 @@ echo 1. Creating and cleaning Haddock directory
echo -- $docdir
mkdir -p $docdir
-rm $docdir/*
+rm -r $docdir/*
######################################################################
-echo
-echo 2. Selecting and copying Haskell files
-
-foreach d ($dirs)
- echo -- Directory: $d
- cd $base/$d
- foreach f (*.hs)
- tr "\240" " " < $f > $docdir/$f
- end
-end
+# echo
+# echo 2. Selecting and soft linking Haskell files
+
+# foreach d ($dirs)
+# echo -- Directory: $d
+# cd $base/$d
+# foreach f (*.hs)
+# ln -fs $base/$d/$f $docdir/$f
+# # tr "\240" " " < $f > $docdir/$f
+# end
+# end
######################################################################
@@ -50,15 +53,15 @@ end
######################################################################
echo
-echo 3. Invoking Haddock
+echo 2. Invoking Haddock
-cd $docdir
-haddock -h -t 'Grammatical Framework' *.hs
+# cd $docdir
+haddock -o $docdir -h -t 'Grammatical Framework' $files
######################################################################
echo
-echo 4. Restructuring to HTML framesets
+echo 3. Restructuring to HTML framesets
cd $docdir
echo -- Substituting for frame targets inside html files
@@ -70,13 +73,13 @@ end
cd $resourcedir
echo -- Copying resource files:
-echo -- `ls`
-cp * $docdir
+echo -- `ls *.*`
+cp *.* $docdir
######################################################################
echo
-echo 5. Finished
+echo 4. Finished
echo -- The documentation is located at:
echo -- $docdir/index.html
diff --git a/src/tools/AlphaConvGF.hs b/src/tools/AlphaConvGF.hs
index 8cfc58ee8..ef00aba11 100644
--- a/src/tools/AlphaConvGF.hs
+++ b/src/tools/AlphaConvGF.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : AlphaConvGF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Main where
+module Main (main) where
import LexGF
import Alex
diff --git a/src/tools/GFDoc.hs b/src/tools/GFDoc.hs
index 402f82e8e..2193a4bf8 100644
--- a/src/tools/GFDoc.hs
+++ b/src/tools/GFDoc.hs
@@ -1,26 +1,25 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : GFDoc
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
--- (Description of the module)
+-- produce a HTML document from a list of GF grammar files. AR 6\/10\/2002
+--
+-- Added @--!@ (NewPage) and @--*@ (Item) 21\/11\/2003
-----------------------------------------------------------------------------
-module Main where
+module Main (main) where
import List
import System
import Char
--- produce a HTML document from a list of GF grammar files. AR 6/10/2002
--- Added --! (NewPage) and --* (Item) 21/11/2003
-
-- to read files and write a file
main :: IO ()
diff --git a/src/tools/Htmls.hs b/src/tools/Htmls.hs
index 9156e305f..2a343adab 100644
--- a/src/tools/Htmls.hs
+++ b/src/tools/Htmls.hs
@@ -1,27 +1,25 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : Htmls
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.4 $
--
--- (Description of the module)
+-- chop an HTML file into separate files, each linked to the next and previous.
+-- the names of the files are n-file, with n = 01,02,...
+-- the chopping is performed at each separator, here defined as @\<!-- NEW --\>@
+--
+-- AR 7\/1\/2002 for the Vinnova meeting in Linköping.
-----------------------------------------------------------------------------
-module Main where
+module Main (main) where
import System
--- chop an HTML file into separate files, each linked to the next and previous.
--- the names of the files are n-file, with n = 01,02,...
--- the chopping is performed at each separator, here defined as "<!-- NEW -->"
-
--- AR 7/1/2002 for the Vinnova meeting in Linköping.
-
main :: IO ()
main = do
file:_ <- getArgs
diff --git a/src/tools/MkHelpFile.hs b/src/tools/MkHelpFile.hs
index fc0db2e00..7a3f3965a 100644
--- a/src/tools/MkHelpFile.hs
+++ b/src/tools/MkHelpFile.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : MkHelpFile
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.6 $
--
--- Compile HelpFile.hs from HelpFile.
+-- Compile @HelpFile.hs@ from the text file @HelpFile@.
-----------------------------------------------------------------------------
-module Main where
+module Main (main) where
main = do
s <- readFile "HelpFile"
@@ -49,9 +49,9 @@ helpHeader = unlines [
"-- Stability : (stable)",
"-- Portability : (portable)",
"--",
- "-- > CVS $Date $",
- "-- > CVS $Author $",
- "-- > CVS $Revision $",
+ "-- > CVS $Date: 2005/02/18 19:21:23 $",
+ "-- > CVS $Author: peb $",
+ "-- > CVS $Revision: 1.6 $",
"--",
"-- Help on shell commands. Generated from HelpFile by 'make help'.",
"-- PLEASE DON'T EDIT THIS FILE.",
diff --git a/src/tools/WriteF.hs b/src/tools/WriteF.hs
index 3e7303c1c..03dc47666 100644
--- a/src/tools/WriteF.hs
+++ b/src/tools/WriteF.hs
@@ -1,18 +1,18 @@
----------------------------------------------------------------------
-- |
--- Module : (Module)
--- Maintainer : (Maintainer)
+-- Module : WriteF
+-- Maintainer : AR
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date $
--- > CVS $Author $
--- > CVS $Revision $
+-- > CVS $Date: 2005/02/18 19:21:23 $
+-- > CVS $Author: peb $
+-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module Main where
+module Main (main) where
import Fudgets
import System