From 668c8c4d0eefe23c50ca02937f46b343aa601680 Mon Sep 17 00:00:00 2001 From: Oriol Linan Date: Tue, 7 Jan 2025 22:16:50 +0100 Subject: [PATCH] fix: env returns to original state after `Block` --- lib/Ast/Parser/Expr.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Ast/Parser/Expr.hs b/lib/Ast/Parser/Expr.hs index 2082df1..9e9ee43 100644 --- a/lib/Ast/Parser/Expr.hs +++ b/lib/Ast/Parser/Expr.hs @@ -102,11 +102,11 @@ parseWhile = do body <- parseBlock return $ AT.While {AT.whileLoc = srcLoc, AT.whileCond = cond, AT.whileBody = body} --- TODO: manage new state in blocks - parseBlock :: PU.Parser AT.Expr parseBlock = do + env <- S.get es <- M.between (PU.symbol "{") (PU.symbol "}") $ M.many $ PU.lexeme parseExpr + S.modify $ const env return $ AT.Block es parseReturn :: PU.Parser AT.Expr