Code structure.

This commit is contained in:
Philippe Pittoli 2024-01-19 00:59:47 +01:00
parent 40bae65ab7
commit 27817ff3aa
5 changed files with 17 additions and 10 deletions

7
src/GenericParser.purs Normal file
View File

@ -0,0 +1,7 @@
module GenericParser
( module GenericParser.Parser
, module GenericParser.DomainParser
) where
import GenericParser.Parser (Position, PositionString, Input, Error, Value, Result, Parser(..), parse, current_position, failError, fail, success, item, sat, digit, lower, upper, letter, alphanum, char, string, ident, nat, int, space, token, identifier, natural, integer, symbol, many1)
import GenericParser.DomainParser (Size, DomainError(..), let_dig, let_dig_hyp, ldh_str, label_maxsize, max_domain_length, last_char, parse_last_char, tryMaybe, try, label, subdomain, eof, sub_eof, domain)

View File

@ -1,4 +1,4 @@
module BaseFunctions where module GenericParser.BaseFunctions where
import Prelude (between, (<>), (==)) import Prelude (between, (<>), (==))

View File

@ -1,5 +1,5 @@
-- | `DomainParser` is a simple parser for domain names as described in RFC 1035. -- | `DomainParser` is a simple parser for domain names as described in RFC 1035.
module DomainParser where module GenericParser.DomainParser where
import Prelude (bind, not, pure, ($), (&&), (*>), (<<<), (<>), (>), (-)) import Prelude (bind, not, pure, ($), (&&), (*>), (<<<), (<>), (>), (-))
@ -12,7 +12,7 @@ import Data.String.CodeUnits as CU
import Control.Alt ((<|>)) import Control.Alt ((<|>))
-- import Control.Plus (empty) -- import Control.Plus (empty)
import Parser (Parser(..) import GenericParser.Parser (Parser(..)
, success, failError , success, failError
, current_position , current_position
, alphanum, char, letter, many1, parse, string) , alphanum, char, letter, many1, parse, string)

View File

@ -1,4 +1,4 @@
module Parser where module GenericParser.Parser where
import Prelude import Prelude
import Control.Alt (class Alt, (<|>)) import Control.Alt (class Alt, (<|>))
@ -12,7 +12,7 @@ import Data.Either (Either(..))
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.String.CodeUnits (toCharArray, fromCharArray) import Data.String.CodeUnits (toCharArray, fromCharArray)
import BaseFunctions (concat, isAlpha, isAlphaNum, isDigit, isLower, isSpace, isUpper) import GenericParser.BaseFunctions (concat, isAlpha, isAlphaNum, isDigit, isLower, isSpace, isUpper)
type Position = Int type Position = Int
type PositionString = { string :: String, position :: Position } type PositionString = { string :: String, position :: Position }

View File

@ -1,7 +1,7 @@
module Main where module Main where
import Parser (Parser(..)) import GenericParser.Parser (Parser(..))
import DomainParser (domain, label, ldh_str, sub_eof, subdomain, DomainError(..)) import GenericParser.DomainParser (domain, label, ldh_str, sub_eof, subdomain, DomainError(..))
import Prelude (Unit, discard, show, ($), (<>)) import Prelude (Unit, discard, show, ($), (<>))
import Data.Either (Either(..)) import Data.Either (Either(..))