diff options
| author | kr.angelov <kr.angelov@chalmers.se> | 2008-06-04 07:49:58 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@chalmers.se> | 2008-06-04 07:49:58 +0000 |
| commit | a3f4910bdb5d00d0cb460950690ffd90559a6a53 (patch) | |
| tree | 37d3e9a0a3f802e861f3e1c0baa6cacce59c84f9 /src-3.0/GF | |
| parent | 27dda59db4be007d4daa58f8f0a12873f26af1d4 (diff) | |
cleanup, document and export the completion API
Diffstat (limited to 'src-3.0/GF')
| -rw-r--r-- | src-3.0/GF/Command/Commands.hs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src-3.0/GF/Command/Commands.hs b/src-3.0/GF/Command/Commands.hs index e35410405..cddecbc9a 100644 --- a/src-3.0/GF/Command/Commands.hs +++ b/src-3.0/GF/Command/Commands.hs @@ -173,21 +173,14 @@ allCommands pgf = Map.fromAscList [ if s == "q" then return () else do cpu1 <- getCPUTime - st <- parse pinfo state0 (words s) - let exps = Incremental.extractExps pinfo (mkCId cat) st + exps <- return $! Incremental.parse pinfo (mkCId cat) (words s) mapM_ (putStrLn . showExp) exps cpu2 <- getCPUTime putStrLn (show ((cpu2 - cpu1) `div` 1000000000) ++ " msec") wordCompletion opts where - parse pinfo st [] = do putStrLnFlush "" - return st - parse pinfo st (t:ts) = do putStrFlush "." - st1 <- return $! (Incremental.nextState pinfo t st) - parse pinfo st1 ts - myCompletion pinfo state0 line prefix p = do let ws = words (take (p-length prefix) line) - state = foldl (\st t -> Incremental.nextState pinfo t st) state0 ws - compls = Incremental.getCompletions pinfo prefix state + state = foldl Incremental.nextState state0 ws + compls = Incremental.getCompletions state prefix return (Map.keys compls) |
