From 4d5aa27a4636abcf58afeec83e598118eb02fb5c Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 3 Mar 2022 15:56:53 +0100 Subject: Tree --- src/Fun/Parser.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/Fun/Parser.hs') diff --git a/src/Fun/Parser.hs b/src/Fun/Parser.hs index 0a16bc0..ff1e6bb 100644 --- a/src/Fun/Parser.hs +++ b/src/Fun/Parser.hs @@ -18,16 +18,16 @@ upperAlpha :: [Char] upperAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ" isDigit :: Char -> Bool -isDigit c = elem c "0123456789" +isDigit = (`elem` "0123456789") isAlpha :: Char -> Bool -isAlpha c = elem c $ lowerAlpha ++ upperAlpha +isAlpha = (`elem` lowerAlpha ++ upperAlpha) isLower :: Char -> Bool -isLower c = elem c lowerAlpha +isLower = (`elem` lowerAlpha) isUpper :: Char -> Bool -isUpper c = elem c upperAlpha +isUpper = (`elem` upperAlpha) ---- @@ -94,11 +94,10 @@ oneOrMore m = (iter m) <=> (/= "") "one or more chars" iter :: Parser a -> Parser [a] iter m = m <+> iter m >>> (\(x, y) -> x : y) <|> result [] "multiple" --- TODO: Improve this for better error reporting iterFull :: Parser a -> Parser [a] iterFull m = m <+> iterFull m >>> (\(x, y) -> x : y) <|> iterFull' iterFull' "" = Right ([], "") -iterFull' _ = Left $ State [StringTrace ""] $ Nothing +iterFull' _ = Left $ State [] $ Nothing token :: Parser a -> Parser a token = (<+-> space) -- cgit v1.2.3