diff options
author | Marvin Borner | 2022-04-24 15:45:39 +0200 |
---|---|---|
committer | Marvin Borner | 2022-04-24 15:45:39 +0200 |
commit | b2cca2c5584ee92a2fbd006ca7d33f4dddec7d93 (patch) | |
tree | b7a2b54cbc1184b80cf0e1e6387b6b54b9688b0b /src/Parser.hs | |
parent | 3b90d4f15ebad7dc15d78195397559bcca3bd8fb (diff) |
Tests
Diffstat (limited to 'src/Parser.hs')
-rw-r--r-- | src/Parser.hs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/Parser.hs b/src/Parser.hs index 6fbeca4..33b3c44 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -6,7 +6,7 @@ module Parser import Control.Monad ( ap ) import Data.Functor.Identity import Helper -import Text.Parsec +import Text.Parsec hiding ( parseTest ) import Text.Parsec.Language import qualified Text.Parsec.Token as Token @@ -107,9 +107,23 @@ parseComment = string "#" >> Comment <$> almostAnything parseLoad :: Parser Instruction parseLoad = string ":load " >> Load <$> almostAnything +parseTest :: Parser Instruction +parseTest = do + string ":test " + exp1 <- parseExpression + spaces + reservedOp "=" + spaces + exp2 <- parseExpression + pure $ Test exp1 exp2 + parseLine :: Parser Instruction -parseLine = try parseDefine <|> parseComment +parseLine = try parseDefine <|> try parseComment <|> try parseTest parseReplLine :: Parser Instruction parseReplLine = - try parseReplDefine <|> parseComment <|> parseEvaluate <|> parseLoad + try parseReplDefine + <|> try parseComment + <|> try parseEvaluate + <|> try parseLoad + <|> try parseTest |