summaryrefslogtreecommitdiff
path: root/src/GF/Command/Parse.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Command/Parse.hs')
-rw-r--r--src/GF/Command/Parse.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/GF/Command/Parse.hs b/src/GF/Command/Parse.hs
index 85a351ead..f48d0d444 100644
--- a/src/GF/Command/Parse.hs
+++ b/src/GF/Command/Parse.hs
@@ -20,12 +20,18 @@ pCommandLine = RP.sepBy (RP.skipSpaces >> pPipe) (RP.skipSpaces >> RP.char ';')
pPipe = RP.sepBy1 (RP.skipSpaces >> pCommand) (RP.skipSpaces >> RP.char '|')
-pCommand = do
+pCommand = (do
cmd <- pIdent RP.<++ (RP.char '%' >> pIdent >>= return . ('%':))
RP.skipSpaces
opts <- RP.sepBy pOption RP.skipSpaces
arg <- pArgument
return (Command cmd opts arg)
+ )
+ RP.<++ (do
+ RP.char '?'
+ c <- pSystemCommand
+ return (Command "sp" [OFlag "command" (VStr c)] ANoArg)
+ )
pOption = do
RP.char '-'
@@ -47,3 +53,12 @@ pArgument =
(fmap ATree (pTree False)
RP.<++
(RP.munch isSpace >> RP.char '%' >> fmap AMacro pIdent))
+
+pSystemCommand =
+ RP.munch isSpace >> (
+ (RP.char '"' >> (RP.manyTill (pEsc RP.<++ RP.get) (RP.char '"')))
+ RP.<++
+ RP.many RP.get
+ )
+ where
+ pEsc = RP.char '\\' >> RP.get