data-named-0.5.1: Data types for named entities

Safe HaskellNone

Text.Named.Enamex

Contents

Description

Parsing text in the Enamex data format. Each node is enclosed between opening and closing tags with tag name representing the label and contents representing children of the node. Both leaf and label values should be escaped by prepending the \ character before special >, <, \ and space characters.

Example:

>>> :m Text.Named.Enamex Data.Named.Tree Data.Text.Lazy
>>> let drawIt = putStr . drawForest . mapForest show . parseForest
>>> drawIt $ pack "<x>w1.1\\ w1.2</x> <y><z>w2</z> w3</y>"
Left "x"
|
`- Right "w1.1 w1.2"
,
Left "y"
|
+- Left "z"
|  |
|  `- Right "w2"
|
`- Right "w3"

Synopsis

Parsing

parseForest :: Text -> NeForest Text TextSource

Parse the enamex forest.

parseEnamex :: Text -> [NeForest Text Text]Source

Parse the enamex file.

Printing

showForest :: NeForest Text Text -> TextSource

Show the forest.

showEnamex :: [NeForest Text Text] -> TextSource

Show the enamex file.