Skip to content

Commit de9d71f

Browse files
committed
Support extra space in clingo 3
1 parent e050370 commit de9d71f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pingo.cabal

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ cabal-version: >=1.10
1414
library
1515
exposed-modules: Pingo.AST
1616
build-depends:
17-
base >=4.9 && <4.10
17+
base >=4.8 && <4.10
1818
hs-source-dirs: src
1919
default-language: Haskell2010
2020

2121
executable pingo
2222
main-is: Main.hs
2323
build-depends:
24-
base >=4.9 && <4.10,
24+
base >=4.8 && <4.10,
2525
parsec >= 3.1 && < 3.2,
2626
parsec3-numbers == 0.1.0,
2727
ansi-terminal >= 0.7 && <1.0,

src/Pingo/Parser.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ atom = do
5454
answerSet :: Parser AnswerSet
5555
answerSet = do
5656
string "Answer: " *> many1 digit <* newline
57-
(atom <?> "a predicate or atom") `sepBy` char ' '
57+
(atom <?> "a predicate or atom") `sepEndBy` char ' '
5858

5959
-- | The 'answerSets' parser collects a list of 'AnswerSet's
6060
answerSets :: Parser [AnswerSet]
@@ -63,8 +63,8 @@ answerSets = (answerSet <?> "an answer set") `endBy` newline
6363
-- | This 'file' parser removes metadata printed by clingo
6464
-- and returns the inner 'AnswerSet's
6565
file :: Parser [AnswerSet]
66-
file = try (anyTill (string "Answer: ")) *> answerSets
67-
<|> manyTill anyChar (lookAhead $ try (string "UNSATISFIABLE")) *> fail "No Answer Sets found"
66+
file = try (anyTill (string "Answer: ")) *> answerSets
67+
<|> anyTill (string "UNSATISFIABLE") *> fail "No Answer Sets found"
6868

6969
-- | The 'parse' function takes 'String' input
7070
-- and returns the 'AnswerSet's or a 'ParseError'

0 commit comments

Comments
 (0)