Skip to content

Commit

Permalink
Support extra space in clingo 3
Browse files Browse the repository at this point in the history
  • Loading branch information
egnwd committed Nov 22, 2017
1 parent e050370 commit de9d71f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pingo.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/Pingo/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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'
Expand Down

0 comments on commit de9d71f

Please sign in to comment.