HsYAML-0.1.2.0: Pure Haskell YAML 1.2 parser

Copyright© Herbert Valerio Riedel 2015-2018
LicenseGPL-2.0-or-later
Safe HaskellSafe
LanguageHaskell2010

Data.YAML.Event

Description

Event-stream oriented YAML parsing API

Synopsis

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.

data Event Source #

YAML Event Types

The events correspond to the ones from LibYAML

The grammar below defines well-formed streams of Events:

stream   ::= StreamStart document* StreamEnd
document ::= DocumentStart node DocumentEnd
node     ::= Alias
           | Scalar
           | sequence
           | mapping
sequence ::= SequenceStart node* SequenceEnd
mapping  ::= MappingStart (node node)* MappingEnd
Instances
Eq Event Source # 
Instance details

Defined in Data.YAML.Event

Methods

(==) :: Event -> Event -> Bool

(/=) :: Event -> Event -> Bool

Show Event Source # 
Instance details

Defined in Data.YAML.Event

Methods

showsPrec :: Int -> Event -> ShowS

show :: Event -> String

showList :: [Event] -> ShowS

data Style Source #

Scalar node style

Instances
Eq Style Source # 
Instance details

Defined in Data.YAML.Event

Methods

(==) :: Style -> Style -> Bool

(/=) :: Style -> Style -> Bool

Ord Style Source # 
Instance details

Defined in Data.YAML.Event

Methods

compare :: Style -> Style -> Ordering

(<) :: Style -> Style -> Bool

(<=) :: Style -> Style -> Bool

(>) :: Style -> Style -> Bool

(>=) :: Style -> Style -> Bool

max :: Style -> Style -> Style

min :: Style -> Style -> Style

Show Style Source # 
Instance details

Defined in Data.YAML.Event

Methods

showsPrec :: Int -> Style -> ShowS

show :: Style -> String

showList :: [Style] -> ShowS

data Tag Source #

YAML Tags

Instances
Eq Tag Source # 
Instance details

Defined in Data.YAML.Event

Methods

(==) :: Tag -> Tag -> Bool

(/=) :: Tag -> Tag -> Bool

Ord Tag Source # 
Instance details

Defined in Data.YAML.Event

Methods

compare :: Tag -> Tag -> Ordering

(<) :: Tag -> Tag -> Bool

(<=) :: Tag -> Tag -> Bool

(>) :: Tag -> Tag -> Bool

(>=) :: Tag -> Tag -> Bool

max :: Tag -> Tag -> Tag

min :: Tag -> Tag -> Tag

Show Tag Source # 
Instance details

Defined in Data.YAML.Event

Methods

showsPrec :: Int -> Tag -> ShowS

show :: Tag -> String

showList :: [Tag] -> ShowS

untagged :: Tag Source #

An "untagged" YAML tag

isUntagged :: Tag -> Bool Source #

Equivalent to (== untagged)

tagToText :: Tag -> Maybe Text Source #

Convert Tag to its string representation

Returns Nothing for untagged

mkTag :: String -> Tag Source #

Construct YAML tag

type Anchor = Text Source #

YAML Anchor identifiers

data Pos Source #

Position in parsed YAML source

Constructors

Pos 

Fields

Instances
Show Pos Source # 
Instance details

Defined in Data.YAML.Event

Methods

showsPrec :: Int -> Pos -> ShowS

show :: Pos -> String

showList :: [Pos] -> ShowS