summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Command/Commands.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src-3.0/GF/Command/Commands.hs')
-rw-r--r--src-3.0/GF/Command/Commands.hs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src-3.0/GF/Command/Commands.hs b/src-3.0/GF/Command/Commands.hs
index cb002f5d7..f71e1611c 100644
--- a/src-3.0/GF/Command/Commands.hs
+++ b/src-3.0/GF/Command/Commands.hs
@@ -22,6 +22,7 @@ import GF.Data.ErrM ----
import PGF.ExprSyntax (readExp)
import GF.Command.Abstract
import GF.Text.Lexing
+import GF.Text.Transliterations
import GF.Data.Operations
@@ -301,21 +302,27 @@ allCommands pgf = Map.fromList [
"string processing functions in the order given in the command line",
"option list. Thus 'ps -f -g s' returns g (f s). Typical string processors",
"are lexers and unlexers, but also character encoding conversions are possible.",
- "The unlexers preserve the division of their input to lines."
+ "The unlexers preserve the division of their input to lines.",
+ "To see transliteration tables, use command ut."
],
examples = [
"l (EAdd 3 4) | ps -code -- linearize code-like output",
"ps -lexer=code | p -cat=Exp -- parse code-like input",
"gr -cat=QCl | l | ps -bind -to_utf8 -- linearization output from LangFin",
- "ps -from_utf8 \"jag ?r h?r\" | p -- parser in LangSwe in UYF8 terminal"
+ "ps -from_utf8 \"jag ?r h?r\" | p -- parser in LangSwe in UTF8 terminal",
+ "ps -to_devanagari -to_utf8 \"A-p\" -- show Devanagari in UTF8 terminal"
],
exec = \opts -> return . fromString . stringOps opts . toString,
options = [
("bind","bind tokens separated by Prelude.BIND, i.e. &+"),
+ ("from_devanagari","from unicode to GF Devanagari transliteration"),
+ ("from_thai","from unicode to GF Thai transliteration"),
("from_utf8","decode from utf8"),
("lextext","text-like lexer"),
("lexcode","code-like lexer"),
("lexmixed","mixture of text and code (code between $...$)"),
+ ("to_devanagari","from GF Devanagari transliteration to unicode"),
+ ("to_thai","from GF Thai transliteration to unicode"),
("to_utf8","encode to utf8"),
("unlextext","text-like unlexer"),
("unlexcode","code-like unlexer"),
@@ -370,6 +377,18 @@ allCommands pgf = Map.fromList [
("number","the maximum number of questions")
]
}),
+ ("ut", emptyCommandInfo {
+ longname = "unicode_table",
+ synopsis = "show a transliteration table for a unicode character set",
+ exec = \opts arg -> do
+ let t = concatMap prOpt (take 1 opts)
+ let out = maybe "no such transliteration" characterTable $ transliteration t
+ return $ fromString out,
+ options = [
+ ("devanagari","Devanagari"),
+ ("thai", "Thai")
+ ]
+ }),
("wf", emptyCommandInfo {
longname = "write_file",
synopsis = "send string or tree to a file",