diff options
author | Camil Staps | 2017-08-14 23:06:04 +0200 |
---|---|---|
committer | Camil Staps | 2017-08-14 23:06:04 +0200 |
commit | 84b2c129f0efb170692886b3c0d4844d703008bf (patch) | |
tree | c0e630ad99dfa26b56dc04f8c3455ac3d1f2202b /Sil/Util | |
parent | Improved compiler interface (#8) (diff) |
Fix erroneous change from c5c4788b282a371fdc989e2d13430701f3457441
Diffstat (limited to 'Sil/Util')
-rw-r--r-- | Sil/Util/Parser.icl | 5 |
1 files changed, 3 insertions, 2 deletions
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 |