Testing the integer parser.

master
Philippe Pittoli 2024-01-10 06:26:43 +01:00
parent 3bc9cb6f66
commit 060467bcc4
2 changed files with 5 additions and 2 deletions

View File

@ -52,6 +52,11 @@ main = do
Just (Tuple x y) -> show x <> " " <> show y Just (Tuple x y) -> show x <> " " <> show y
Nothing -> "failed" Nothing -> "failed"
log $ "parsing integer in '-19ab' (integer): " <>
case parse integer "-19ab" of
Just (Tuple x y) -> show x <> " " <> show y
Nothing -> "failed"
-- JUST WORKS -- JUST WORKS
-- isffound $ parse isf "fable" -- isffound $ parse isf "fable"
-- isffound $ parse isf "f" -- isffound $ parse isf "f"

View File

@ -131,8 +131,6 @@ int = do _ <- char '-'
pure (-n) pure (-n)
<|> nat <|> nat
-- Handling spacing
isSpace :: Char -> Boolean isSpace :: Char -> Boolean
isSpace c = A.any (\v -> v == c) [' ', '\t', ' ', '\r', '\n'] isSpace c = A.any (\v -> v == c) [' ', '\t', ' ', '\r', '\n']