diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2022-09-25 21:01:41 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2022-09-26 22:18:41 +0200 |
commit | 1621f4c017f88b7c89d095748112812c58e5d530 (patch) | |
tree | a92c8116f2d3c33a71ac9a9a4681b70bc3f9a01a | |
parent | 95af762bfd976af7b010abd5353a84df92c83068 (diff) |
Local statement for separate scope
-rw-r--r-- | src/Parser.hs | 14 |
1 files changed, 14 insertions, 0 deletions
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 |