@@ -213,6 +213,11 @@ binaryExpr =
214ifExpr :: IParser Source.Expr'
214ifExpr :: IParser Source.Expr'
219+ifHelp :: [(Source.Expr, Source.Expr)] -> IParser Source.Expr'
216 do try (reserved "if")
221 do try (reserved "if")
217 whitespace
222 whitespace
218 condition <- expr
223 condition <- expr
@@ -221,8 +226,11 @@ ifExpr =
221 whitespace <?> "an 'else' branch"
226 whitespace <?> "an 'else' branch"
222 reserved "else" <?> "an 'else' branch"
227 reserved "else" <?> "an 'else' branch"
223 whitespace
228 whitespace
224− elseBranch <- expr
229+ let newBranches = (condition, thenBranch) : branches
225− return (E.If [(condition, thenBranch)] elseBranch)
230+ choice
231+ [ ifHelp newBranches
232+ , E.If (reverse newBranches) <$> expr
228lambdaExpr :: IParser Source.Expr
236lambdaExpr :: IParser Source.Expr