summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-09-25 21:01:41 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-09-26 22:18:41 +0200
commit1621f4c017f88b7c89d095748112812c58e5d530 (patch)
treea92c8116f2d3c33a71ac9a9a4681b70bc3f9a01a /src
parent95af762bfd976af7b010abd5353a84df92c83068 (diff)
Local statement for separate scope
Diffstat (limited to 'src')
-rw-r--r--src/Parser.hs14
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