Compare commits
2 Commits
bbb5c1c415
...
e1c6a6f1e9
Author | SHA1 | Date | |
---|---|---|---|
e1c6a6f1e9 | |||
d4cbcb8b99 |
@ -26,13 +26,14 @@ import GenericParser.Parser (Parser(..)
|
|||||||
label :: Parser DomainError String
|
label :: Parser DomainError String
|
||||||
label = do
|
label = do
|
||||||
pos <- current_position
|
pos <- current_position
|
||||||
|
maybeu <- tryMaybe $ char '_'
|
||||||
maybel <- tryMaybe letter
|
maybel <- tryMaybe letter
|
||||||
case maybel of
|
case maybel of
|
||||||
Nothing -> Parser \_ -> failureError pos (Just InvalidCharacter)
|
Nothing -> Parser \_ -> failureError pos (Just InvalidCharacter)
|
||||||
Just l -> do
|
Just l -> do
|
||||||
s <- tryMaybe ldh_str
|
s <- tryMaybe ldh_str
|
||||||
lastpos <- current_position
|
lastpos <- current_position
|
||||||
let labelstr = CU.singleton l <> maybe "" CU.fromCharArray s
|
let labelstr = maybe "" (\_ -> "_") maybeu <> CU.singleton l <> maybe "" CU.fromCharArray s
|
||||||
if (S.length labelstr > max_label_length)
|
if (S.length labelstr > max_label_length)
|
||||||
then Parser \_ -> failureError pos (Just <<< LabelTooLarge $ S.length labelstr)
|
then Parser \_ -> failureError pos (Just <<< LabelTooLarge $ S.length labelstr)
|
||||||
else if (S.length labelstr > 1 && not (parse_last_char labelstr let_dig))
|
else if (S.length labelstr > 1 && not (parse_last_char labelstr let_dig))
|
||||||
|
@ -121,8 +121,10 @@ try p = Parser p'
|
|||||||
_ -> failureError position error
|
_ -> failureError position error
|
||||||
|
|
||||||
sat :: forall e. (Char -> Boolean) -> Parser e Char
|
sat :: forall e. (Char -> Boolean) -> Parser e Char
|
||||||
sat p = do x <- item
|
sat p = do
|
||||||
if p x then pure x else empty
|
pos <- current_position
|
||||||
|
x <- item
|
||||||
|
if p x then pure x else Parser \input -> failure pos
|
||||||
|
|
||||||
digit :: forall e. Parser e Char
|
digit :: forall e. Parser e Char
|
||||||
digit = sat isDigit
|
digit = sat isDigit
|
||||||
|
Loading…
Reference in New Issue
Block a user