| Copyright | © Herbert Valerio Riedel 2015-2018 |
|---|---|
| License | GPL-2.0-or-later |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.YAML.Event
Description
Event-stream oriented YAML parsing API
Synopsis
- parseEvents :: ByteString -> EvStream
- type EvStream = [Either (Pos, String) Event]
- data Event
- = StreamStart
- | StreamEnd
- | DocumentStart !Bool
- | DocumentEnd !Bool
- | Alias !Anchor
- | Scalar !(Maybe Anchor) !Tag !Style !Text
- | SequenceStart !(Maybe Anchor) !Tag
- | SequenceEnd
- | MappingStart !(Maybe Anchor) !Tag
- | MappingEnd
- data Style
- data Tag
- untagged :: Tag
- isUntagged :: Tag -> Bool
- tagToText :: Tag -> Maybe Text
- mkTag :: String -> Tag
- type Anchor = Text
- data Pos = Pos {
- posByteOffset :: !Int
- posCharOffset :: !Int
- posLine :: !Int
- posColumn :: !Int
Documentation
parseEvents :: ByteString -> EvStream Source #
Parse YAML Events from a lazy ByteString.
The input ByteString is expected to have a YAML 1.2 stream
using the UTF-8, UTF-16 (LE or BE), or UTF-32 (LE or BE) encodings
(which will be auto-detected).
type EvStream = [Either (Pos, String) Event] Source #
Event stream produced by parseEvents
A Left value denotes parsing errors. The event stream ends
immediately once a Left value is returned.
YAML Event Types
The events correspond to the ones from LibYAML
The grammar below defines well-formed streams of Events:
stream ::=StreamStartdocument*StreamEnddocument ::=DocumentStartnodeDocumentEndnode ::=Alias|Scalar| sequence | mapping sequence ::=SequenceStartnode*SequenceEndmapping ::=MappingStart(node node)*MappingEnd
Constructors
Scalar node style
Constructors
| Plain | |
| SingleQuoted | |
| DoubleQuoted | |
| Literal | |
| Folded |
Position in parsed YAML source
Constructors
| Pos | |
Fields
| |