diff options
Diffstat (limited to 'src/GF/Shell')
| -rw-r--r-- | src/GF/Shell/CommandL.hs | 7 | ||||
| -rw-r--r-- | src/GF/Shell/Commands.hs | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/GF/Shell/CommandL.hs b/src/GF/Shell/CommandL.hs index 463b3d4e4..d1ba0f7ba 100644 --- a/src/GF/Shell/CommandL.hs +++ b/src/GF/Shell/CommandL.hs @@ -63,6 +63,7 @@ pCommand = pCommandWords . words where "<<" : _ -> CPrevMeta "'" : _ -> CTop "+" : _ -> CLast + "mp" : p -> CMovePosition (readIntList (unwords p)) "r" : f : _ -> CRefineWithAtom f "w" : f:i : _ -> CWrapWithFun (strings2Fun f, readIntArg i) "ch": f : _ -> CChangeHead (strings2Fun f) @@ -133,3 +134,9 @@ initEditMsgEmpty env = initEditMsg env +++++ unlines ( showCurrentState env' state' = unlines (tr ++ ["",""] ++ msg ++ ["",""] ++ map fst menu) where (tr,msg,menu) = displaySStateIn env' state' + +-- to read position; borrowed from Prelude; should be elsewhere +readIntList :: String -> [Int] +readIntList s = case [x | (x,t) <- reads s, ("","") <- lex t] of + [x] -> x + _ -> [] diff --git a/src/GF/Shell/Commands.hs b/src/GF/Shell/Commands.hs index f0bb8c4f4..2f7efa517 100644 --- a/src/GF/Shell/Commands.hs +++ b/src/GF/Shell/Commands.hs @@ -42,7 +42,9 @@ import Random (newStdGen) --- temporary hacks for GF 2.0 --- abstract command language for syntax editing. AR 22/8/2001 +-- Abstract command language for syntax editing. AR 22/8/2001 +-- Most arguments are strings, to make it easier to receive them from e.g. Java. +-- See CommandsL for a parser of a command language. data Command = CNewCat G.Cat @@ -53,6 +55,7 @@ data Command = | CPrevMeta | CTop | CLast + | CMovePosition [Int] | CRefineWithTree String | CRefineWithAtom String | CRefineParse String @@ -206,6 +209,7 @@ execECommand env c = case c of CBack n -> action2command (goBackN n) CTop -> action2command $ return . goRoot CLast -> action2command $ goLast + CMovePosition p -> action2command $ goPosition p CNextMeta -> action2command goNextNewMeta CPrevMeta -> action2command goPrevNewMeta CRefineWithAtom s -> action2commandNext $ \x -> do |
