diff options
| author | krasimir <krasimir@chalmers.se> | 2009-05-20 12:10:54 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2009-05-20 12:10:54 +0000 |
| commit | 0b2e0934161ebce30bc6baf4e49fac184e3f0d22 (patch) | |
| tree | e5d278d97e00e67e3279c3f61ae4471c79c491c2 | |
| parent | 352ac74b0ff4fb616a9f40332b4c60d6c8953564 (diff) | |
now a single line comment (--) is recongized as an empty command. Usefull for GF shell scripts
| -rw-r--r-- | src/GF/Command/Parse.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/GF/Command/Parse.hs b/src/GF/Command/Parse.hs index f48d0d444..3417baff9 100644 --- a/src/GF/Command/Parse.hs +++ b/src/GF/Command/Parse.hs @@ -14,9 +14,10 @@ readCommandLine s = case [x | (x,cs) <- RP.readP_to_S pCommandLine s, all isSpac [x] -> Just x _ -> Nothing -test s = RP.readP_to_S pCommandLine s - -pCommandLine = RP.sepBy (RP.skipSpaces >> pPipe) (RP.skipSpaces >> RP.char ';') +pCommandLine = + (RP.skipSpaces >> RP.char '-' >> RP.char '-' >> RP.skipMany (RP.satisfy (const True)) >> return []) -- comment + RP.<++ + (RP.sepBy (RP.skipSpaces >> pPipe) (RP.skipSpaces >> RP.char ';')) pPipe = RP.sepBy1 (RP.skipSpaces >> pCommand) (RP.skipSpaces >> RP.char '|') |
