aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Parser.hs
diff options
context:
space:
mode:
authorMarvin Borner2023-02-23 15:29:44 +0100
committerMarvin Borner2023-02-23 15:29:44 +0100
commitf452a6f311408ea78e5fce765766c98acca33188 (patch)
treebadb08607c84eff28149d5602d8f50643cc047e7 /src/Parser.hs
parent99d8f364d6376886dd49a51ff4c3afe13337cfc4 (diff)
Added free command (doesn't really work though)
Diffstat (limited to 'src/Parser.hs')
-rw-r--r--src/Parser.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index 92c33df..b572f9a 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -265,12 +265,17 @@ parseComment = do
_ <- some $ noneOf "\r\n"
return ()
-parseTime :: Parser Instruction
+parseTime :: Parser Command
parseTime = do
_ <- string ":time" <* sc <?> "time instruction"
e <- parseExpression
pure $ Time e
+parseClearState :: Parser Command
+parseClearState = do
+ _ <- string ":free" <?> "free instruction"
+ pure ClearState
+
parseImport :: Parser Command
parseImport = do
_ <- string ":import" <* sc <?> "import instruction"
@@ -321,8 +326,9 @@ parseBlock lvl =
parseReplLine :: Parser Instruction
parseReplLine =
try parseReplDefine -- TODO: This is kinda hacky
- <|> ((Commands . (: [])) <$> (try parseTest))
- <|> ((Commands . (: [])) <$> (try parseInput))
- <|> ((Commands . (: [])) <$> (try parseImport))
- <|> try parseTime
+ <|> ((Commands . (: [])) <$> try parseTest)
+ <|> ((Commands . (: [])) <$> try parseInput)
+ <|> ((Commands . (: [])) <$> try parseImport)
+ <|> ((Commands . (: [])) <$> try parseTime)
+ <|> ((Commands . (: [])) <$> try parseClearState)
<|> try parseEvaluate