summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@chalmers.se>2008-06-05 12:00:51 +0000
committerkr.angelov <kr.angelov@chalmers.se>2008-06-05 12:00:51 +0000
commitabea46022ef35df493a8d78f56f5e9211150c54b (patch)
tree406eef98f3d1d23f4198552daaa2a21f92b14715
parentb8854ea2f4b8f6c55c56a56af9eff185bccad7e7 (diff)
fix the error checking in the word completion
-rw-r--r--src-3.0/GFI.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src-3.0/GFI.hs b/src-3.0/GFI.hs
index 74ebaf90b..ba26eb667 100644
--- a/src-3.0/GFI.hs
+++ b/src-3.0/GFI.hs
@@ -114,7 +114,7 @@ emptyGFEnv :: GFEnv
emptyGFEnv = GFEnv emptyGrammar (mkCommandEnv emptyPGF) [] 0
-wordCompletion cmdEnv line prefix p = do
+wordCompletion cmdEnv line prefix p =
case wc_type (take p line) of
CmplCmd pref
-> ret ' ' [name | name <- Map.keys (commands cmdEnv), isPrefixOf pref name]
@@ -134,7 +134,10 @@ wordCompletion cmdEnv line prefix p = do
(flg_compls++opt_compls)
Nothing -> ret ' ' []
CmplIdent _ pref
- -> ret ' ' [name | cid <- Map.keys (funs (abstract pgf)), let name = prCId cid, isPrefixOf pref name]
+ -> do mb_abs <- try (evaluate (abstract pgf))
+ case mb_abs of
+ Right abs -> ret ' ' [name | cid <- Map.keys (funs abs), let name = prCId cid, isPrefixOf pref name]
+ Left _ -> ret ' ' []
_ -> ret ' ' []
where
pgf = multigrammar cmdEnv