Testing the integer parser.
parent
3bc9cb6f66
commit
060467bcc4
|
@ -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"
|
||||||
|
|
|
@ -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']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue