From a9d77a20008efe82862cc1adbfa7a6d4f09f8ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Thu, 8 Dec 2016 10:19:15 +0200 Subject: Release code as open source --- core/src/Text/Edifact/Common.hs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 core/src/Text/Edifact/Common.hs (limited to 'core/src/Text/Edifact/Common.hs') diff --git a/core/src/Text/Edifact/Common.hs b/core/src/Text/Edifact/Common.hs new file mode 100644 index 0000000..c938d48 --- /dev/null +++ b/core/src/Text/Edifact/Common.hs @@ -0,0 +1,39 @@ +{-| +Module : Text.Edifact.Common +Description : Common syntax + +This module should handle the main revision of the Edifact specification, which +covers UN* segments. + +Currently it barely covers the revision 3 and this has not been scaffolded. + +One future evolution will be to scaffold the various revisions from a more +general specification. + -} +module Text.Edifact.Common + ( + -- * Routine + parseFull + + -- * Reexports + , ParseError + , Parser + , Text + ) where + +import Text.Edifact.Parsing +import Text.Edifact.Parsing.Commons + +import Text.Edifact.Common.Segments + +import Data.Text (Text) + +parseFull :: Parser value -> Text -> Either ParseError value +parseFull = parse . fullSyntaxParser + +fullSyntaxParser :: Parser a -> Parser a +fullSyntaxParser messageParser = + segmentUNA >> + tries [ segmentUNB *> messageParser <* segmentUNZ + , messageParser + ] -- cgit v1.2.3