aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/src/Text/Edifact/Parsing.hs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Text/Edifact/Parsing.hs')
-rw-r--r--core/src/Text/Edifact/Parsing.hs72
1 files changed, 72 insertions, 0 deletions
diff --git a/core/src/Text/Edifact/Parsing.hs b/core/src/Text/Edifact/Parsing.hs
new file mode 100644
index 0000000..0b1ece8
--- /dev/null
+++ b/core/src/Text/Edifact/Parsing.hs
@@ -0,0 +1,72 @@
1{-|
2Module : Text.Edifact.Parsing
3Description : Parsing routines and combinators
4
5This module is there to reexport most of the combinators and helpers required
6to parse an Edifact payload.
7
8For high level combinators, have a look at "Text.Edifact.Parsing.Combinators".
9
10For low level combinators, have a look at "Text.Edifact.Parsing.Primitives".
11 -}
12module 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
58import Text.Edifact.Parsing.Combinators (composite, mandatory,
59 maybeOnce, message, once,
60 optional, position, repeated,
61 repeatedAtLeastOnce, segment,
62 segmentGroup, simple, (.@),
63 (@.))
64import Text.Edifact.Parsing.Commons (Parser, defaultContext)
65import Text.Edifact.Parsing.Primitives (alpha, alphaNumeric, exactly,
66 many, numeric, upTo)
67
68import Data.Text (Text)
69import Text.Parsec (ParseError, runParser)
70
71parse :: Parser value -> Text -> Either ParseError value
72parse p = runParser p defaultContext ""