From fe1fdf3afd7755f6b5d8282d85f53924c662bf90 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 25 Nov 2005 17:40:51 +0000 Subject: questions and transfer in shell state --- src/GF/API.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/GF/API.hs') diff --git a/src/GF/API.hs b/src/GF/API.hs index 7f2d95770..ff199f589 100644 --- a/src/GF/API.hs +++ b/src/GF/API.hs @@ -63,6 +63,8 @@ import GF.UseGrammar.Editing ----import GrammarToMGrammar as M +import qualified Transfer.InterpreterAPI as T + import GF.System.Arch (myStdGen) import GF.Text.UTF8 @@ -356,6 +358,23 @@ wrapByFun opts gr f t = t' = qualifTerm (absId gr) $ M.appCons f [tree2exp t] g = grammar gr +applyTransfer :: Options -> GFGrammar -> [(Ident,T.Env)] -> + (Maybe Ident,Ident) -> Tree -> Tree +applyTransfer opts gr trs (mm,f) t = + err (const t) id $ annotate g t' + where + t' = qualifTerm (absId gr) $ trans tr f $ tree2exp t + g = grammar gr + tr = case mm of + Just m -> maybe empty id $ lookup m trs + _ -> ifNull empty (snd . head) trs + + -- these are missing + trans = error "no transfer yet" + ----- core2exp . T.appTransfer tr . exp2core + empty = error "emptyEnv" + ---- T.emptyEnv + {- optTransfer :: Options -> StateGrammar -> G.Term -> G.Term optTransfer opts g = case getOptVal opts transferFun of -- cgit v1.2.3