From 8460598801b644f323db0b7d7ca879e3acb9215b Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 30 Apr 2010 14:36:06 +0000 Subject: first incarnation of the bracketed string API --- src/compiler/GF/Compile/ExampleBased.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/compiler/GF/Compile/ExampleBased.hs') diff --git a/src/compiler/GF/Compile/ExampleBased.hs b/src/compiler/GF/Compile/ExampleBased.hs index 983f38869..f197722ba 100644 --- a/src/compiler/GF/Compile/ExampleBased.hs +++ b/src/compiler/GF/Compile/ExampleBased.hs @@ -41,17 +41,20 @@ convertFile conf src file = do convEx (cat,ex) = do appn "(" let typ = maybe (error "no valid cat") id $ readType cat - let ts = rank $ parse pgf lang typ ex - ws <- case ts of - [] -> do + ws <- case fst (parse pgf lang typ ex) of + ParseFailed _ -> do let ws = morphoMissing morpho (words ex) appv ("WARNING: cannot parse example " ++ ex) case ws of [] -> return () _ -> appv (" missing words: " ++ unwords ws) - return ws - t:tt -> appv ("WARNING: ambiguous example " ++ ex) >> - appn t >> mapM_ (appn . (" --- " ++)) tt >> return [] + return ws + TypeError _ _ -> + return [] + ParseResult ts -> + case rank ts of + (t:tt) -> appv ("WARNING: ambiguous example " ++ ex) >> + appn t >> mapM_ (appn . (" --- " ++)) tt >> return [] appn ")" return ws rank ts = case probs conf of -- cgit v1.2.3