diff options
author | Marvin Borner | 2023-02-23 14:59:34 +0100 |
---|---|---|
committer | Marvin Borner | 2023-02-23 14:59:34 +0100 |
commit | 99d8f364d6376886dd49a51ff4c3afe13337cfc4 (patch) | |
tree | 6952df5babd0fbdf282978d91248e3ef93ffa140 /src/Parser.hs | |
parent | 2940495ac437a23084383567be6b3bef9ee9fb8d (diff) |
Added time instruction
Diffstat (limited to 'src/Parser.hs')
-rw-r--r-- | src/Parser.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Parser.hs b/src/Parser.hs index 676bf37..92c33df 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -265,12 +265,18 @@ parseComment = do _ <- some $ noneOf "\r\n" return () +parseTime :: Parser Instruction +parseTime = do + _ <- string ":time" <* sc <?> "time instruction" + e <- parseExpression + pure $ Time e + parseImport :: Parser Command parseImport = do _ <- string ":import" <* sc <?> "import instruction" path <- importPath ns <- (try $ sc *> (namespace <|> string ".")) <|> (eof >> return "") - pure (Import (path ++ ".bruijn") ns) + pure $ Import (path ++ ".bruijn") ns parseInput :: Parser Command parseInput = do @@ -318,4 +324,5 @@ parseReplLine = <|> ((Commands . (: [])) <$> (try parseTest)) <|> ((Commands . (: [])) <$> (try parseInput)) <|> ((Commands . (: [])) <$> (try parseImport)) + <|> try parseTime <|> try parseEvaluate |