on master help sign in
Merge pull request #344 from andy-morris/comment

Parse empty comments

commite221d08c70de1297c92b6c4d060dc8d5e0aba754 authorEdwin Brady <edwin.brady@gmail.com> dateTue 25 Jun 2013, 13:15 (13 years ago) parent357e6b15a968c4
4 files changed+20−7
src/Core/CoreParser.hs+10−7 test/test028/expected+1 test/test028/run+4 test/test028/test028.idr+5
src/Core/CoreParser.hs+10−7
@@ -57,13 +57,16 @@ lexWS = do i <- getInput
5757 where
5858
5959 simpleSpace = skipMany1 (satisfy isSpace)
60− oneLineComment = do try (do string ("--")
61− satisfy (\x -> x /= '|' && x /= '^'))
62− skipMany (satisfy (/= '\n'))
63− return ()
64− multiLineComment = do try (do string "{-"
65− satisfy (\x -> x /= '|' && x /= '^'))
66− inCommentMulti
60+ oneLineComment =
61+ try (void $ string "--\n") <|>
62+ do try (do string "--"
63+ satisfy (\x -> x /= '|' && x /= '^'))
64+ skipMany (satisfy (/= '\n'))
65+ multiLineComment =
66+ try (void $ string "{--}") <|>
67+ do try (do string "{-"
68+ satisfy (\x -> x /= '|' && x /= '^'))
69+ inCommentMulti
6770
6871 inCommentMulti
6972 = do{ try (string "-}") ; return () }
test/test028/expectednew file+1
@@ -0,0 +1 @@
1+hello, world!
test/test028/runnew file+4
@@ -0,0 +1,4 @@
1+#!/bin/bash
2+idris $@ test028.idr -o test028
3+./test028
4+rm -f test028 test028.ibc
test/test028/test028.idrnew file+5
@@ -0,0 +1,5 @@
1+{--}
2+module Main
3+--
4+main : IO ()
5+main = print "hello, world!"