mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
added command ps -stringop, with stringop being (un)lexer defined in Lexing
This commit is contained in:
@@ -46,3 +46,8 @@ valOpts flag def opts = case lookup flag flags of
|
||||
|
||||
isOpt :: String -> [Option] -> Bool
|
||||
isOpt o opts = elem o [x | OOpt x <- opts]
|
||||
|
||||
prOpt :: Option -> String
|
||||
prOpt (OOpt i) = i ----
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import GF.Infra.UseIO
|
||||
import GF.Data.ErrM ----
|
||||
import PGF.ExprSyntax (readExp)
|
||||
import GF.Command.Abstract
|
||||
import GF.Text.Lexing
|
||||
|
||||
import Data.Maybe
|
||||
import qualified Data.Map as Map
|
||||
@@ -196,6 +197,13 @@ allCommands pgf = Map.fromList [
|
||||
"example:\n"++
|
||||
" ph | wf foo.hist -- save the history into a file"
|
||||
}),
|
||||
("ps", emptyCommandInfo {
|
||||
longname = "put_string",
|
||||
synopsis = "return a string, possibly processed with a function",
|
||||
exec = \opts ->
|
||||
return . fromString . maybe id id (stringOp (concatMap prOpt opts)) . toString,
|
||||
flags = ["cat","lang"]
|
||||
}),
|
||||
("q", emptyCommandInfo {
|
||||
longname = "quit",
|
||||
synopsis = "exit GF interpreter"
|
||||
|
||||
Reference in New Issue
Block a user