diff --git a/src/GenericParser.purs b/src/GenericParser.purs index 5fe5df1..fa8bdfb 100644 --- a/src/GenericParser.purs +++ b/src/GenericParser.purs @@ -1,7 +1,9 @@ module GenericParser ( module GenericParser.Parser - , module GenericParser.DomainParserRFC1035 + , module GenericParser.DomainParser.Common + , module GenericParser.DomainParser ) where +import GenericParser.DomainParser.Common (DomainError(..), eof, ldh_str, let_dig, let_dig_hyp, max_domain_length, max_label_length, Size) +import GenericParser.DomainParser (domain, label, subdomain, sub_eof) import GenericParser.Parser (alphanum, char, current_position, digit, Error, failure, failureError, ident, identifier, Input, int, integer, item, letter, lower, many1, nat, natural, parse, Parser(..), Position, PositionString, Result, sat, space, string, success, symbol, token, try, tryMaybe, upper, Value) -import GenericParser.DomainParserRFC1035 (domain, DomainError(..), eof, label, ldh_str, let_dig, let_dig_hyp, max_domain_length, max_label_length, Size, subdomain, sub_eof) diff --git a/src/GenericParser/DomainParser.purs b/src/GenericParser/DomainParser.purs new file mode 100644 index 0000000..17b7e30 --- /dev/null +++ b/src/GenericParser/DomainParser.purs @@ -0,0 +1,91 @@ +-- | `DomainParser` is a parser for modern domain names as seen in practice. +-- | See `DomainParserRFC1035` for a domain parser restricted to RFC1035 recommandations. +module GenericParser.DomainParser where + +import Prelude (bind, not, pure, ($), (&&), (*>), (<<<), (<>), (>), (-)) + +import Control.Alt ((<|>)) +import Control.Lazy (defer) +import Data.Array as A +import Data.Either (Either(..)) +import Data.Maybe (Maybe(..), maybe) +import Data.String as S +import Data.String.CodeUnits as CU + +-- Import all common functions between RFC1035 and modern domain parsing. +import GenericParser.DomainParser.Common (DomainError(..), eof, ldh_str, let_dig, let_dig_hyp, max_domain_length, max_label_length, Size) + +import GenericParser.Parser (Parser(..) + , success, failureError + , current_position + , alphanum, char, letter, many1, parse, string + , try, tryMaybe) + +-- | From RFC 1035: