on master help sign in
Properly handle tuples and parens in type parser
b567022Evan Czaplicki
src/Parse/Type.hs+9−2
@@ -115,8 +115,15 @@ tuple :: Parser Type.Raw
115tuple =
115tuple =
116 do start <- getPosition
116 do start <- getPosition
117 leftParen
117 leftParen
118+ oneOf
119+ [ do rightParen
120+ end <- getPosition
121+ return (Type.tuple (R.Region start end) [])
118− spaces
122+ , do spaces
123+ (tipe, _, space) <- expression
124+ checkSpaces space
119− tupleEnding start []
125+ tupleEnding start [tipe]
126+ ]
120
127
121
128
122tupleEnding :: R.Position -> [Type.Raw] -> Parser Type.Raw
129tupleEnding :: R.Position -> [Type.Raw] -> Parser Type.Raw