From baa086bd025ce49a75d8cc9d64d24615ab960357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 16 Apr 2025 21:44:20 +0200 Subject: Shell interpreter for test script Changelog: Experimental shell interpreter --- src/Parser/Core.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Parser/Core.hs') 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 -- cgit v1.2.3