summaryrefslogtreecommitdiff
path: root/src/GF/Command/Commands.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-09-17 15:47:06 +0000
committerkrasimir <krasimir@chalmers.se>2009-09-17 15:47:06 +0000
commitb8a7e50107ecc5a5b9cd1dbad6460a5fb3fbbf67 (patch)
tree5b51064282a9965e496e4620ec7f9f1ecaab20c6 /src/GF/Command/Commands.hs
parentbd2f46583c058e427bbacd6dbcfc1a0ccdf25718 (diff)
added pt -transfer
Diffstat (limited to 'src/GF/Command/Commands.hs')
-rw-r--r--src/GF/Command/Commands.hs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/GF/Command/Commands.hs b/src/GF/Command/Commands.hs
index 584535279..e3378ed1e 100644
--- a/src/GF/Command/Commands.hs
+++ b/src/GF/Command/Commands.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE PatternGuards #-}
+
module GF.Command.Commands (
allCommands,
lookCommand,
@@ -471,11 +473,11 @@ allCommands cod env@(pgf, mos) = Map.fromList [
"are type checking and semantic computation."
],
examples = [
- "pt -compute (plus one two) -- compute value",
- "p \"foo\" | pt -typecheck -- type check parse results"
+ "pt -compute (plus one two) -- compute value"
],
- exec = \opts -> returnFromExprs . treeOps (map prOpt opts),
- options = treeOpOptions pgf
+ exec = \opts -> returnFromExprs . treeOps opts,
+ options = treeOpOptions pgf,
+ flags = treeOpFlags pgf
}),
("q", emptyCommandInfo {
longname = "quit",
@@ -748,7 +750,9 @@ allCommands cod env@(pgf, mos) = Map.fromList [
_ -> Nothing
treeOps opts s = foldr app s (reverse opts) where
- app f = maybe id id (treeOp pgf f)
+ app (OOpt op) | Just (Left f) <- treeOp pgf op = f
+ app (OFlag op (VId x)) | Just (Right f) <- treeOp pgf op = f (mkCId x)
+ app _ = id
showAsString t = case t of
ELit (LStr s) -> s
@@ -777,7 +781,8 @@ stringOpOptions = sort $ [
("to_" ++ p, "from GF " ++ n ++ " transliteration to unicode")] |
(p,n) <- transliterationPrintNames]
-treeOpOptions pgf = [(op,expl) | (op,(expl,_)) <- allTreeOps pgf]
+treeOpOptions pgf = [(op,expl) | (op,(expl,Left _)) <- allTreeOps pgf]
+treeOpFlags pgf = [(op,expl) | (op,(expl,Right _)) <- allTreeOps pgf]
translationQuiz :: Encoding -> PGF -> Language -> Language -> Type -> IO ()
translationQuiz cod pgf ig og typ = do