aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/src/Text/Edifact/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Text/Edifact/Common.hs')
-rw-r--r--core/src/Text/Edifact/Common.hs39
1 files changed, 39 insertions, 0 deletions
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 @@
1{-|
2Module : Text.Edifact.Common
3Description : Common syntax
4
5This module should handle the main revision of the Edifact specification, which
6covers UN* segments.
7
8Currently it barely covers the revision 3 and this has not been scaffolded.
9
10One future evolution will be to scaffold the various revisions from a more
11general specification.
12 -}
13module Text.Edifact.Common
14 (
15 -- * Routine
16 parseFull
17
18 -- * Reexports
19 , ParseError
20 , Parser
21 , Text
22 ) where
23
24import Text.Edifact.Parsing
25import Text.Edifact.Parsing.Commons
26
27import Text.Edifact.Common.Segments
28
29import Data.Text (Text)
30
31parseFull :: Parser value -> Text -> Either ParseError value
32parseFull = parse . fullSyntaxParser
33
34fullSyntaxParser :: Parser a -> Parser a
35fullSyntaxParser messageParser =
36 segmentUNA >>
37 tries [ segmentUNB *> messageParser <* segmentUNZ
38 , messageParser
39 ]