From 1621f4c017f88b7c89d095748112812c58e5d530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 25 Sep 2022 21:01:41 +0200 Subject: Local statement for separate scope --- src/Parser.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Parser.hs b/src/Parser.hs index 5b8f003..c8593b3 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -419,6 +419,19 @@ command name (CommandDef types ctor) = do ] tryParams _ _ _ _ [] = mzero +testLocal :: TestParser [TestStep] +testLocal = do + ref <- L.indentLevel + wsymbol "local" + symbol ":" + void $ eol + + indent <- L.indentGuard scn GT ref + s <- get + body <- testBlock indent + put s + return body + testSpawn :: TestParser [TestStep] testSpawn = command "spawn" $ Spawn <$> param "as" @@ -464,6 +477,7 @@ testBlock indent = concat <$> go testStep :: TestParser [TestStep] testStep = choice [ letStatement + , testLocal , testSpawn , testSend , testExpect -- cgit v1.2.3