Commit 30dbab54 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢
Browse files

Merge branch 'Windows-Fixed-(-)'

parents 0a6ea00b e992401c
......@@ -46,7 +46,7 @@ import Copar.Parser.Types
import Data.Float.Utils (EqDouble, fromDouble)
newline :: MonadParser m => m ()
newline = (void (takeWhile1P (Just "newline") (=='\n'))
newline = (void (takeWhile1P (Just "newline") (`elem` ['\r', '\n']))
<|> (skipLineComment <* char '\n')) *> space
{-# INLINE newline #-}
......
......@@ -40,6 +40,12 @@ spaceSpec = describe "whitespace" $ do
it "skips many newlines" $
p `shouldSucceedOn` "\n\n\n"
it "skips many carriage returns" $
p `shouldSucceedOn` "\r\r\r"
it "skips many newlines and carriage returns" $
p `shouldSucceedOn` "\r\n\n\r\n\r"
it "skips newlines interleaved with spaces" $
p `shouldSucceedOn` "\n \n \n"
......@@ -58,6 +64,12 @@ spaceSpec = describe "whitespace" $ do
it "skips many newlines" $
p `shouldSucceedOn` "\n\n\n"
it "skips many carriage returns" $
p `shouldSucceedOn` "\r\r\r"
it "skips many newlines and carriage returns" $
p `shouldSucceedOn` "\r\n\n\r\n\r"
it "skips newlines interleaved with spaces" $
p `shouldSucceedOn` "\n \n \n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment