summaryrefslogtreecommitdiff
path: root/src/GF/Source/SourceToGrammar.hs
diff options
context:
space:
mode:
authorpeb <unknown>2005-02-24 10:46:37 +0000
committerpeb <unknown>2005-02-24 10:46:37 +0000
commitbf436aebaa5b84bbb50e305e8f7dc9ca4ae34299 (patch)
tree346ac1e13a90d7b2c992c69f45b3e19c22f4bfe2 /src/GF/Source/SourceToGrammar.hs
parent0137dd5511a83ea4672619ad3dc22fe7c51ab4bf (diff)
"Committed_by_peb"
Diffstat (limited to 'src/GF/Source/SourceToGrammar.hs')
-rw-r--r--src/GF/Source/SourceToGrammar.hs23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/GF/Source/SourceToGrammar.hs b/src/GF/Source/SourceToGrammar.hs
index fd25fe2fd..259e4f9fe 100644
--- a/src/GF/Source/SourceToGrammar.hs
+++ b/src/GF/Source/SourceToGrammar.hs
@@ -5,14 +5,20 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/02/18 19:21:21 $
+-- > CVS $Date: 2005/02/24 11:46:38 $
-- > CVS $Author: peb $
--- > CVS $Revision: 1.20 $
+-- > CVS $Revision: 1.21 $
--
-- based on the skeleton Haskell module generated by the BNF converter
-----------------------------------------------------------------------------
-module SourceToGrammar where
+module SourceToGrammar ( transGrammar,
+ transInclude,
+ transModDef,
+ transOldGrammar,
+ transExp,
+ newReservedWords
+ ) where
import qualified Grammar as G
import qualified PrGrammar as GP
@@ -321,7 +327,7 @@ getDefsGen d = case d of
e' <- transExp e
return [(id',(nope, yes (G.Eqs [(ps',e')])))]
--- sometimes you need this special case, e.g. in linearization rules
+-- | sometimes you need this special case, e.g. in linearization rules
getDefs :: Def -> Err [(Ident, (G.Perh G.Type, G.Perh G.Term))]
getDefs d = case d of
DPatt id patts e -> do
@@ -331,7 +337,7 @@ getDefs d = case d of
return [(id',(nope, yes (M.mkAbs xs e')))]
_ -> getDefsGen d
--- accepts a pattern that is either a variable or a wild card
+-- | accepts a pattern that is either a variable or a wild card
tryMakeVar :: Patt -> Err Ident
tryMakeVar p = do
p' <- transPatt p
@@ -434,6 +440,7 @@ erecord2term ds = do
_ -> Bad $ "illegal record field" +++ GP.prt (fst f)
+locdef2fields :: LocDef -> Err [(Ident, (Maybe G.Type, Maybe G.Type))]
locdef2fields d = case d of
LDDecl ids t -> do
labs <- mapM transIdent ids
@@ -522,9 +529,8 @@ transDDecl x = case x of
DDDec binds exp -> transDecl $ DDec binds exp
DDExp exp -> transDecl $ DExp exp
--- to deal with the old format, sort judgements in three modules, forming
+-- | to deal with the old format, sort judgements in three modules, forming
-- their names from a given string, e.g. file name or overriding user-given string
-
transOldGrammar :: Options -> FilePath -> OldGrammar -> Err G.SourceGrammar
transOldGrammar opts name0 x = case x of
OldGr includes topdefs -> do --- includes must be collected separately
@@ -594,7 +600,8 @@ transInclude x = case x of
--- unsafe hack ; cf. GetGrammar.oldLexer
-newReservedWords =
+newReservedWords :: [String]
+newReservedWords =
words $ "abstract concrete interface incomplete " ++
"instance out open resource reuse transfer union with where"