diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-09-20 21:51:54 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-09-20 21:51:54 +0000 |
| commit | 6e4104ffa98279fcf105dd6386e1f7162f889fc0 (patch) | |
| tree | 4a137525f2ac44994260c5f2520bb6c526c96f14 /src/GF/Source | |
| parent | 46013f103cf23d875aa3a2f853080a4fbe23ebd8 (diff) | |
compact printing of gf files
Diffstat (limited to 'src/GF/Source')
| -rw-r--r-- | src/GF/Source/GrammarToSource.hs | 9 | ||||
| -rw-r--r-- | src/GF/Source/SourceToGrammar.hs | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/GF/Source/GrammarToSource.hs b/src/GF/Source/GrammarToSource.hs index 74c98b1bc..21382c7bd 100644 --- a/src/GF/Source/GrammarToSource.hs +++ b/src/GF/Source/GrammarToSource.hs @@ -107,8 +107,15 @@ trAnyDef (i,info) = let i' = tri i in case info of CncFun _ ptr ppr -> [P.DefLin [trDef i' nope ptr]] ---- P.DefPrintFun [P.PrintDef i' (trt pr)]] +{- + ---- encoding of AnyInd without changing syntax. AR 20/9/2007 + AnyInd s b -> + [P.DefOper [P.DDef [mkName i] + (P.EApp (P.EInt (if s then 1 else 0)) (P.EIdent (tri b)))]] +-} _ -> [] + trDef :: Ident -> Perh Type -> Perh Term -> P.Def trDef i pty ptr = case (pty,ptr) of (Nope, Nope) -> P.DDef [mkName i] (P.EMeta) --- @@ -243,4 +250,4 @@ trLabelIdent i = identC $ case i of LVar i -> "v" ++ show i --- should not happen mkName :: Ident -> P.Name -mkName = P.IdentName
\ No newline at end of file +mkName = P.IdentName diff --git a/src/GF/Source/SourceToGrammar.hs b/src/GF/Source/SourceToGrammar.hs index 28cb9025b..8435540e4 100644 --- a/src/GF/Source/SourceToGrammar.hs +++ b/src/GF/Source/SourceToGrammar.hs @@ -305,6 +305,14 @@ transResDef x = case x of | (p,pars) <- pardefs'] ++ [(f, G.ResValue (yes (M.mkProdSimple co (G.Cn p),Nothing))) | (p,pars) <- pardefs', (f,co) <- pars] + +{- + ---- encoding of AnyInd without changing syntax. AR 20/9/2007 + DefOper [DDef [c] (EApp (EInt status) (EIdent mo))] -> do + c' <- transName c + mo' <- transIdent mo + return $ Left [(c',G.AnyInd (status==1) mo')] +-} DefOper defs -> do defs' <- liftM concat $ mapM getDefs defs returnl $ concatMap mkOverload [(f, G.ResOper pt pe) | (f,(pt,pe)) <- defs'] |
