Skip to content

Commit

Permalink
Parse trailling comma & multiline
Browse files Browse the repository at this point in the history
  • Loading branch information
kanghyojun committed Apr 19, 2018
1 parent c68058f commit 6b824da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Nirum/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,16 @@ imports forwardNames = do
spaces
char '('
spaces
idents <- many' [] $ \ importNames' -> do
idents <- many' [] $ \ importNames' -> try $ do
let forwardNames' = [ i | (_, i, _) <- importNames' ] ++
forwardNames
unless (L.null importNames') $ do
string' ","
spaces
i <- importName forwardNames'
spaces
return i
importName forwardNames'
when (L.null idents) $ fail "parentheses cannot be empty"
void $ optional $ string' ","
spaces
char ')'
spaces
char ';'
Expand Down

0 comments on commit 6b824da

Please sign in to comment.