diff options
author | Marvin Borner | 2022-03-03 15:56:53 +0100 |
---|---|---|
committer | Marvin Borner | 2022-03-03 15:56:53 +0100 |
commit | 4d5aa27a4636abcf58afeec83e598118eb02fb5c (patch) | |
tree | ead37ffe2b89e2f692a71672c4ec1fab00487b06 /src/Fun/Parser.hs | |
parent | 65293eedaf3469bb0f4a0b174cd53bb89c762ff5 (diff) |
Tree
Diffstat (limited to 'src/Fun/Parser.hs')
-rw-r--r-- | src/Fun/Parser.hs | 11 |
1 files changed, 5 insertions, 6 deletions
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 "<something>"] $ Nothing +iterFull' _ = Left $ State [] $ Nothing token :: Parser a -> Parser a token = (<+-> space) |