Skip to content

Commit 075bc88

Browse files
authored
Merge pull request #28 from konsumlamm/comma
Allow lists with inconsistent comma usage
2 parents d7f7134 + 73e460f commit 075bc88

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/MicroCabal/Parse.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,12 @@ pSpaceList p = esepBy p' pWhite
234234
where
235235
-- sometimes (kan-extensions.cabal) there is a spurious comma,
236236
-- so allow that
237-
p' = p <* eoptional (pStr ",")
237+
p' = p <* eoptional (pStrW ",")
238238

239239
pOptCommaList :: P a -> P [a]
240240
pOptCommaList p =
241241
(pStrW "," *> pCommaList' p) -- it starts with a ',', so it must be comma separated
242-
<|< do
243-
a <- p -- parse one item
244-
-- now check if we have a comma or not, and pick the parser for the rest
245-
as <- (pStrW "," *> pCommaList' p) <|< pSpaceList p
246-
return (a:as)
247-
<|< ([] <$ pWhite)
242+
<|< pSpaceList p
248243

249244
pVComma :: P Value
250245
pVComma = VItems <$> pCommaList pItem

0 commit comments

Comments
 (0)