on master help sign in
Properly handle tuples and parens in type parser
commitb5670221683deaee7653fee4e221c6b364cf6627 authorEvan Czaplicki <evancz@users.noreply.github.com> dateSun 4 Dec 2016, 19:50 (10 years ago) parentfcf5cef
1 file changed+9−2
src/Parse/Type.hs+9−2
src/Parse/Type.hs+9−2
@@ -115,8 +115,15 @@ tuple :: Parser Type.Raw
115115tuple =
116116 do start <- getPosition
117117 leftParen
118− spaces
119− tupleEnding start []
118+ oneOf
119+ [ do rightParen
120+ end <- getPosition
121+ return (Type.tuple (R.Region start end) [])
122+ , do spaces
123+ (tipe, _, space) <- expression
124+ checkSpaces space
125+ tupleEnding start [tipe]
126+ ]
120127
121128
122129tupleEnding :: R.Position -> [Type.Raw] -> Parser Type.Raw