]> git.immae.eu Git - github/fretlink/edi-parser.git/blob - core/src/Text/Edifact/Parsing.hs
Release code as open source
[github/fretlink/edi-parser.git] / core / src / Text / Edifact / Parsing.hs
1 {-|
2 Module : Text.Edifact.Parsing
3 Description : Parsing routines and combinators
4
5 This module is there to reexport most of the combinators and helpers required
6 to parse an Edifact payload.
7
8 For high level combinators, have a look at "Text.Edifact.Parsing.Combinators".
9
10 For low level combinators, have a look at "Text.Edifact.Parsing.Primitives".
11 -}
12 module Text.Edifact.Parsing
13 (
14 -- * Parsing routines
15 parse
16
17 -- * Combinators
18 -- | See "Text.Edifact.Parsing.Combinators" for more details
19
20 -- ** Values parsers
21 , message
22 , segment
23 , segmentGroup
24 , composite
25 , simple
26
27 -- ** Position and strictness
28 , position
29 , (.@)
30 , (@.)
31 , mandatory
32 , optional
33
34 -- ** Repetition of segments and segment groups
35 , repeated
36 , repeatedAtLeastOnce
37 , once
38 , maybeOnce
39
40 -- * Primitives
41 -- | See "Text.Edifact.Parsing.Primitives" for more details and known limitations.
42
43 -- ** Simple elements definition
44 , alphaNumeric
45 , alpha
46 , numeric
47 -- ** Cardinality
48 , exactly
49 , upTo
50 , many
51
52 -- * Types
53 , Parser
54 -- ** Reexported
55 , ParseError
56 ) where
57
58 import Text.Edifact.Parsing.Combinators (composite, mandatory,
59 maybeOnce, message, once,
60 optional, position, repeated,
61 repeatedAtLeastOnce, segment,
62 segmentGroup, simple, (.@),
63 (@.))
64 import Text.Edifact.Parsing.Commons (Parser, defaultContext)
65 import Text.Edifact.Parsing.Primitives (alpha, alphaNumeric, exactly,
66 many, numeric, upTo)
67
68 import Data.Text (Text)
69 import Text.Parsec (ParseError, runParser)
70
71 parse :: Parser value -> Text -> Either ParseError value
72 parse p = runParser p defaultContext ""