From 84b2c129f0efb170692886b3c0d4844d703008bf Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 14 Aug 2017 23:06:04 +0200 Subject: Fix erroneous change from c5c4788b282a371fdc989e2d13430701f3457441 --- Sil/Util/Parser.icl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Sil/Util') diff --git a/Sil/Util/Parser.icl b/Sil/Util/Parser.icl index 154a989..eb90408 100644 --- a/Sil/Util/Parser.icl +++ b/Sil/Util/Parser.icl @@ -147,14 +147,15 @@ list :: [a] -> Parser a [a] | ==, name, toString a list as = mapM item as seplist :: a (Parser a b) -> Parser a [b] | ==, name, toString a -seplist sep p = liftM2 (\e es -> [e:es]) p (many (p <* item sep)) +seplist sep p = liftM2 (\es e-> es ++ [e]) (some (p <* item sep)) p + <|> liftM pure p <|> pure empty seplistUntil :: a a (Parser a b) -> Parser a [b] | ==, name, toString a seplistUntil end sep p = liftM2 (\e es -> [e:es]) p ((item sep *> p) until` (item end)) <|> liftM pure (p <* item end) - <|> (pure empty <* item end) + <|> (empty <$ item end) where (until`) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b] (until`) p1 guard = (p1 until guard) >>= \xs -> case xs of -- cgit v1.2.3