From 4fd0c636f8590bf800715f2598e54ccc22c99b90 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 8 Feb 2005 15:35:58 +0000 Subject: unlexer concat --- src/GF/Grammar/Lockfield.hs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/GF/Grammar/Lockfield.hs (limited to 'src/GF/Grammar/Lockfield.hs') diff --git a/src/GF/Grammar/Lockfield.hs b/src/GF/Grammar/Lockfield.hs new file mode 100644 index 000000000..fb9043b00 --- /dev/null +++ b/src/GF/Grammar/Lockfield.hs @@ -0,0 +1,37 @@ +---------------------------------------------------------------------- +-- | +-- Module : (Module) +-- Maintainer : (Maintainer) +-- Stability : (stable) +-- Portability : (portable) +-- +-- > CVS $Date $ +-- > CVS $Author $ +-- > CVS $Revision $ +-- +-- Creating and using lock fields in reused resource grammars. +----------------------------------------------------------------------------- + +module Lockfield where + +import Grammar +import Ident +import Macros +import PrGrammar + +import Operations + +-- AR 8/2/2005 detached from compile/MkResource + +lockRecType :: Ident -> Type -> Err Type +lockRecType c t = plusRecType t $ RecType [(lockLabel c, RecType [])] + +unlockRecord :: Ident -> Term -> Err Term +unlockRecord c ft = do + let (xs,t) = termFormCnc ft + t' <- plusRecord t $ R [(lockLabel c, (Just (RecType []),R []))] + return $ mkAbs xs t' + +lockLabel :: Ident -> Label +lockLabel c = LIdent $ "lock_" ++ prt c ---- + -- cgit v1.2.3