mirror of
https://github.com/zoriya/applicative-getopt.git
synced 2025-12-06 05:36:09 +00:00
Token parser
This commit is contained in:
@@ -45,6 +45,9 @@ charIf f = do
|
||||
x <- char
|
||||
if f x then return x else empty
|
||||
|
||||
alphaNum :: Parser Char
|
||||
alphaNum = charIf isAlphaNum
|
||||
|
||||
digit :: Parser Char
|
||||
digit = charIf isDigit
|
||||
|
||||
@@ -67,6 +70,13 @@ maybeInt = P $ \str -> case parse int str of
|
||||
Nothing -> Just (Nothing, str)
|
||||
Just (y, lo) -> Just (Just y, lo)
|
||||
|
||||
token :: Parser a -> Parser a
|
||||
token p = do
|
||||
many $ charIf isSpace
|
||||
ret <- p
|
||||
many $ charIf isSpace
|
||||
return ret
|
||||
|
||||
data Configuration = Configuration {
|
||||
rule :: Int,
|
||||
start :: Maybe Int,
|
||||
|
||||
Reference in New Issue
Block a user