From de9d71f88266a05ed5c241f2e0f652fb498d1dda Mon Sep 17 00:00:00 2001 From: Elliot Greenwood Date: Wed, 22 Nov 2017 16:54:57 +0000 Subject: [PATCH] Support extra space in clingo 3 --- pingo.cabal | 4 ++-- src/Pingo/Parser.hs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pingo.cabal b/pingo.cabal index dc00411..db67099 100644 --- a/pingo.cabal +++ b/pingo.cabal @@ -14,14 +14,14 @@ cabal-version: >=1.10 library exposed-modules: Pingo.AST build-depends: - base >=4.9 && <4.10 + base >=4.8 && <4.10 hs-source-dirs: src default-language: Haskell2010 executable pingo main-is: Main.hs build-depends: - base >=4.9 && <4.10, + base >=4.8 && <4.10, parsec >= 3.1 && < 3.2, parsec3-numbers == 0.1.0, ansi-terminal >= 0.7 && <1.0, diff --git a/src/Pingo/Parser.hs b/src/Pingo/Parser.hs index b57ce24..f225df1 100644 --- a/src/Pingo/Parser.hs +++ b/src/Pingo/Parser.hs @@ -54,7 +54,7 @@ atom = do answerSet :: Parser AnswerSet answerSet = do string "Answer: " *> many1 digit <* newline - (atom "a predicate or atom") `sepBy` char ' ' + (atom "a predicate or atom") `sepEndBy` char ' ' -- | The 'answerSets' parser collects a list of 'AnswerSet's answerSets :: Parser [AnswerSet] @@ -63,8 +63,8 @@ answerSets = (answerSet "an answer set") `endBy` newline -- | This 'file' parser removes metadata printed by clingo -- and returns the inner 'AnswerSet's file :: Parser [AnswerSet] -file = try (anyTill (string "Answer: ")) *> answerSets - <|> manyTill anyChar (lookAhead $ try (string "UNSATISFIABLE")) *> fail "No Answer Sets found" +file = try (anyTill (string "Answer: ")) *> answerSets + <|> anyTill (string "UNSATISFIABLE") *> fail "No Answer Sets found" -- | The 'parse' function takes 'String' input -- and returns the 'AnswerSet's or a 'ParseError'