Skip to content

Commit

Permalink
Allow spaces right before/after tag parentheses (#71)
Browse files Browse the repository at this point in the history
Fix #69
  • Loading branch information
dahlia authored Aug 26, 2016
1 parent 0666b8d commit e4c378c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Nirum/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ tag = do
spaces
paren <- optional $ char '('
fields' <- case paren of
Just _ -> do { f <- fieldSet <?> "union tag fields"
Just _ -> do { spaces
; f <- fieldSet <?> "union tag fields"
; spaces
; char ')'
; return f
}
Expand Down
11 changes: 11 additions & 0 deletions test/Nirum/ParserSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,17 @@ spec = do
\point lower-right,)\n\
\ | none\n\
\ ;" `shouldBeRight` a
parse' "union shape\n\
\ = circle (\n\
\ point origin,\n\
\ offset radius,\n\
\ )\n\
\ | rectangle (\n\
\ point upper-left,\n\
\ point lower-right,\n\
\ )\n\
\ | none\n\
\ ;" `shouldBeRight` a
parse' "union shape\n\
\ # shape type\n\
\ = circle (point origin, \
Expand Down

0 comments on commit e4c378c

Please sign in to comment.