YamlReference-0.10.0: YAML reference implementation

Copyright(c) Oren Ben-Kiki 2007
LicenseLGPL
Maintaineryaml-oren@ben-kiki.org
Stabilityalpha
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Text.Yaml.Reference

Description

Implementation of the YAML syntax as defined in http://www.yaml.org. Actually this file contains the parsing framework and includes (using CPP) the actual productions from Reference.bnf.

The parsing framework is fully streaming (generates output tokens "immediately").

Synopsis

Documentation

data Code Source #

Token codes.

Constructors

Bom

BOM, contains "TF8", "TF16LE", "TF32BE", etc.

Text

Content text characters.

Meta

Non-content (meta) text characters.

Break

Separation line break.

LineFeed

Line break normalized to content line feed.

LineFold

Line break folded to content space.

Indicator

Character indicating structure.

White

Separation white space.

Indent

Indentation spaces.

DirectivesEnd

Document start marker.

DocumentEnd

Document end marker.

BeginEscape

Begins escape sequence.

EndEscape

Ends escape sequence.

BeginComment

Begins comment.

EndComment

Ends comment.

BeginDirective

Begins directive.

EndDirective

Ends directive.

BeginTag

Begins tag.

EndTag

Ends tag.

BeginHandle

Begins tag handle.

EndHandle

Ends tag handle.

BeginAnchor

Begins anchor.

EndAnchor

Ends anchor.

BeginProperties

Begins node properties.

EndProperties

Ends node properties.

BeginAlias

Begins alias.

EndAlias

Ends alias.

BeginScalar

Begins scalar content.

EndScalar

Ends scalar content.

BeginSequence

Begins sequence content.

EndSequence

Ends sequence content.

BeginMapping

Begins mapping content.

EndMapping

Ends mapping content.

BeginPair

Begins mapping key:value pair.

EndPair

Ends mapping key:value pair.

BeginNode

Begins complete node.

EndNode

Ends complete node.

BeginDocument

Begins document.

EndDocument

Ends document.

BeginStream

Begins YAML stream.

EndStream

Ends YAML stream.

Error

Parsing error at this point.

Unparsed

Unparsed due to errors (or at end of test).

Detected

Detected parameter (for testing).

Instances

Eq Code Source # 

Methods

(==) :: Code -> Code -> Bool #

(/=) :: Code -> Code -> Bool #

Show Code Source #

show code converts a Code to the one-character YEAST token code char. The list of byte codes is also documented in the yaml2yeast program.

Methods

showsPrec :: Int -> Code -> ShowS #

show :: Code -> String #

showList :: [Code] -> ShowS #

data Token Source #

Parsed token.

Instances

Show Token Source #

show token converts a Token to two YEAST lines: a comment with the position numbers and the actual token line.

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

type Tokenizer = String -> ByteString -> Bool -> [Token] Source #

Tokenizer converts a (named) input text into a list of Token. Errors are reported as tokens with the Error Code, and the unparsed text following an error may be attached as a final token (if the Bool is True). Note that tokens are available "immediately", allowing for streaming of large YAML files with memory requirements depending only on the YAML nesting level.

yaml :: Tokenizer Source #

yaml name input converts the Unicode input (called name in error messages) to a list of Token according to the YAML spec. This is it!

data Context Source #

Production context.

Instances

Read Context Source #

read context converts a String to a Context. We trust our callers to convert any - characters into _ to allow the built-in lex function to handle the names as single identifiers.

Show Context Source #

show context converts a Context to a String.

data Chomp Source #

Chomp method.

Instances

Read Chomp Source #

read chomp converts a String to a Chomp.

Show Chomp Source #

show chomp converts a Chomp to a String.

Methods

showsPrec :: Int -> Chomp -> ShowS #

show :: Chomp -> String #

showList :: [Chomp] -> ShowS #

tokenizer :: String -> Maybe Tokenizer Source #

tokenizer name converts the production with the specified name to a simple Tokenizer, or Nothing if it isn't known.

tokenizerWithN :: String -> Int -> Maybe Tokenizer Source #

tokenizerWithN name n converts the production (that requires an n argument) with the specified name to a simple Tokenizer, or Nothing if it isn't known.

tokenizerWithC :: String -> Context -> Maybe Tokenizer Source #

tokenizerWithC name c converts the production (that requires a c argument) with the specified name to a simple Tokenizer, or Nothing if it isn't known.

tokenizerWithT :: String -> Chomp -> Maybe Tokenizer Source #

tokenizerWithT name t converts the production (that requires an t argument) with the specified name to a simple Tokenizer, or Nothing if it isn't known.

tokenizerWithNC :: String -> Int -> Context -> Maybe Tokenizer Source #

tokenizerWithNC name n c converts the production (that requires n and c arguments) with the specified name to a simple Tokenizer, or Nothing if it isn't known.

tokenizerWithNT :: String -> Int -> Chomp -> Maybe Tokenizer Source #

tokenizerWithNT name n t converts the production (that requires n and t arguments) with the specified name to a simple Tokenizer, or Nothing if it isn't known.

tokenizerNames :: [String] Source #

tokenizerNames returns the list of all productions (tokenizers).

showTokens :: [Token] -> String Source #

showTokens tokens converts a list of tokens to a multi-line YEAST text.