From 46f85fb13a569e27863565b4ec99800038e3fd68 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 29 Dec 2004 13:48:41 +0000 Subject: command cm --- src/GF/Compile/ShellState.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/GF/Compile') diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs index 34224e641..ae80af572 100644 --- a/src/GF/Compile/ShellState.hs +++ b/src/GF/Compile/ShellState.hs @@ -210,12 +210,14 @@ purgeShellState sh = ShSt { changeMain :: Maybe Ident -> ShellState -> Err ShellState changeMain Nothing (ShSt _ _ cs ms ss cfs pis mos os rs acs s) = - return (ShSt Nothing Nothing cs ms ss cfs pis mos os rs acs s) -changeMain (Just c) (ShSt _ _ cs ms ss cfs pis mos os rs acs s) = - case lookup c (map fst cs) of - Just i -> do - a <- M.abstractOfConcrete ms i - return (ShSt (Just a) (Just i) cs ms ss cfs pis mos os rs acs s) + return (ShSt Nothing Nothing [] ms ss cfs pis mos os rs acs s) +changeMain (Just c) st@(ShSt _ _ cs ms ss cfs pis mos os rs acs s) = + case lookup c (M.modules ms) of + Just _ -> do + a <- M.abstractOfConcrete ms c + let cas = M.allConcretes ms a + let cs' = [((c,c),True) | c <- cas] + return (ShSt (Just a) (Just c) cs' ms ss cfs pis mos os rs acs s) _ -> P.prtBad "The state has no concrete syntax named" c -- form just one state grammar, if unique, from a canonical grammar @@ -385,6 +387,7 @@ getLangNameOpt opts file = -- modify state type ShellStateOper = ShellState -> ShellState +type ShellStateOperErr = ShellState -> Err ShellState reinitShellState :: ShellStateOper reinitShellState = const emptyShellState -- cgit v1.2.3