From ec5baf4e97060ac7d3de5fb97eabed7f5bdbd685 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 18 May 2008 11:34:05 +0000 Subject: [PATCH] Stopped the Rain parser using any as a placeholder, and switched to using the unknown types --- frontends/ParseRain.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontends/ParseRain.hs b/frontends/ParseRain.hs index 6ae6b6a..5e5b8a3 100644 --- a/frontends/ParseRain.hs +++ b/frontends/ParseRain.hs @@ -223,11 +223,13 @@ integerLiteral = do (val, i) <- integer listLiteral :: RainParser A.Expression listLiteral = try $ do m <- sLeftQ + u <- getUniqueIdentifer + let t = A.List $ A.UnknownVarType (Right (m,u)) (do try sRightQ - return $ A.Literal m (A.List A.Any) $ A.ListLiteral m [] + return $ A.Literal m t $ A.ListLiteral m [] <|> do e0 <- try expression (do try sRightQ - return $ A.Literal m (A.List A.Any) $ + return $ A.Literal m t $ A.ListLiteral m [e0] -- Up until the first comma, this may be a type declaration -- in a cast expression, so we "try" all the way @@ -235,7 +237,7 @@ listLiteral <|> do try sComma es <- sepBy1 expression sComma sRightQ - return $ A.Literal m (A.List A.Any) $ + return $ A.Literal m t $ A.ListLiteral m (e0 : es) ) ) @@ -266,8 +268,10 @@ range = try $ do m <- sLeftQ (A.List t) (A.Conversion mc A.DefaultConversion t begin) (A.Conversion mc A.DefaultConversion t end) - Nothing -> return $ A.ExprConstr m $ A.RangeConstr m - (A.List A.Any) begin end + Nothing -> do u <- getUniqueIdentifer + let t = A.List $ A.UnknownVarType (Right (m,u)) + return $ A.ExprConstr m $ A.RangeConstr m + t begin end expression :: RainParser A.Expression expression