From 15f4983fe24bfe6a4bb57ea203cda4783ae190d6 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sat, 13 Jan 2024 01:39:16 +0100 Subject: [PATCH] sub_eof --- src/DomainParser.purs | 66 ++++++++++++++++++++----------------------- src/Main.purs | 23 +++++++++++++++ 2 files changed, 54 insertions(+), 35 deletions(-) diff --git a/src/DomainParser.purs b/src/DomainParser.purs index bb996e6..3bcc59b 100644 --- a/src/DomainParser.purs +++ b/src/DomainParser.purs @@ -16,16 +16,16 @@ import Control.Plus (empty) import Parser --- From RFC 1035: ::= | +-- | From RFC 1035: ::= | let_dig :: Parser Char let_dig = alphanum --- From RFC 1035: ::= | "-" --- Either a Letter, Digital or an Hyphenation character. +-- | From RFC 1035: ::= | "-" +-- | Either a Letter, Digital or an Hyphenation character. let_dig_hyp :: Parser Char let_dig_hyp = let_dig <|> char '-' --- From RFC 1035: ::= | +-- | From RFC 1035: ::= | ldh_str :: Parser (Array Char) ldh_str = many1 let_dig_hyp @@ -33,6 +33,10 @@ ldh_str = many1 let_dig_hyp label_maxsize :: Int label_maxsize = 7 +-- TODO: 255? +max_domain_length :: Int +max_domain_length = 15 + last_char :: String -> Maybe Char last_char = A.last <<< CU.toCharArray @@ -54,7 +58,7 @@ try p = Parser p' Nothing -> Just (Tuple mempty str) -- FIXME! Need a better base structure. Just x -> pure x --- From RFC 1035: