summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2014-10-17 15:50:03 +0000
committeraarne <aarne@chalmers.se>2014-10-17 15:50:03 +0000
commit6c2e0d5ce28e4ed1ff35d7795b80988142190524 (patch)
tree74bf0f6a785b65af8c25176bec7e56675c888f19 /src/compiler
parent5c862a3c7bda63886426a785357bad03b839dfa9 (diff)
ps -lines preserves line-by-line structure when preprocessing files for parsing line by line
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GF/Command/Commands.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs
index e1a5a3438..e67de95cf 100644
--- a/src/compiler/GF/Command/Commands.hs
+++ b/src/compiler/GF/Command/Commands.hs
@@ -698,8 +698,14 @@ allCommands = Map.fromList [
exec = \_ opts x -> do
let (os,fs) = optsAndFlags opts
trans <- optTranslit opts
- return ((fromString . trans . stringOps (envFlag fs) (map prOpt os) . toString) x),
- options = stringOpOptions,
+
+ if isOpt "lines" opts
+ then return $ fromStrings $ map (trans . stringOps (envFlag fs) (map prOpt os)) $ toStrings x
+ else return ((fromString . trans . stringOps (envFlag fs) (map prOpt os) . toString) x),
+ options = [
+ ("lines","apply the operation separately to each input line, returning a list of lines")
+ ] ++
+ stringOpOptions,
flags = [
("env","apply in this environment only"),
("from","backward-apply transliteration defined in this file (format 'unicode translit' per line)"),