diff options
Diffstat (limited to 'src/Parser.hs')
-rw-r--r-- | src/Parser.hs | 16 |
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 |