summaryrefslogtreecommitdiff
path: root/src/Parser/Core.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-04-16 21:44:20 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-04-18 22:25:18 +0200
commitbaa086bd025ce49a75d8cc9d64d24615ab960357 (patch)
treef1ce6d3a889a91a3efaa43c08e26171267f6dc38 /src/Parser/Core.hs
parentf0eed671c65a31eeb34ece14547bea79eb753728 (diff)
Shell interpreter for test script
Changelog: Experimental shell interpreter
Diffstat (limited to 'src/Parser/Core.hs')
-rw-r--r--src/Parser/Core.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Parser/Core.hs b/src/Parser/Core.hs
index abd8b96..d90f227 100644
--- a/src/Parser/Core.hs
+++ b/src/Parser/Core.hs
@@ -255,6 +255,18 @@ listOf item = do
x <- item
(x:) <$> choice [ symbol "," >> listOf item, return [] ]
+blockOf :: Monoid a => Pos -> TestParser a -> TestParser a
+blockOf indent step = go
+ where
+ go = do
+ scn
+ pos <- L.indentLevel
+ optional eof >>= \case
+ Just _ -> return mempty
+ _ | pos < indent -> return mempty
+ | pos == indent -> mappend <$> step <*> go
+ | otherwise -> L.incorrectIndent EQ indent pos
+
getSourceLine :: TestParser SourceLine
getSourceLine = do