From e1c6a6f1e9d7dae51992836724c9aac1ec4c38a0 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Fri, 19 Jan 2024 19:32:03 +0100 Subject: [PATCH] Accept an underscore as a label prefix in the modern domain parser. --- src/GenericParser/DomainParser.purs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GenericParser/DomainParser.purs b/src/GenericParser/DomainParser.purs index 17b7e30..5a080ca 100644 --- a/src/GenericParser/DomainParser.purs +++ b/src/GenericParser/DomainParser.purs @@ -26,13 +26,14 @@ import GenericParser.Parser (Parser(..) label :: Parser DomainError String label = do pos <- current_position + maybeu <- tryMaybe $ char '_' maybel <- tryMaybe letter case maybel of Nothing -> Parser \_ -> failureError pos (Just InvalidCharacter) Just l -> do s <- tryMaybe ldh_str 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) then Parser \_ -> failureError pos (Just <<< LabelTooLarge $ S.length labelstr) else if (S.length labelstr > 1 && not (parse_last_char labelstr let_dig))