summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-04-30 14:36:06 +0000
committerkrasimir <krasimir@chalmers.se>2010-04-30 14:36:06 +0000
commit8460598801b644f323db0b7d7ca879e3acb9215b (patch)
tree02aaf44ec76bf9738f996bfc1688a94f308cde27 /src/compiler/GF/Compile
parent7a4cb3c2715c5dd61309b9bc0309142a44393c29 (diff)
first incarnation of the bracketed string API
Diffstat (limited to 'src/compiler/GF/Compile')
-rw-r--r--src/compiler/GF/Compile/ExampleBased.hs15
1 files changed, 9 insertions, 6 deletions
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