| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Yamlet.Internal.Compose
Description
The checks of a syntax tree before the decoder reads it, and the values of its nodes.
This module is intended for internal use only, and may change without warning in subsequent releases.
Synopsis
- prepareWithin :: Int -> Int -> Node -> Either Failure (Node, Int)
- aliasLimit :: [Node] -> Int
- representPrepared :: Node -> Either Failure Value
- type Failure = NonEmpty (Offset, String)
- noMergeKeys :: String
Documentation
prepareWithin :: Int -> Int -> Node -> Either Failure (Node, Int) Source #
Check that the tags of a node are valid and that the keys of every mapping are unique, and replace each alias with the node that it refers to. The result has no aliases. A node without aliases comes back unchanged.
The arguments are the limit of the visits that the aliases can add, see
aliasLimit, and the visits that the aliases of the documents before
added. The result also gives the visits that the aliases added with this
document.
aliasLimit :: [Node] -> Int Source #
The limit of the visits of a traversal that the aliases of the documents can add together: as many visits as the documents have, or a fixed minimum for small documents. A node is one visit and each character of its scalar, tag and anchor is one more, because the decoder copies the texts of each alias. Without a limit, the visits of a small input can be exponential in its size. The documents of a stream share the limit, so that many small documents cannot add the minimum each.
representPrepared :: Node -> Either Failure Value Source #
The value of a node that passed prepareWithin, so it has no aliases and its
keys are unique already.
type Failure = NonEmpty (Offset, String) Source #
The offset of the node that caused an error and the message, and the notes that go after it, e.g. the first key of a duplicate key.
noMergeKeys :: String Source #
The hint after the message of an error at a key <<. YAML 1.1 used it to
merge mappings, and some tools still do, but in YAML 1.2 it is a string.