]> git.immae.eu Git - github/fretlink/edi-parser.git/blob - core/src/Text/Edifact/Common.hs
Release code as open source
[github/fretlink/edi-parser.git] / core / src / Text / Edifact / Common.hs
1 {-|
2 Module : Text.Edifact.Common
3 Description : Common syntax
4
5 This module should handle the main revision of the Edifact specification, which
6 covers UN* segments.
7
8 Currently it barely covers the revision 3 and this has not been scaffolded.
9
10 One future evolution will be to scaffold the various revisions from a more
11 general specification.
12 -}
13 module Text.Edifact.Common
14 (
15 -- * Routine
16 parseFull
17
18 -- * Reexports
19 , ParseError
20 , Parser
21 , Text
22 ) where
23
24 import Text.Edifact.Parsing
25 import Text.Edifact.Parsing.Commons
26
27 import Text.Edifact.Common.Segments
28
29 import Data.Text (Text)
30
31 parseFull :: Parser value -> Text -> Either ParseError value
32 parseFull = parse . fullSyntaxParser
33
34 fullSyntaxParser :: Parser a -> Parser a
35 fullSyntaxParser messageParser =
36 segmentUNA >>
37 tries [ segmentUNB *> messageParser <* segmentUNZ
38 , messageParser
39 ]