File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,17 @@ parseString = parseQuoted <|> unqualName
92
92
unqualName :: Parser Text
93
93
unqualName = takeWhile1 (not . (\ c -> isSpace c || c == ' ,' ))
94
94
95
+ -- | Comma separated list.
95
96
parseList :: Indent -> Parser [Text ]
96
97
parseList i = items <|> (emptyOrComLine >> indent i >> items)
97
98
where
98
- items = do
99
- skipMany tabOrSpace
100
- h <- parseString
101
- skipMany tabOrSpace
102
- skipMany (char ' ,' )
103
- t <-
104
- items
105
- <|> (skipToNextLine >> indent i >> parseList i)
106
- <|> pure []
107
- pure $ h : t
99
+ items = sepBy parseString (skipSpace *> char ' ,' *> skipSpace)
100
+
101
+ -- | Comma or space separated list.
102
+ parseOptCommaList :: Indent -> Parser [Text ]
103
+ parseOptCommaList i = items <|> (emptyOrComLine >> indent i >> items)
104
+ where
105
+ items = sepBy parseString ((skipSpace *> char ' ,' *> skipSpace) <|> (space *> skipSpace))
108
106
109
107
pathMain :: Indent -> [Text ] -> Text -> [Text ] -> [Text ] -> Parser [Text ]
110
108
pathMain i p m o a =
@@ -185,4 +183,4 @@ indent i = do
185
183
if c >= i then pure c else fail " insufficient indent"
186
184
187
185
extractPkgs :: Parser [T. Text ]
188
- extractPkgs = join . catMaybes <$> many' (Just <$> field 0 " packages" parseList <|> (skipToNextLine >> pure Nothing ))
186
+ extractPkgs = join . catMaybes <$> many' (Just <$> field 0 " packages" parseOptCommaList <|> (skipToNextLine >> pure Nothing ))
You can’t perform that action at this time.
0 commit comments