diff options
| author | krasimir <krasimir@chalmers.se> | 2008-10-14 08:00:50 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-10-14 08:00:50 +0000 |
| commit | 4573d104425a79b8b00ebcccb2e94c62275285ea (patch) | |
| tree | d8a7f902baf5246367c048aeb201dd9e3486d1b0 /src/GFI.hs | |
| parent | 0c66ad597db65fcddc8a425f0bce4beedf2aae33 (diff) | |
the new optimized incremental parser and the common subexpression elimination optimization in PMCFG
Diffstat (limited to 'src/GFI.hs')
| -rw-r--r-- | src/GFI.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/GFI.hs b/src/GFI.hs index 03fbb184f..1e9cfba2f 100644 --- a/src/GFI.hs +++ b/src/GFI.hs @@ -25,6 +25,7 @@ import qualified Text.ParserCombinators.ReadP as RP import System.Cmd import System.CPUTime import Control.Exception +import Control.Monad import Data.Version import GF.System.Signal --import System.IO.Error (try) @@ -203,9 +204,10 @@ wordCompletion gfenv line0 prefix0 p = -> do mb_state0 <- try (evaluate (initState pgf (optLang opts) (optCat opts))) case mb_state0 of Right state0 -> let ws = words (take (length s - length prefix) s) - state = foldl nextState state0 ws - compls = getCompletions state prefix - in ret ' ' (map (encode gfenv) (Map.keys compls)) + in case foldM nextState state0 ws of + Nothing -> ret ' ' [] + Just state -> let compls = getCompletions state prefix + in ret ' ' (map (encode gfenv) (Map.keys compls)) Left _ -> ret ' ' [] CmplOpt (Just (Command n _ _)) pref -> case Map.lookup n (commands cmdEnv) of |
