diff --git a/src/Nirum/Parser.hs b/src/Nirum/Parser.hs index ad116c9..e458095 100644 --- a/src/Nirum/Parser.hs +++ b/src/Nirum/Parser.hs @@ -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 } diff --git a/test/Nirum/ParserSpec.hs b/test/Nirum/ParserSpec.hs index 0259c7e..68f29bb 100644 --- a/test/Nirum/ParserSpec.hs +++ b/test/Nirum/ParserSpec.hs @@ -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, \