Class 10.9 Alloy steel, quenched and tempered: 5mm - 100mm: 830: 940. Class 12.9 Alloy steel, quenched and tempered: 1.6mm - 100mm: 970: 1100. Usually Stamped A-2 or A-4: A-2 & A-4 Stainless Steel alloy with chromium and nickel: All sizes thru 20mm: N/A: 210 Min. 450 Typical 500 Min. Mark 2:5-9 When Jesus saw their faith, he said to the paralyzed man, 'Son, your sins are forgiven.' Now some teachers of the law were sitting there, thinking to themselves, Read verse in.
Revision 1.2.2 (2021-10-01)
Copyright presently by YAML Language Development Team1
Copyright 2001-2009 by Oren Ben-Kiki, Clark Evans, Ingy döt Net
This document may be freely copied, provided it is not modified.
Status of this Document
This is the YAML specification v1.2.2.It defines the YAML 1.2 data language.There are no normative changes from the YAML specification v1.2.The primary objectives of this revision are to correct errors and add clarity.
This revision also strives to make the YAML language development process moreopen, more transparent and easier for people to contribute to.The input format is now Markdown instead of DocBook, and the images are madefrom plain text LaTeX files rather than proprietary drawing software.All the source content for the specification is publicly hosted2.
The previous YAML specification3 was published 12 years ago.In that time span, YAML's popularity has grown significantly.Efforts are ongoing to improve the language and grow it to meet the needs andexpectations of its users.While this revision of the specification makes no actual changes to YAML, itbegins a process by which the language intends to evolve and stay modern.
The YAML specification is often seen as overly complicated for something whichappears to be so simple.Even though YAML often is used for software configuration, it has always beenand will continue to be a complete data serialization language.Future YAML plans are focused on making the language and ecosystem morepowerful and reliable while simultaneously simplifying the development processfor implementers.
While this revision of the specification is limiting itself to informationalchanges only, there is companion documentation intended to guide YAML frameworkimplementers and YAML language users.This documentation can continue to evolve and expand continually betweenpublished revisions of this specification.
See:
Abstract
YAML™ (rhymes with 'camel') is a human-friendly, cross language, Unicode baseddata serialization language designed around the common native data types ofdynamic programming languages.It is broadly useful for programming needs ranging from configuration files tointernet messaging to object persistence to data auditing and visualization.Together with the Unicode standard for characters4, this specificationprovides all the information necessary to understand YAML version 1.2 and tocreate programs that process YAML information.
Contents
- YAML Ain't Markup Language (YAML™) version 1.2
- Chapter 1. Introduction to YAML
- Chapter 2. Language Overview
- Chapter 3. Processes and Models
- 3.1. Processes
- 3.2. Information Models
- 3.2.1. Representation Graph
- 3.2.2. Serialization Tree
- 3.2.3. Presentation Stream
- 3.3. Loading Failure Points
- Chapter 4. Syntax Conventions
- Chapter 5. Character Productions
- Chapter 6. Structural Productions
- 6.8. Directives
- 6.8.2. '
TAG
' Directives
- 6.8.2. '
- 6.9. Node Properties
- 6.8. Directives
- Chapter 7. Flow Style Productions
- 7.3. Flow Scalar Styles
- 7.4. Flow Collection Styles
- Chapter 8. Block Style Productions
- 8.1. Block Scalar Styles
- 8.1.1. Block Scalar Headers
- 8.2. Block Collection Styles
- 8.1. Block Scalar Styles
- Chapter 9. Document Stream Productions
- 9.1. Documents
- Chapter 10. Recommended Schemas
- 10.1. Failsafe Schema
- 10.1.1. Tags
- 10.2. JSON Schema
- 10.2.1. Tags
- 10.3. Core Schema
- 10.1. Failsafe Schema
YAML (a recursive acronym for 'YAML Ain't Markup Language') is a dataserialization language designed to be human-friendly and work well with modernprogramming languages for common everyday tasks.This specification is both an introduction to the YAML language and theconcepts supporting it.It is also a complete specification of the information needed to developapplications for processing YAML.
Open, interoperable and readily understandable tools have advanced computingimmensely.YAML was designed from the start to be useful and friendly to people workingwith data.It uses Unicode printable characters, some of which provide structuralinformation and the rest containing the data itself.YAML achieves a unique cleanness by minimizing the amount of structuralcharacters and allowing the data to show itself in a natural and meaningfulway.For example, indentation may be used for structure, colons separatekey/value pairs and dashes are used to create 'bulleted' lists.
There are many kinds of data structures, but they can all be adequatelyrepresented with three basic primitives: mappings (hashes/dictionaries),sequences (arrays/lists) and scalars (strings/numbers).YAML leverages these primitives and adds a simple typing system and aliasingmechanism to form a complete language for serializing any native datastructure.While most programming languages can use YAML for data serialization, YAMLexcels in working with those languages that are fundamentally built around thethree basic primitives.These include common dynamic languages such as JavaScript, Perl, PHP, Pythonand Ruby.
There are hundreds of different languages for programming, but only a handfulof languages for storing and transferring data.Even though its potential is virtually boundless, YAML was specifically createdto work well for common use cases such as: configuration files, log files,interprocess messaging, cross-language data sharing, object persistence anddebugging of complex data structures.When data is easy to view and understand, programming becomes a simpler task.
1.1. Goals
The design goals for YAML are, in decreasing priority:
- YAML should be easily readable by humans.
- YAML data should be portable between programming languages.
- YAML should match the native data structures of dynamic languages.
- YAML should have a consistent model to support generic tools.
- YAML should support one-pass processing.
- YAML should be expressive and extensible.
- YAML should be easy to implement and use.
1.2. YAML History
The YAML 1.0 specification was published in early 2004 by by Clark Evans, OrenBen-Kiki, and Ingy döt Net after 3 years of collaborative design work throughthe yaml-core mailing list5.The project was initially rooted in Clark and Oren's work on theSML-DEV6 mailing list (for simplifying XML) and Ingy's plain textserialization module7 for Perl.The language took a lot of inspiration from many other technologies and formatsthat preceded it.
The first YAML framework was written in Perl in 2001 and Ruby was the firstlanguage to ship a YAML framework as part of its core language distribution in2003.
The YAML 1.18 specification was published in 2005.Around this time, the developers became aware of JSON9.By sheer coincidence, JSON was almost a complete subset of YAML (bothsyntactically and semantically).
In 2006, Kyrylo Simonov produced PyYAML10 and LibYAML11.A lot of the YAML frameworks in various programming languages are built overLibYAML and many others have looked to PyYAML as a solid reference for theirimplementations.
The YAML 1.23 specification was published in 2009.Its primary focus was making YAML a strict superset of JSON.It also removed many of the problematic implicit typing recommendations.
Since the release of the 1.2 specification, YAML adoption has continued togrow, and many large-scale projects use it as their primary interface language.In 2020, the new YAML language design team began meeting regularlyto discuss improvements to the YAML language and specification; to better meetthe needs and expectations of its users and use cases.
This YAML 1.2.2 specification, published in October 2021, is the first step inYAML's rejuvenated development journey.YAML is now more popular than it has ever been, but there is a long list ofthings that need to be addressed for it to reach its full potential.The YAML design team is focused on making YAML as good as possible.
1.3. Terminology
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', 'SHOULD','SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this document are to beinterpreted as described in RFC 211912.
The rest of this document is arranged as follows.Chapter 2 provides a short preview of the main YAML features.Chapter 3 describes the YAML information model and the processes forconverting from and to this model and the YAML text format.The bulk of the document, chapters 4, 5, 6, 7, 8 and 9, formallydefine this text format.Finally, chapter 10 recommends basic YAML schemas.
This section provides a quick glimpse into the expressive power of YAML.It is not expected that the first-time reader grok all of the examples.Rather, these selections are used as motivation for the remainder of thespecification.
2.1. Collections
YAML's block collections use indentation for scope and begin each entry onits own line.Block sequences indicate each entry with a dash and space ('-
').Mappings use a colon and space (':
') to mark each key/value pair.Comments begin with an octothorpe (also called a 'hash', 'sharp', 'pound' or'number sign' - '#
').
Example 2.2 Mapping Scalars to Scalars (player statistics)
Example 2.3 Mapping Scalars to Sequences (ball clubs in each league)
Example 2.4 Sequence of Mappings (players' statistics)
YAML also has flow styles, using explicit indicators rather thanindentation to denote scope.The flow sequence is written as a comma separated list within squarebrackets.In a similar manner, the flow mapping uses curlybraces.
Example 2.6 Mapping of Mappings
2.2. Structures
YAML uses three dashes ('---
') to separate directives from documentcontent.This also serves to signal the start of a document if no directives arepresent.Three dots ( '..
') indicate the end of a document without starting a newone, for use in communication channels.
Example 2.7 Two Documents in a Stream (each with a leading comment)
Repeated nodes (objects) are first identified by an anchor (marked withthe ampersand - '&
') and are then aliased (referenced with an asterisk -'*
') thereafter.
Example 2.9 Single Document with Two Comments
Example 2.10 Node for 'Sammy Sosa
' appears twice in this document
A question mark and space ('?
') indicate a complex mappingkey.Within a block collection, key/value pairs can start immediately followingthe dash, colon or question mark.
Example 2.12 Compact Nested Mapping
2.3. Scalars
Scalar content can be written in block notation, using a literal style(indicated by '|
') where all line breaks are significant.Alternatively, they can be written with the folded style (denoted by '>
')where each line break is folded to a space unless it ends an empty or amore-indented line.
Example 2.13 In literals, newlines are preserved
Example 2.14 In the folded scalars, newlines become spaces
Example 2.15 Folded newlines are preserved for 'more indented' and blanklines
YAML's flow scalars include the plain style (most examples thus far) andtwo quoted styles.The double-quoted style provides escape sequences.The single-quoted style is useful when escaping is not needed.All flow scalars can span multiple lines; line breaks are always folded.
Example 2.17 Quoted Scalars
2.4. Tags
In YAML, untagged nodes are given a type depending on the application.The examples in this specification generally use the seq
, map
and str
types from the fail safe schema.A few examples also use the int
, float
and null
types from the JSONschema.
Example 2.20 Floating Point
Example 2.22 Timestamps
Explicit typing is denoted with a tag using the exclamation point ('!
')symbol.Global tags are URIs and may be specified in a tag shorthand notation usinga handle.Application-specific local tags may also be used.
Example 2.24 Global Tags
Example 2.26 Ordered Mappings
2.5. Full Length Example
Below are two full-length examples of YAML.The first is a sample invoice; the second is a sample log file.
Example 2.27 Invoice
YAML is both a text format and a method for presenting any native datastructure in this format.Therefore, this specification defines two concepts: a class of data objectscalled YAML representations and a syntax for presenting YAMLrepresentations as a series of characters, called a YAML stream.
A YAML processor is a tool for converting information between thesecomplementary views.It is assumed that a YAML processor does its work on behalf of another module,called an application.This chapter describes the information structures a YAML processor must provideto or obtain from the application.
YAML information is used in two ways: for machine processing and for humanconsumption.The challenge of reconciling these two perspectives is best done in threedistinct translation stages: representation, serialization andpresentation.Representation addresses how YAML views native data structures to achieveportability between programming environments.Serialization concerns itself with turning a YAML representation into aserial form, that is, a form with sequential access constraints.Presentation deals with the formatting of a YAML serialization as a seriesof characters in a human-friendly manner.
3.1. Processes
Translating between native data structures and a character stream is donein several logically distinct stages, each with a well defined input and outputdata model, as shown in the following diagram:
Figure 3.1. Processing Overview
A YAML processor need not expose the serialization or representationstages.It may translate directly between native data structures and a characterstream (dump and load in the diagram above).However, such a direct translation should take place so that the native datastructures are constructed only from information available in therepresentation.In particular, mapping key order, comments and tag handles should not bereferenced during construction.
3.1.1. Dump
Dumping native data structures to a character stream is done using thefollowing three stages:
YAML represents any native data structure using three node kinds:sequence - an ordered series of entries; mapping - an unordered associationof uniquekeys to values; and scalar - any datum with opaque structurepresentable as a series of Unicode characters.
Combined, these primitives generate directed graph structures.These primitives were chosen because they are both powerful and familiar: thesequence corresponds to a Perl array and a Python list, the mappingcorresponds to a Perl hash table and a Python dictionary.The scalar represents strings, integers, dates and other atomic data types.
Each YAML node requires, in addition to its kind and content, a tagspecifying its data type.Type specifiers are either global URIs or are local in scope to a singleapplication.For example, an integer is represented in YAML with a scalar plus the globaltag 'tag:yaml.org,2002:int
'.Similarly, an invoice object, particular to a given organization, could berepresented as a mapping together with the local tag '!invoice
'.This simple model can represent any data structure independent of programminglanguage.
For sequential access mediums, such as an event callback API, a YAMLrepresentation must be serialized to an ordered tree.Since in a YAML representation, mapping keys are unordered and nodes maybe referenced more than once (have more than one incoming 'arrow'), theserialization process is required to impose an ordering on the mapping keysand to replace the second and subsequent references to a given node withplace holders called aliases.YAML does not specify how these serialization details are chosen.It is up to the YAML processor to come up with human-friendly key order andanchor names, possibly with the help of the application.The result of this process, a YAML serialization tree, can then be traversedto produce a series of event calls for one-pass processing of YAML data.
The final output process is presenting the YAML serializations as acharacter stream in a human-friendly manner.To maximize human readability, YAML offers a rich set of stylistic optionswhich go far beyond the minimal functional needs of simple data storage.Therefore the YAML processor is required to introduce various presentationdetails when creating the stream, such as the choice of node styles, howto format scalar content, the amount of indentation, which tag handles touse, the node tags to leave unspecified, the set of directives to provideand possibly even what comments to add.While some of this can be done with the help of the application, in generalthis process should be guided by the preferences of the user.
3.1.2. Load
Loadingnative data structures from a character stream is done using thefollowing three stages:
Parsing is the inverse process of presentation, it takes a stream ofcharacters and produces a serialization tree.Parsing discards all the details introduced in the presentation process,reporting only the serialization tree.Parsing can fail due to ill-formed input.
Composing takes a serialization tree and produces a representation graph.Composing discards all the details introduced in the serialization process,producing only the representation graph.Composing can fail due to any of several reasons, detailed below.
The final input process is constructingnative data structures from theYAML representation.Construction must be based only on the information available in therepresentation and not on additional serialization or presentationdetails such as comments, directives, mapping key order, node styles,scalar content format, indentation levels etc.Construction can fail due to the unavailability of the required native datatypes.
3.2. Information Models
This section specifies the formal details of the results of the aboveprocesses.To maximize data portability between programming languages and implementations,users of YAML should be mindful of the distinction between serialization orpresentation properties and those which are part of the YAMLrepresentation.Thus, while imposing a order on mapping keys is necessary for flatteningYAML representations to a sequential access medium, this serializationdetail must not be used to convey application level information.In a similar manner, while indentation technique and a choice of a nodestyle are needed for the human readability, these presentation details areneither part of the YAML serialization nor the YAML representation.By carefully separating properties needed for serialization andpresentation, YAML representations of application information will beconsistent and portable between various programming environments.
The following diagram summarizes the three information models.Full arrows denote composition, hollow arrows denote inheritance, '1
' and'*
' denote 'one' and 'many' relationships.A single '+
' denotes serialization details, a double '++
' denotespresentation details.
Figure 3.2. Information Models
3.2.1. Representation Graph
YAML's representation of native data structure is a rooted, connected,directed graph of taggednodes.By 'directed graph' we mean a set of nodes and directed edges ('arrows'),where each edge connects one node to another (see a formal directed graphdefinition13).All the nodes must be reachable from the root node via such edges.Note that the YAML graph may include cycles and a node may have more than oneincoming edge.
Nodes that are defined in terms of other nodes are collections; nodesthat are independent of any other nodes are scalars.YAML supports two kinds of collection nodes: sequences and mappings.Mapping nodes are somewhat tricky because their keys are unordered and mustbe unique.
Figure 3.3. Representation Model
3.2.1.1. Nodes
A YAML noderepresents a single native data structure.Such nodes have content of one of three kinds: scalar, sequence or mapping.In addition, each node has a tag which serves to restrict the set of possiblevalues the content can have.
The content of a scalar node is an opaque datum that can be presented as aseries of zero or more Unicode characters.
The content of a sequence node is an ordered series of zero or more nodes.In particular, a sequence may contain the same node more than once.It could even contain itself.
The content of a mapping node is an unordered set of key/value nodepairs, with the restriction that each of the keys is unique.YAML places no further restrictions on the nodes.In particular, keys may be arbitrary nodes, the same node may be used as thevalue of several key/value pairs and a mapping could even contain itself as akey or a value.
3.2.1.2. Tags
YAML represents type information of native data structures with a simpleidentifier, called a tag.Global tags are URIs and hence globally unique across all applications.The 'tag:
' URI scheme14 is recommended for all global YAML tags.In contrast, local tags are specific to a single application.Local tags start with '!
', are not URIs and are not expected to be globallyunique.YAML provides a 'TAG
' directive to make tag notation less verbose; it alsooffers easy migration from local to global tags.To ensure this, local tags are restricted to the URI character set and use URIcharacter escaping.
YAML does not mandate any special relationship between different tags thatbegin with the same substring.Tags ending with URI fragments (containing '#
') are no exception; tags thatshare the same base URI but differ in their fragment part are considered to bedifferent, independent tags.By convention, fragments are used to identify different 'variants' of a tag,while '/
' is used to define nested tag 'namespace' hierarchies.However, this is merely a convention and each tag may employ its own rules.For example, Perl tags may use '::
' to express namespace hierarchies, Javatags may use '.
', etc.
YAML tags are used to associate meta information with each node.In particular, each tag must specify the expected node kind (scalar,sequence or mapping).Scalar tags must also provide a mechanism for converting formatted contentto a canonical form for supporting equality testing.Furthermore, a tag may provide additional information such as the set ofallowed content values for validation, a mechanism for tag resolution orany other data that is applicable to all of the tag's nodes.
3.2.1.3. Node Comparison
Since YAML mappings require key uniqueness, representations must includea mechanism for testing the equality of nodes.This is non-trivial since YAML allows various ways to format scalar content.For example, the integer eleven can be written as '0o13
' (octal) or '0xB
'(hexadecimal).If both notations are used as keys in the same mapping, only a YAMLprocessor which recognizes integer formats would correctly flag theduplicate key as an error.
YAML supports the need for scalar equality by requiring that every scalartag must specify a mechanism for producing the canonical form of anyformatted content.This form is a Unicode character string which also presents the samecontent and can be used for equality testing.
Two nodes must have the same tag and content to be equal.Since each tag applies to exactly one kind, this implies that the twonodes must have the same kind to be equal.
Two scalars are equal only when their tags and canonical forms are equalcharacter-by-character.Equality of collections is defined recursively.
Two sequences are equal only when they have the same tag and length andeach node in one sequence is equal to the corresponding node in the othersequence.
Two mappings are equal only when they have the same tag and an equal set ofkeys and each key in this set is associated with equal values in bothmappings.
Different URI schemes may define different rules for testing the equality ofURIs.Since a YAML processor cannot be reasonably expected to be aware of them all,it must resort to a simple character-by-character comparison of tags toensure consistency.This also happens to be the comparison method defined by the 'tag:
' URIscheme.Tags in a YAML stream must therefore be presented in a canonical way sothat such comparison would yield the correct results.
If a node has itself as a descendant (via an alias), then determining theequality of that node is implementation-defined.
A YAML processor may treat equal scalars as if they were identical.
A mapping'skeys are unique if no two keys are equal to each other.Obviously, identical nodes are always considered equal.
3.2.2. Serialization Tree
To express a YAML representation using a serial API, it is necessary toimpose an order on mapping keys and employ alias nodes to indicate asubsequent occurrence of a previously encountered node.The result of this process is a serialization tree, where each node has anordered set of children.This tree can be traversed for a serial event-based API.Construction of native data structures from the serial interface should notuse key order or anchor names for the preservation of application data.
Figure 3.4. Serialization Model
3.2.2.1. Mapping Key Order
In the representation model, mapping keys do not have an order.To serialize a mapping, it is necessary to impose an ordering on itskeys.This order is a serialization detail and should not be used when composingthe representation graph (and hence for the preservation of applicationdata).In every case where node order is significant, a sequence must be used.For example, an ordered mapping can be represented as a sequence ofmappings, where each mapping is a single key/value pair.YAML provides convenient compact notation for this case.
3.2.2.2. Anchors and Aliases
In the representation graph, a node may appear in more than onecollection.When serializing such data, the first occurrence of the node isidentified by an anchor.Each subsequent occurrence is serialized as an alias node which refers backto this anchor.Otherwise, anchor names are a serialization detail and are discarded oncecomposing is completed.When composing a representation graph from serialized events, an aliasevent refers to the most recent event in the serialization having thespecified anchor.Therefore, anchors need not be unique within a serialization.In addition, an anchor need not have an alias node referring to it.
3.2.3. Presentation Stream
A YAML presentation is a stream of Unicode characters making use ofstyles, scalar content formats, comments, directives and otherpresentation details to present a YAML serialization in a human readableway.YAML allows several serialization trees to be contained in the same YAMLpresentation stream, as a series of documents separated by markers.
Figure 3.5. Presentation Model
3.2.3.1. Node Styles
Each node is presented in some style, depending on its kind.The node style is a presentation detail and is not reflected in theserialization tree or representation graph.There are two groups of styles.Block styles use indentation to denote structure.In contrast, flow styles rely on explicit indicators.
YAML provides a rich set of scalar styles.Block scalar styles include the literal style and the folded style.Flow scalar styles include the plain style and two quoted styles, thesingle-quoted style and the double-quoted style.These styles offer a range of trade-offs between expressive power andreadability.
Normally, block sequences and mappings begin on the next line.In some cases, YAML also allows nested blockcollections to start in-linefor a more compact notation.In addition, YAML provides a compact notation for flow mappings with asingle key/value pair, nested inside a flow sequence.These allow for a natural 'ordered mapping' notation.
Figure 3.6. Kind/Style Combinations
3.2.3.2. Scalar Formats
YAML allows scalars to be presented in several formats.For example, the integer '11
' might also be written as '0xB
'.Tags must specify a mechanism for converting the formatted content to acanonical form for use in equality testing.Like node style, the format is a presentation detail and is not reflectedin the serialization tree and representation graph.
3.2.3.3. Comments
Comments are a presentation detail and must not have any effect on theserialization tree or representation graph.In particular, comments are not associated with a particular node.The usual purpose of a comment is to communicate between the human maintainersof a file.A typical example is comments in a configuration file.Comments must not appear inside scalars, but may be interleaved with suchscalars inside collections.
3.2.3.4. Directives
Each document may be associated with a set of directives.A directive has a name and an optional sequence of parameters.Directives are instructions to the YAML processor and like all otherpresentation details are not reflected in the YAML serialization tree orrepresentation graph.This version of YAML defines two directives, 'YAML
' and 'TAG
'.All other directives are reserved for future versions of YAML.
3.3. Loading Failure Points
The process of loadingnative data structures from a YAML stream hasseveral potential failure points.The character stream may be ill-formed, aliases may be unidentified,unspecified tags may be unresolvable, tags may be unrecognized, thecontent may be invalid, mappingkeys may not be unique and a nativetype may be unavailable.Each of these failures results with an incomplete loading.
A partial representation need not resolve the tag of each node and thecanonical form of formatted scalar content need not be available.This weaker representation is useful for cases of incomplete knowledge of thetypes used in the document.
In contrast, a complete representation specifies the tag of each node andprovides the canonical form of formatted scalar content, allowing forequality testing.A complete representation is required in order to constructnative datastructures.
Figure 3.7. Loading Failure Points
3.3.1. Well-Formed Streams and Identified Aliases
A well-formed character stream must match the BNF productions specified inthe following chapters.Successful loading also requires that each alias shall refer to a previousnodeidentified by the anchor.A YAML processor should reject ill-formed streams and unidentifiedaliases.A YAML processor may recover from syntax errors, possibly by ignoring certainparts of the input, but it must provide a mechanism for reporting such errors.
3.3.2. Resolved Tags
Typically, most tags are not explicitly specified in the character stream.During parsing, nodes lacking an explicit tag are given a non-specifictag: '!
' for non-plain scalars and '?
' for all other nodes.Composing a complete representation requires each such non-specific tag tobe resolved to a specific tag, be it a global tag or a local tag.
Resolving the tag of a node must only depend on the following threeparameters: (1) the non-specific tag of the node, (2) the path leading fromthe root to the node and (3) the content (and hence the kind) of thenode.When a node has more than one occurrence (using aliases), tag resolutionmust depend only on the path to the first (anchored) occurrence of thenode.
Marked 2 2 5 9 Movie
Note that resolution must not consider presentation details such ascomments, indentation and node style.Also, resolution must not consider the content of any other node, exceptfor the content of the key nodes directly along the path leading from theroot to the resolved node.Finally, resolution must not consider the content of a sibling node in acollection or the content of the value node associated with a key nodebeing resolved.
These rules ensure that tag resolution can be performed as soon as a node isfirst encountered in the stream, typically before its content is parsed.Also, tag resolution only requires referring to a relatively small number ofpreviously parsed nodes.Thus, in most cases, tag resolution in one-pass processors is both possibleand practical.
YAML processors should resolve nodes having the '!
' non-specific tag as'tag:yaml.org,2002:seq
', 'tag:yaml.org,2002:map
' or'tag:yaml.org,2002:str
' depending on their kind.This tag resolution convention allows the author of a YAML character streamto effectively 'disable' the tag resolution process.By explicitly specifying a '!
' non-specific tag property, the node wouldthen be resolved to a 'vanilla' sequence, mapping or string, according toits kind.
Application specific tag resolution rules should be restricted to resolvingthe '?
' non-specific tag, most commonly to resolving plain scalars.These may be matched against a set of regular expressions to provide automaticresolution of integers, floats, timestamps and similar types.An application may also match the content of mapping nodes against setsof expected keys to automatically resolve points, complex numbers and similartypes.Resolved sequence node types such as the 'ordered mapping' are also possible.
That said, tag resolution is specific to the application.YAML processors should therefore provide a mechanism allowing theapplication to override and expand these default tag resolution rules.
If a document contains unresolved tags, the YAML processor is unable tocompose a complete representation graph.In such a case, the YAML processor may compose a partial representation,based on each node's kind and allowing for non-specific tags.
3.3.3. Recognized and Valid Tags
To be valid, a node must have a tag which is recognized by the YAMLprocessor and its content must satisfy the constraints imposed by thistag.If a document contains a scalar node with an unrecognized tag or invalidcontent, only a partial representation may be composed.In contrast, a YAML processor can always compose a completerepresentation for an unrecognized or an invalid collection, sincecollectionequality does not depend upon knowledge of the collection'sdata type.However, such a complete representation cannot be used to construct anative data structure.
3.3.4. Available Tags
In a given processing environment, there need not be an available native typecorresponding to a given tag.If a node's tag is unavailable, a YAML processor will not be able toconstruct a native data structure for it.In this case, a complete representation may still be composed and anapplication may wish to use this representation directly.
The following chapters formally define the syntax of YAML character streams,using parameterized BNF productions.Each BNF production is both named and numbered for easy reference.Whenever possible, basic structures are specified before the more complexstructures using them in a 'bottom up' fashion.
The productions are accompanied by examples which are presented in a two-paneside-by-side format.The left-hand side is the YAML example and the right-hand side is an alternateYAML view of the example.The right-hand view uses JSON when possible.Otherwise it uses a YAML form that is as close to JSON as possible.
4.1. Production Syntax
Productions are defined using the syntax production-name ::= term
, where aterm is either:
- A quoted string (
'abc'
), which matches that concatenation of characters. Asingle character is usually written with single quotes ('a'
). - A hexadecimal number (
x0A
), which matches the character at that Unicodecode point. - A range of hexadecimal numbers (
[x20-x7E]
), which matches any characterwhose Unicode code point is within that range. - The name of a production (
c-printable
), which matches that production.
[ lookahead = term ]
, which matches the empty string ifterm
would match.[ lookahead ≠ term ]
, which matches the empty string ifterm
would notmatch.[ lookbehind = term ]
, which matches the empty string ifterm
would matchbeginning at any prior point on the line and ending at the current position.
, which matches the empty string at the beginning of a line.
, matches the empty string at the end of the input.
, which (always) matches the empty string.
Matches its contents.
Is term-one term-two
, which matches term-one
followed by term-two
.
Is term-one | term-two
, which matches the term-one
if possible, orterm-two
otherwise.
term?
, which matches(term | )
.term*
, which matches(term term* | )
.term+
, which matches(term term*)
.
Note: Quantified terms are always greedy.
The order of precedence is parenthesization, then quantification, thenconcatenation, then alternation.
Some lines in a production definition might have a comment like:
These comments are meant to be informative only.For instance a comment that says # not followed by non-ws char
just meansthat you should be aware that actual production rules will behave as describedeven though it might not be obvious from the content of that particularproduction alone.
4.2. Production Parameters
Some productions have parameters in parentheses after the name, such ass-line-prefix(n,c)
.A parameterized production is shorthand for a (infinite) series of productions,each with a fixed value for each parameter.
For instance, this production:
Is shorthand for:
And this production:
Is shorthand for:
The parameters are as follows:
n
or m
May be any natural number, including zero. n
may also be -1.
c
This parameter allows productions to tweak their behavior according to theirsurrounding.YAML supports two groups of contexts, distinguishing between block stylesand flow styles.
May be any of the following values:
BLOCK-IN
– inside block contextBLOCK-OUT
– outside block contextBLOCK-KEY
– inside block key contextFLOW-IN
– inside flow contextFLOW-OUT
– outside flow contextFLOW-KEY
– inside flow key context
t
The line break chomping behavior for flow scalars.May be any of the following values:
STRIP
– remove all trailing newlinesCLIP
– remove all trailing newlines except the firstKEEP
– retain all trailing newlines
4.3. Production Naming Conventions
To make it easier to follow production combinations, production names use aprefix-style naming convention.Each production is given a prefix based on the type of characters it begins andends with.
e-
A production matching no characters.
c-
A production starting and ending with a special character.
b-
A production matching a single line break.
nb-
A production starting and ending with a non-break character.
s-
A production starting and ending with a white space character.
ns-
A production starting and ending with a non-space character.
l-
A production matching complete line(s).
X-Y-
A production starting with an X-
character and ending with a Y-
character,where X-
and Y-
are any of the above prefixes.
X+
, X-Y+
A production as above, with the additional property that the matched contentindentation level is greater than the specified n
parameter.
5.1. Character Set
To ensure readability, YAML streams use only the printable subset of theUnicode character set.The allowed character range explicitly excludes the C0 control block15x00-x1F
(except for TAB x09
, LF x0A
and CR x0D
which are allowed), DELx7F
, the C1 control block x80-x9F
(except for NEL x85
which is allowed),the surrogate block16xD800-xDFFF
, xFFFE
and xFFFF
.
On input, a YAML processor must accept all characters in this printablesubset.
On output, a YAML processor must only produce only characters in thisprintable subset.Characters outside this set must be presented using escape sequences.In addition, any allowed characters known to be non-printable should also beescaped.
Note: This isn't mandatory since a full implementation would requireextensive character property tables.
To ensure JSON compatibility, YAML processors must allow all non-C0characters inside quoted scalars.To ensure readability, non-printable characters should be escaped on output,even inside such scalars.
Note: JSON quoted scalars cannot span multiple lines or contain tabs, butYAML quoted scalars can.
Note: The production name nb-json
means 'non-break JSON compatible' here.
5.2. Character Encodings
All characters mentioned in this specification are Unicode code points.Each such code point is written as one or more bytes depending on thecharacter encoding used.Note that in UTF-16, characters above xFFFF
are written as four bytes, usinga surrogate pair.
The character encoding is a presentation detail and must not be used toconvey content information.
On input, a YAML processor must support the UTF-8 and UTF-16 characterencodings.For JSON compatibility, the UTF-32 encodings must also be supported.
If a character stream begins with a byte order mark, the character encodingwill be taken to be as indicated by the byte order mark.Otherwise, the stream must begin with an ASCII character.This allows the encoding to be deduced by the pattern of null (x00
)characters.
Byte order marks may appear at the start of any document, however alldocuments in the same stream must use the same character encoding.
2+2=5 Proof
To allow for JSON compatibility, byte order marks are also allowed insidequoted scalars.For readability, such content byte order marks should be escaped on output.
The encoding can therefore be deduced by matching the first few bytes of thestream with the following table rows (in order):
Byte0 | Byte1 | Byte2 | Byte3 | Encoding | |
---|---|---|---|---|---|
Explicit BOM | x00 | x00 | xFE | xFF | UTF-32BE |
ASCII first character | x00 | x00 | x00 | any | UTF-32BE |
Explicit BOM | xFF | xFE | x00 | x00 | UTF-32LE |
ASCII first character | any | x00 | x00 | x00 | UTF-32LE |
Explicit BOM | xFE | xFF | UTF-16BE | ||
ASCII first character | x00 | any | UTF-16BE | ||
Explicit BOM | xFF | xFE | UTF-16LE | ||
ASCII first character | any | x00 | UTF-16LE | ||
Explicit BOM | xEF | xBB | xBF | UTF-8 | |
Default | UTF-8 |
The recommended output encoding is UTF-8.If another encoding is used, it is recommended that an explicit byte order markbe used, even if the first stream character is ASCII.
For more information about the byte order mark and the Unicode characterencoding schemes see the Unicode FAQ17.
In the examples, byte order mark characters are displayed as '⇔
'.
Example 5.1 Byte Order Mark
Example 5.2 Invalid Byte Order Mark
5.3. Indicator Characters
Indicators are characters that have special semantics.
'-
' (x2D
, hyphen) denotes a block sequence entry.
'?
' (x3F
, question mark) denotes a mapping key.
':
' (x3A
, colon) denotes a mapping value.
Example 5.3 Block Structure Indicators
Legend:
',
' (x2C
, comma) ends a flow collection entry.
'[
' (x5B
, left bracket) starts a flow sequence.
']
' (x5D
, right bracket) ends a flow sequence.
'{
' (x7B
, left brace) starts a flow mapping.
'}
' (x7D
, right brace) ends a flow mapping.
Example 5.4 Flow Collection Indicators
Legend:
'#
' (x23
, octothorpe, hash, sharp, pound, number sign) denotes a comment.
Example 5.5 Comment Indicator
'&
' (x26
, ampersand) denotes a node's anchor property.
'*
' (x2A
, asterisk) denotes an alias node.
The '!
' (x21
, exclamation) is used for specifying node tags.It is used to denote tag handles used in tag directives and tagproperties; to denote local tags; and as the non-specific tag fornon-plain scalars.
Example 5.6 Node Property Indicators
Legend:
'|
' (7C
, vertical bar) denotes a literal block scalar.
'>
' (x3E
, greater than) denotes a folded block scalar.
Example 5.7 Block Scalar Indicators
Legend:
''
' (x27
, apostrophe, single quote) surrounds a single-quoted flowscalar.
''
' (x22
, double quote) surrounds a double-quoted flow scalar.
Example 5.8 Quoted Scalar Indicators
Legend:
'%
' (x25
, percent) denotes a directive line.
Example 5.9 Directive Indicator
Legend:
The '@
' (x40
, at) and '`
' (x60
, grave accent) arereserved for future use.
Example 5.10 Invalid use of Reserved Indicators
Any indicator character:
The '[
', ']
', '{
', '}
' and ',
' indicators denote structure in flowcollections.They are therefore forbidden in some cases, to avoid ambiguity in severalconstructs.This is handled on a case-by-case basis by the relevant productions.
5.4. Line Break Characters
YAML recognizes the following ASCII line break characters.
All other characters, including the form feed (x0C
), are considered to benon-break characters.Note that these include the non-ASCII line breaks: next line (x85
), lineseparator (x2028
) and paragraph separator (x2029
).
YAML version 1.1 did support the above non-ASCII line break characters;however, JSON does not.Hence, to ensure JSON compatibility, YAML treats them as non-break charactersas of version 1.2.YAML 1.2 processorsparsing a version 1.1document should thereforetreat these line breaks as non-break characters, with an appropriate warning.
Line breaks are interpreted differently by different systems and have multiplewidely used formats.
Line breaks inside scalar content must be normalized by the YAMLprocessor.Each such line break must be parsed into a single line feed character.The original line break format is a presentation detail and must not be usedto convey content information.
Outside scalar content, YAML allows any line break to be used to terminatelines.
On output, a YAML processor is free to emit line breaks using whateverconvention is most appropriate.
In the examples, line breaks are sometimes displayed using the '↓
' glyph forclarity.
Example 5.11 Line Break Characters
Legend:
5.5. White Space Characters
YAML recognizes two white space characters: space and tab.
The rest of the (printable) non-break characters are considered to benon-space characters.
In the examples, tab characters are displayed as the glyph '→
'.Space characters are sometimes displayed as the glyph '·
' for clarity.
Example 5.12 Tabs and Spaces
Legend:
5.6. Miscellaneous Characters
The YAML syntax productions make use of the following additional characterclasses:
A decimal digit for numbers:
A hexadecimal digit for escape sequences:
ASCII letter (alphabetic) characters:
Word (alphanumeric) characters for identifiers:
URI characters for tags, as defined in the URI specification18.
By convention, any URI characters other than the allowed printable ASCIIcharacters are first encoded in UTF-8 and then each byte is escaped usingthe '%
' character.The YAML processor must not expand such escaped characters.Tag characters must be preserved and compared exactly as presented in theYAML stream, without any processing.
The '!
' character is used to indicate the end of a named tag handle; henceits use in tag shorthands is restricted.In addition, such shorthands must not contain the '[
', ']
', '{
', '}
'and ',
' characters.These characters would cause ambiguity with flow collection structures.
5.7. Escaped Characters
All non-printable characters must be escaped.YAML escape sequences use the '' notation common to most modern computerlanguages.Each escape sequence must be parsed into the appropriate Unicode character.The original escape sequence is a presentation detail and must not be used toconvey content information.
Note that escape sequences are only interpreted in double-quoted scalars.In all other scalar styles, the '' character has no special meaning andnon-printable characters are not available.
YAML escape sequences are a superset of C's escape sequences:
Escaped ASCII null (x00
) character.
Escaped ASCII bell (x07
) character.
Escaped ASCII backspace (x08
) character.
Escaped ASCII horizontal tab (x09
) character.This is useful at the start or the end of a line to force a leading or trailingtab to become part of the content.
Escaped ASCII line feed (x0A
) character.
Escaped ASCII vertical tab (x0B
) character.
Escaped ASCII form feed (x0C
) character.
Escaped ASCII carriage return (x0D
) character.
Escaped ASCII escape (x1B
) character.
Escaped ASCII space (x20
) character.This is useful at the start or the end of a line to force a leading or trailingspace to become part of the content.
Escaped ASCII double quote (x22
).
Escaped ASCII slash (x2F
), for JSON compatibility.
Escaped ASCII back slash (x5C
).
Escaped Unicode next line (x85
) character.
Escaped Unicode non-breaking space (xA0
) character.
Escaped Unicode line separator (x2028
) character.
Escaped Unicode paragraph separator (x2029
) character.
Escaped 8-bit Unicode character.
Escaped 16-bit Unicode character.
Escaped 32-bit Unicode character.
Any escaped character:
Example 5.13 Escaped Characters
Legend:
6.1. Indentation Spaces
In YAML block styles, structure is determined by indentation.In general, indentation is defined as a zero or more space characters at thestart of a line.
To maintain portability, tab characters must not be used in indentation,since different systems treat tabs differently.Note that most modern editors may be configured so that pressing the tab keyresults in the insertion of an appropriate number of spaces.
The amount of indentation is a presentation detail and must not be used toconvey content information.
A block style construct is terminated when encountering a line which is lessindented than the construct.The productions use the notation 's-indent-less-than(n)
' and's-indent-less-or-equal(n)
' to express this.
Each node must be indented further than its parent node.All sibling nodes must use the exact same indentation level.However the content of each sibling node may be further indentedindependently.
Example 6.1 Indentation Spaces
Legend:
Content
Neither content nor indentation
The '-
', '?
' and ':
' characters used to denote block collection entriesare perceived by people to be part of the indentation.This is handled on a case-by-case basis by the relevant productions.
Example 6.2 Indentation Indicators
Legend:
Total Indentation
Indicator as indentation
6.2. Separation Spaces
Outside indentation and scalar content, YAML uses white space charactersfor separation between tokens within a line.Note that such white space may safely include tab characters.
Separation spaces are a presentation detail and must not be used to conveycontent information.
Example 6.3 Separation Spaces
Legend:
6.3. Line Prefixes
Inside scalar content, each line begins with a non-contentline prefix.This prefix always includes the indentation.For flow scalar styles it additionally includes all leading white space,which may contain tab characters.
Line prefixes are a presentation detail and must not be used to conveycontent information.
Example 6.4 Line Prefixes
Legend:
6.4. Empty Lines
An empty line line consists of the non-contentprefix followed by a linebreak.
The semantics of empty lines depend on the scalar style they appear in.This is handled on a case-by-case basis by the relevant productions.
Example 6.5 Empty Lines
Legend:
6.5. Line Folding
Line folding allows long lines to be broken for readability, while retainingthe semantics of the original long line.If a line break is followed by an empty line, it is trimmed; the firstline break is discarded and the rest are retained as content.
Otherwise (the following line is not empty), the line break is converted toa single space (x20
).
A folded non-empty line may end with either of the above line breaks.
Example 6.6 Line Folding
Legend:
The above rules are common to both the folded block style and the scalarflow styles.Folding does distinguish between these cases in the following way:
In the folded block style, the final line break and trailing empty linesare subject to chomping and are never folded.In addition, folding does not apply to line breaks surrounding text linesthat contain leading white space.Note that such a more-indented line may consist only of such leading whitespace.
The combined effect of the block line folding rules is that each 'paragraph'is interpreted as a line, empty lines are interpreted as a line feed and theformatting of more-indented lines is preserved.
Example 6.7 Block Folding
Legend:
Non-content spaces
Content spaces
Folding in flow styles provides more relaxed semantics.Flow styles typically depend on explicit indicators rather thanindentation to convey structure.Hence spaces preceding or following the text in a line are a presentationdetail and must not be used to convey content information.Once all such spaces have been discarded, all line breaks are folded withoutexception.
The combined effect of the flow line folding rules is that each 'paragraph'is interpreted as a line, empty lines are interpreted as line feeds and textcan be freely more-indented without affecting the content information.
Example 6.8 Flow Folding
Legend:
Non-content spaces
6.6. Comments
An explicit comment is marked by a '#
' indicator.Comments are a presentation detail and must not be used to convey contentinformation.
Comments must be separated from other tokens by white space characters.
Note: To ensure JSON compatibility, YAML processors must allow for theomission of the final comment line break of the input stream.However, as this confuses many tools, YAML processors should terminate thestream with an explicit line break on output.
Example 6.9 Separated Comment
Legend:
Outside scalar content, comments may appear on a line of their own,independent of the indentation level.Note that outside scalar content, a line containing only white spacecharacters is taken to be a comment line.
Example 6.10 Comment Lines
In most cases, when a line may end with a comment, YAML allows it to befollowed by additional comment lines.The only exception is a comment ending a block scalar header.
Example 6.11 Multi-Line Comments
Legend:
6.7. Separation Lines
Implicit keys are restricted to a single line.In all other cases, YAML allows tokens to be separated by multi-line (possiblyempty) comments.
Note that structures following multi-line comment separation must be properlyindented, even though there is no such restriction on the separationcomment lines themselves.
Example 6.12 Separation Spaces
Legend:
6.8. Directives
Directives are instructions to the YAML processor.This specification defines two directives, 'YAML
' and 'TAG
', and reservesall other directives for future use.There is no way to define private directives.This is intentional.
Directives are a presentation detail and must not be used to convey contentinformation.
Each directive is specified on a separate non-indented line starting with the'%
' indicator, followed by the directive name and a list of parameters.The semantics of these parameters depends on the specific directive.A YAML processor should ignore unknown directives with an appropriatewarning.
Example 6.13 Reserved Directives
Legend:
6.8.1. 'YAML
' Directives
The 'YAML
' directive specifies the version of YAML the document conformsto.This specification defines version '1.2
', including recommendations for YAML1.1 processing.
A version 1.2 YAML processor must accept documents with an explicit '%YAML1.2
' directive, as well as documents lacking a 'YAML
' directive.Such documents are assumed to conform to the 1.2 version specification.Documents with a 'YAML
' directive specifying a higher minor version (e.g.'%YAML 1.3
') should be processed with an appropriate warning.Documents with a 'YAML
' directive specifying a higher major version (e.g.'%YAML 2.0
') should be rejected with an appropriate error message.
A version 1.2 YAML processor must also accept documents with an explicit'%YAML 1.1
' directive.Note that version 1.2 is mostly a superset of version 1.1, defined for thepurpose of ensuring JSON compatibility.Hence a version 1.2 processor should process version 1.1 documents as ifthey were version 1.2, giving a warning on points of incompatibility (handlingof non-ASCII line breaks, as described above).
Example 6.14 'YAML
' directive
Legend:
It is an error to specify more than one 'YAML
' directive for the samedocument, even if both occurrences give the same version number.
6.8.2. 'TAG
' Directives
The 'TAG
' directive establishes a tag shorthand notation for specifyingnode tags.Each 'TAG
' directive associates a handle with a prefix.This allows for compact and readable tag notation.
Example 6.16 'TAG
' directive
Legend:
It is an error to specify more than one 'TAG
' directive for the same handlein the same document, even if both occurrences give the same prefix.
6.8.2.1. Tag Handles
The tag handle exactly matches the prefix of the affected tag shorthand.There are three tag handle variants:
The primary tag handle is a single '!
' character.This allows using the most compact possible notation for a single 'primary'name space.By default, the prefix associated with this handle is '!
'.Thus, by default, shorthands using this handle are interpreted as localtags.
It is possible to override the default behavior by providing an explicit'TAG
' directive, associating a different prefix for this handle.This provides smooth migration from using local tags to using global tagsby the simple addition of a single 'TAG
' directive.
Example 6.18 Primary Tag Handle
Legend:
The secondary tag handle is written as '!!
'.This allows using a compact notation for a single 'secondary' name space.By default, the prefix associated with this handle is 'tag:yaml.org,2002:
'.
It is possible to override this default behavior by providing an explicit'TAG
' directive associating a different prefix for this handle.
Example 6.19 Secondary Tag Handle
Legend:
A named tag handle surrounds a non-empty name with '!
' characters.A handle name must not be used in a tag shorthand unless an explicit 'TAG
'directive has associated some prefix with it.
The name of the handle is a presentation detail and must not be used toconvey content information.In particular, the YAML processor need not preserve the handle name onceparsing is completed.
Example 6.20 Tag Handles
Legend:
6.8.2.2. Tag Prefixes
There are two tag prefix variants:
If the prefix begins with a '!
' character, shorthands using the handleare expanded to a local tag.Note that such a tag is intentionally not a valid URI and its semantics arespecific to the application.In particular, two documents in the same stream may assign differentsemantics to the same local tag.
Example 6.21 Local Tag Prefix
Legend:
If the prefix begins with a character other than '!
', it must be a valid URIprefix, and should contain at least the scheme.Shorthands using the associated handle are expanded to globally unique URItags and their semantics is consistent across applications.In particular, every document in every stream must assign the samesemantics to the same global tag.
Example 6.22 Global Tag Prefix
6.9. Node Properties
Each node may have two optional properties, anchor and tag, in additionto its content.Node properties may be specified in any order before the node's content.Either or both may be omitted.
Example 6.23 Node Properties
Legend:
6.9.1. Node Tags
The tag property identifies the type of the native data structurepresented by the node.A tag is denoted by the '!
' indicator.
A tag may be written verbatim by surrounding it with the '<
' and '>
'characters.In this case, the YAML processor must deliver the verbatim tag as-is to theapplication.In particular, verbatim tags are not subject to tag resolution.A verbatim tag must either begin with a '!
' (a local tag) or be a valid URI(a global tag).
Example 6.24 Verbatim Tags
Legend:
A tag shorthand consists of a valid tag handle followed by a non-emptysuffix.The tag handle must be associated with a prefix, either by default or byusing a 'TAG
' directive.The resulting parsedtag is the concatenation of the prefix and thesuffix and must either begin with '!
' (a local tag) or be a valid URI (aglobal tag).
The choice of tag handle is a presentation detail and must not be used toconvey content information.In particular, the tag handle may be discarded once parsing is completed.
The suffix must not contain any '!
' character.This would cause the tag shorthand to be interpreted as having a named taghandle.In addition, the suffix must not contain the '[
', ']
', '{
', '}
' and',
' characters.These characters would cause ambiguity with flow collection structures.If the suffix needs to specify any of the above restricted characters, theymust be escaped using the '%
' character.This behavior is consistent with the URI character escaping rules(specifically, section 2.3 of URI RFC).
Example 6.26 Tag Shorthands
Legend:
If a node has no tag property, it is assigned a non-specific tag that needsto be resolved to a specific one.This non-specific tag is '!
' for non-plain scalars and '?
' for allother nodes.This is the only case where the node style has any effect on the contentinformation.
It is possible for the tag property to be explicitly set to the '!
'non-specific tag.By convention, this 'disables' tag resolution, forcing the node to beinterpreted as 'tag:yaml.org,2002:seq
', 'tag:yaml.org,2002:map
' or'tag:yaml.org,2002:str
', according to its kind.
There is no way to explicitly specify the '?
' non-specific tag.This is intentional.
Example 6.28 Non-Specific Tags
Legend:
6.9.2. Node Anchors
An anchor is denoted by the '&
' indicator.It marks a node for future reference.An alias node can then be used to indicate additional inclusions of theanchored node.An anchored node need not be referenced by any alias nodes; in particular,it is valid for all nodes to be anchored.
Note that as a serialization detail, the anchor name is preserved in theserialization tree.However, it is not reflected in the representation graph and must not be usedto convey content information.In particular, the YAML processor need not preserve the anchor name once therepresentation is composed.
Anchor names must not contain the '[
', ']
', '{
', '}
' and ',
'characters.These characters would cause ambiguity with flow collection structures.
Example 6.29 Node Anchors
Legend:
YAML's flow styles can be thought of as the natural extension of JSON tocover folding long content lines for readability, tagging nodes to controlconstruction of native data structures and using anchors and aliases toreuse constructed object instances. Adobe lightroom classic cc 8 3 1.
7.1. Alias Nodes
Subsequent occurrences of a previously serialized node are presented asalias nodes.The first occurrence of the node must be marked by an anchor to allowsubsequent occurrences to be presented as alias nodes.
An alias node is denoted by the '*
' indicator.The alias refers to the most recent preceding node having the same anchor.It is an error for an alias node to use an anchor that does not previouslyoccur in the document.It is not an error to specify an anchor that is not used by any alias node.
Note that an alias node must not specify any properties or content, asthese were already specified at the first occurrence of the node.
Example 7.1 Alias Nodes
Legend:
7.2. Empty Nodes
YAML allows the node content to be omitted in many cases.Nodes with empty content are interpreted as if they were plain scalarswith an empty value.Such nodes are commonly resolved to a 'null
' value.
In the examples, empty scalars are sometimes displayed as the glyph '°
' forclarity.Note that this glyph corresponds to a position in the characters streamrather than to an actual character.
Example 7.2 Empty Content
Legend:
Both the node's properties and node content are optional.This allows for a completely empty node.Completely empty nodes are only valid when following some explicit indicationfor their existence.
Example 7.3 Completely Empty Flow Nodes
Legend:
7.3. Flow Scalar Styles
Marked 2 2 5 900
YAML provides three flow scalar styles: double-quoted, single-quoted andplain (unquoted).Each provides a different trade-off between readability and expressive power.
The scalar style is a presentation detail and must not be used to conveycontent information, with the exception that plain scalars aredistinguished for the purpose of tag resolution.
7.3.1. Double-Quoted Style
The double-quoted style is specified by surrounding ''
' indicators.This is the only style capable of expressing arbitrary strings, by using'' escape sequences.This comes at the cost of having to escape the '
' and '
'
' characters.
Double-quoted scalars are restricted to a single line when contained inside animplicit key.
Example 7.4 Double Quoted Implicit Keys
Legend:
In a multi-line double-quoted scalar, line breaks are subject to flow linefolding, which discards any trailing white space characters.It is also possible to escape the line break character.In this case, the escaped line break is excluded from the content and anytrailing white space characters that precede the escaped line break arepreserved.Combined with the ability to escapewhite space characters, this allowsdouble-quoted lines to be broken at arbitrary positions.
Example 7.5 Double Quoted Line Breaks
Legend:
All leading and trailing white space characters on each line are excludedfrom the content.Each continuation line must therefore contain at least one non-spacecharacter.Empty lines, if any, are consumed as part of the line folding.
Example 7.6 Double Quoted Lines
Legend:
7.3.2. Single-Quoted Style
The single-quoted style is specified by surrounding ''
' indicators.Therefore, within a single-quoted scalar, such characters need to be repeated.This is the only form of escaping performed in single-quoted scalars.In particular, the '' and '
'
' characters may be freely used.This restricts single-quoted scalars to printable characters.In addition, it is only possible to break a long single-quoted line where aspace character is surrounded by non-spaces.
Example 7.7 Single Quoted Characters
Legend:
Single-quoted scalars are restricted to a single line when contained inside aimplicit key.
Example 7.8 Single Quoted Implicit Keys
Legend:
All leading and trailing white space characters are excluded from thecontent.Each continuation line must therefore contain at least one non-spacecharacter.Empty lines, if any, are consumed as part of the line folding.
Example 7.9 Single Quoted Lines
Legend:
7.3.3. Plain Style
The plain (unquoted) style has no identifying indicators and provides noform of escaping.It is therefore the most readable, most limited and most context sensitivestyle.In addition to a restricted character set, a plain scalar must not be empty orcontain leading or trailing white space characters.It is only possible to break a long plain line where a space character issurrounded by non-spaces.
Plain scalars must not begin with most indicators, as this would causeambiguity with other YAML constructs.However, the ':
', '?
' and '-
' indicators may be used as the firstcharacter if followed by a non-space 'safe' character, as this causes noambiguity.
Plain scalars must never contain the ':
' and ' #
' character combinations.Such combinations would cause ambiguity with mappingkey/value pairs andcomments.In addition, inside flow collections, or when used as implicit keys, plainscalars must not contain the '[
', ']
', '{
', '}
' and ',
' characters.These characters would cause ambiguity with flow collection structures.
Example 7.10 Plain Characters
Legend:
Not ns-plain-first(c)
Not ns-plain-char(c)
Plain scalars are further restricted to a single line when contained inside animplicit key.
Example 7.11 Plain Implicit Keys
Legend:
All leading and trailing white space characters are excluded from thecontent.Each continuation line must therefore contain at least one non-spacecharacter.Empty lines, if any, are consumed as part of the line folding.
Example 7.12 Plain Lines
Legend:
7.4. Flow Collection Styles
A flow collection may be nested within a block collection ([FLOW-OUT
context]), nested within another flow collection ([FLOW-IN
context]) or be apart of an implicit key ([FLOW-KEY
context] or [BLOCK-KEY
context]).Flow collection entries are terminated by the ',
' indicator.The final ',
' may be omitted.This does not cause ambiguity because flow collection entries can never becompletely empty.
7.4.1. Flow Sequences
Flow sequence content is denoted by surrounding '[
' and ']
' characters.
Sequence entries are separated by a ',
' character.
Example 7.13 Flow Sequence
Legend:
Any flow node may be used as a flow sequence entry.In addition, YAML provides a compact notation for the case where a flowsequence entry is a mapping with a single key/value pair.
Example 7.14 Flow Sequence Entries
Legend:
7.4.2. Flow Mappings
Flow mappings are denoted by surrounding '{
' and '}
' characters.
Mapping entries are separated by a ',
' character.
Example 7.15 Flow Mappings
Legend:
If the optional '?
' mapping key indicator is specified, the rest of the entrymay be completely empty.
Example 7.16 Flow Mapping Entries
Legend:
Normally, YAML insists the ':
' mapping value indicator be separated fromthe value by white space.A benefit of this restriction is that the ':
' character can be used insideplain scalars, as long as it is not followed by white space.This allows for unquoted URLs and timestamps.It is also a potential source for confusion as 'a:1
' is a plain scalar andnot a key/value pair.
Note that the value may be completely empty since its existence isindicated by the ':
'.
Example 7.17 Flow Mapping Separate Values
Legend:
To ensure JSON compatibility, if a key inside a flow mapping isJSON-like, YAML allows the following value to be specified adjacent to the':
'.This causes no ambiguity, as all JSON-likekeys are surrounded byindicators.However, as this greatly reduces readability, YAML processors shouldseparate the value from the ':
' on output, even in this case.
Example 7.18 Flow Mapping Adjacent Values
Legend:
A more compact notation is usable inside flow sequences, if the mappingcontains a single key/value pair.This notation does not require the surrounding '{
' and '}
' characters.Note that it is not possible to specify any node properties for the mappingin this case.
Example 7.19 Single Pair Flow Mappings
Legend:
If the '?
' indicator is explicitly specified, parsing is unambiguous andthe syntax is identical to the general case.
Example 7.20 Single Pair Explicit Entry
Legend:
If the '?
' indicator is omitted, parsing needs to see past the implicitkey to recognize it as such.To limit the amount of lookahead required, the ':
' indicator must appear atmost 1024 Unicode characters beyond the start of the key.In addition, the key is restricted to a single line.
Note that YAML allows arbitrary nodes to be used as keys.In particular, a key may be a sequence or a mapping.Thus, without the above restrictions, practical one-pass parsing would havebeen impossible to implement.
Example 7.21 Single Pair Implicit Entries
Legend:
Value
7.5. Flow Nodes
JSON-likeflow styles all have explicit start and end indicators.The only flow style that does not have this property is the plain scalar.Note that none of the 'JSON-like' styles is actually acceptable by JSON.Even the double-quoted style is a superset of the JSON string format.
Example 7.23 Flow Content
Legend:
A complete flownode also has optional node properties, except for aliasnodes which refer to the anchorednode properties.
Example 7.24 Flow Nodes
Legend:
YAML's block styles employ indentation rather than indicators to denotestructure.This results in a more human readable (though less compact) notation.
8.1. Block Scalar Styles
YAML provides two block scalar styles, literal and folded.Each provides a different trade-off between readability and expressive power.
8.1.1. Block Scalar Headers
Block scalars are controlled by a few indicators given in a headerpreceding the content itself.This header is followed by a non-content line break with an optionalcomment.This is the only case where a comment must not be followed by additionalcomment lines.
Note: See Production Parameters for the definition of the t
variable.
Example 8.1 Block Scalar Header
Legend:
8.1.1.1. Block Indentation Indicator
Every block scalar has a content indentation level.The content of the block scalar excludes a number of leading spaces on eachline up to the content indentation level.
If a block scalar has an indentation indicator, then the content indentationlevel of the block scalar is equal to the indentation level of the block scalarplus the integer value of the indentation indicator character.
If no indentation indicator is given, then the content indentation level isequal to the number of leading spaces on the first non-empty line of thecontents.If there is no non-empty line then the content indentation level is equal tothe number of spaces on the longest line.
It is an error if any non-empty line does not begin with a number of spacesgreater than or equal to the content indentation level.
It is an error for any of the leading empty lines to contain more spacesthan the first non-empty line.
A YAML processor should only emit an explicit indentation indicator for caseswhere detection will fail.
Example 8.2 Block Indentation Indicator
Legend:
Example 8.3 Invalid Block Scalar Indentation Indicators
8.1.1.2. Block Chomping Indicator
Chomping controls how final line breaks and trailing empty lines areinterpreted.YAML provides three chomping methods:
Stripping is specified by the '-
' chomping indicator.In this case, the final line break and any trailing empty lines areexcluded from the scalar's content.
Clipping is the default behavior used if no explicit chomping indicator isspecified.In this case, the final line break character is preserved in the scalar'scontent.However, any trailing empty lines are excluded from the scalar's content.
Keeping is specified by the '+
' chomping indicator.In this case, the final line break and any trailing empty lines areconsidered to be part of the scalar's content.These additional lines are not subject to folding.
The chomping method used is a presentation detail and must not be used toconvey content information.
The interpretation of the final line break of a block scalar is controlledby the chomping indicator specified in the block scalar header.
Example 8.4 Chomping Final Line Break
Legend:
The interpretation of the trailing empty lines following a block scalar isalso controlled by the chomping indicator specified in the block scalarheader.
Explicit comment lines may follow the trailing empty lines.To prevent ambiguity, the first such comment line must be less indentedthan the block scalar content.Additional comment lines, if any, are not so restricted.This is the only case where the indentation of comment lines isconstrained.
Example 8.5 Chomping Trailing Lines
Legend:
If a block scalar consists only of empty lines, then these lines areconsidered as trailing lines and hence are affected by chomping. Sketch 55 1 crack.
Example 8.6 Empty Scalar Chomping
Legend:
8.1.2. Literal Style
The literal style is denoted by the '|
' indicator.It is the simplest, most restricted and most readable scalar style.
Example 8.7 Literal Scalar
Legend:
Inside literal scalars, all (indented) characters are considered to becontent, including white space characters.Note that all line break characters are normalized.In addition, empty lines are not folded, though final line breaks andtrailing empty lines are chomped.
There is no way to escape characters inside literal scalars.This restricts them to printable characters.In addition, there is no way to break a long literal line.
Example 8.8 Literal Content
Legend:
8.1.3. Folded Style
The folded style is denoted by the '>
' indicator.It is similar to the literal style; however, folded scalars are subject toline folding.
Example 8.9 Folded Scalar
Legend:
Folding allows long lines to be broken anywhere a single space characterseparates two non-space characters.
Example 8.10 Folded Lines
Legend:
(The following three examples duplicate this example, each highlightingdifferent productions.)
Lines starting with white space characters (more-indented lines) are notfolded.
Example 8.11 More Indented Lines
Legend:
Line breaks and empty lines separating folded and more-indented lines arealso not folded.
Example 8.12 Empty Separation Lines
Legend:
(separation) l-empty(n,c)
The final line break and trailing empty lines if any, are subject tochomping and are never folded.
Example 8.13 Final Empty Lines
Legend:
8.2. Block Collection Styles
For readability, block collections styles are not denoted by any indicator.Instead, YAML uses a lookahead method, where a block collection isdistinguished from a plain scalar only when a key/value pair or a sequenceentry is seen.
8.2.1. Block Sequences
A block sequence is simply a series of nodes, each denoted by a leading'-
' indicator.The '-
' indicator must be separated from the node by white space.This allows '-
' to be used as the first character in a plain scalar iffollowed by a non-space character (e.g. '-42
').
Example 8.14 Block Sequence
Legend:
auto-detected s-indent(n)
The entry node may be either completely empty, be a nested block node oruse a compact in-line notation.The compact notation may be used when the entry is itself a nested blockcollection.In this case, both the '-
' indicator and the following spaces areconsidered to be part of the indentation of the nested collection.Note that it is not possible to specify node properties for such acollection.
Example 8.15 Block Sequence Entry Types
Legend:
Empty
8.2.2. Block Mappings
A Block mapping is a series of entries, each presenting a key/value pair.
Example 8.16 Block Mappings
Legend:
auto-detected s-indent(n)
If the '?
' indicator is specified, the optional value node must be specifiedon a separate line, denoted by the ':
' indicator.Note that YAML allows here the same compact in-line notation described abovefor block sequence entries.
Example 8.17 Explicit Block Mapping Entries
Legend:
If the '?
' indicator is omitted, parsing needs to see past theimplicit key, in the same way as in the single key/value pairflowmapping.Hence, such keys are subject to the same restrictions; they are limited to asingle line and must not span more than 1024 Unicode characters.
In this case, the value may be specified on the same line as the implicitkey.Note however that in block mappings the value must never be adjacent to the':
', as this greatly reduces readability and is not required for JSONcompatibility (unlike the case in flow mappings).
There is no compact notation for in-line values.Also, while both the implicit key and the value following it may be empty,the ':
' indicator is mandatory.This prevents a potential ambiguity with multi-line plain scalars.
Example 8.18 Implicit Block Mapping Entries
Legend:
A compact in-line notation is also available.This compact notation may be nested inside block sequences and explicit blockmapping entries.Note that it is not possible to specify node properties for such a nestedmapping.
Example 8.19 Compact Block Mappings
Legend:
8.2.3. Block Nodes
YAML allows flow nodes to be embedded inside block collections (but notvice-versa).Flow nodes must be indented by at least one more space than the parentblock collection.Note that flow nodes may begin on a following line.
It is at this point that parsing needs to distinguish between a plainscalar and an implicit key starting a nested block mapping.
Example 8.20 Block Node Types
Legend:
The block node's properties may span across several lines.In this case, they must be indented by at least one more space than theblock collection, regardless of the indentation of the block collectionentries.
Example 8.21 Block Scalar Nodes
Legend:
Since people perceive the '-
' indicator as indentation, nested blocksequences may be indented by one less space to compensate, except, ofcourse, if nested inside another block sequence ([BLOCK-OUT
context] versus[BLOCK-IN
context]).
Example 8.22 Block Collection Nodes
Legend:
9.1. Documents
A YAML character stream may contain several documents.Each document is completely independent from the rest.
9.1.1. Document Prefix
A document may be preceded by a prefix specifying the character encodingand optional comment lines.Note that all documents in a stream must use the same character encoding.However it is valid to re-specify the encoding using a byte order mark foreach document in the stream.
The existence of the optional prefix does not necessarily indicate theexistence of an actual document.
Example 9.1 Document Prefix
Legend:
9.1.2. Document Markers
Using directives creates a potential ambiguity.It is valid to have a '%
' character at the start of a line (e.g. as the firstcharacter of the second line of a plain scalar).How, then, to distinguish between an actual directive and a content linethat happens to start with a '%
' character?
The solution is the use of two special marker lines to control the processingof directives, one at the start of a document and one at the end.
At the start of a document, lines beginning with a '%
' character areassumed to be directives.The (possibly empty) list of directives is terminated by a directives endmarker line.Lines following this marker can safely use '%
' as the first character.
At the end of a document, a document end marker line is used to signal theparser to begin scanning for directives again.
The existence of this optional document suffix does not necessarily indicatethe existence of an actual following document.
Obviously, the actual content lines are therefore forbidden to begin witheither of these markers.
Example 9.2 Document Markers
Legend:
9.1.3. Bare Documents
A bare document does not begin with any directives or marker lines.Such documents are very 'clean' as they contain nothing other than thecontent.In this case, the first non-comment line may not start with a '%
' firstcharacter.
Document nodes are indented as if they have a parent indented at -1spaces.Since a node must be more indented than its parent node, this allows thedocument's node to be indented at zero or more spaces.
Example 9.3 Bare Documents
Legend:
9.1.4. Explicit Documents
An explicit document begins with an explicit directives end marker line butno directives.Since the existence of the document is indicated by this marker, thedocument itself may be completely empty.
Example 9.4 Explicit Documents
Legend:
9.1.5. Directives Documents
A directives document begins with some directives followed by an explicitdirectives end marker line.
Example 9.5 Directives Documents
Legend:
9.2. Streams
A YAML stream consists of zero or more documents.Subsequent documents require some sort of separation marker line.If a document is not terminated by a document end marker line, then thefollowing document must begin with a directives end marker line.
Example 9.6 Stream
Legend:
A sequence of bytes is a well-formed stream if, taken as a whole, it complieswith the above l-yaml-stream
production.
A YAML schema is a combination of a set of tags and a mechanism forresolvingnon-specific tags.
10.1. Failsafe Schema
The failsafe schema is guaranteed to work with any YAML document.It is therefore the recommended schema for generic YAML tools.A YAML processor should therefore support this schema, at least as anoption.
10.1.1. Tags
10.1.1.1. Generic Mapping
tag:yaml.org,2002:map
Mapping.
Represents an associative container, where each key is unique in theassociation and mapped to exactly one value.YAML places no restrictions on the type of keys; in particular, they are notrestricted to being scalars.Example bindings to native types include Perl's hash, Python's dictionaryand Java's Hashtable.
Example 10.1 !!map
Examples
10.1.1.2. Generic Sequence
tag:yaml.org,2002:seq
Sequence.
Represents a collection indexed by sequential integers starting with zero.Example bindings to native types include Perl's array, Python's list ortuple and Java's array or Vector.
10.1.1.3. Generic String
tag:yaml.org,2002:str
Scalar.
Represents a Unicode string, a sequence of zero or more Unicode characters.This type is usually bound to the native language's string type or, forlanguages lacking one (such as C), to a character array.
The obvious.
10.1.2. Tag Resolution
All nodes with the '!
' non-specific tag are resolved, by the standardconvention, to 'tag:yaml.org,2002:seq
', 'tag:yaml.org,2002:map
' or'tag:yaml.org,2002:str
', according to their kind.
All nodes with the '?
' non-specific tag are left unresolved.This constrains the application to deal with a partial representation.
10.2. JSON Schema
The JSON schema is the lowest common denominator of most modern computerlanguages and allows parsing JSON files.A YAML processor should therefore support this schema, at least as anoption.It is also strongly recommended that other schemas should be based on it.
10.2.1. Tags
The JSON schema uses the following tags in addition to those defined by thefailsafe schema:
10.2.1.1. Null
tag:yaml.org,2002:null
Scalar.
Represents the lack of a value.This is typically bound to a native null-like value (e.g., undef
in Perl,None
in Python).Note that a null is different from an empty string.Also, a mapping entry with some key and a null value is valid anddifferent from not having that key in the mapping.
null
.
Example 10.4 !!null
Examples
10.2.1.2. Boolean
tag:yaml.org,2002:bool
Scalar.
Represents a true/false value.In languages without a native Boolean type (such as C), they are usuallybound to a native integer type, using one for true and zero for false.
Either true
or false
. Tri catalog v7 3 6 download free.
Example 10.5 !!bool
Examples
10.2.1.3. Integer
tag:yaml.org,2002:int
Scalar.
Represents arbitrary sized finite mathematical integers.Scalars of this type should be bound to a native integer data type, ifpossible.
Some languages (such as Perl) provide only a 'number' type that allows for bothinteger and floating-point values.A YAML processor may use such a type for integers as long as they round-tripproperly.
In some languages (such as C), an integer may overflow the native type'sstorage capability.A YAML processor may reject such a value as an error, truncate it with awarning or find some other manner to round-trip it.In general, integers representable using 32 binary digits should safelyround-trip through most systems.
Decimal integer notation, with a leading '-
' character for negative values,matching the regular expression 0 | -? [1-9] [0-9]*
Example 10.6 !!int
Examples
10.2.1.4. Floating Point
tag:yaml.org,2002:float
Scalar.
Represents an approximation to real numbers, including three special values(positive and negative infinity and 'not a number').
Some languages (such as Perl) provide only a 'number' type that allows for bothinteger and floating-point values.A YAML processor may use such a type for floating-point numbers, as long asthey round-trip properly.
Not all floating-point values can be stored exactly in any given native type.Hence a float value may change by 'a small amount' when round-tripped.The supported range and accuracy depends on the implementation, though 32 bitIEEE floats should be safe.Since YAML does not specify a particular accuracy, using floating-pointmapping keys requires great care and is not recommended.
Either 0
, .inf
, -.inf
, .nan
or scientific notation matching the regularexpression-? [1-9] ( . [0-9]* [1-9] )? ( e [-+] [1-9] [0-9]* )?
.
Example 10.7 !!float
Examples
10.2.2. Tag Resolution
The JSON schematag resolution is an extension of the failsafe schematag resolution.
All nodes with the '!
' non-specific tag are resolved, by the standardconvention, to 'tag:yaml.org,2002:seq
', 'tag:yaml.org,2002:map
' or'tag:yaml.org,2002:str
', according to their kind.
Collections with the '?
' non-specific tag (that is, untaggedcollections) are resolved to 'tag:yaml.org,2002:seq
' or'tag:yaml.org,2002:map
' according to their kind.
Scalars with the '?
' non-specific tag (that is, plain scalars) arematched with a list of regular expressions (first match wins, e.g. 0
isresolved as !!int
).In principle, JSON files should not contain any scalars that do not match atleast one of these.Hence the YAML processor should consider them to be an error.
Regular expression | Resolved to tag |
---|---|
null | tag:yaml.org,2002:null |
true | false | tag:yaml.org,2002:bool |
-? ( 0 | [1-9] [0-9]* ) | tag:yaml.org,2002:int |
-? ( 0 | [1-9] [0-9]* ) ( . [0-9]* )? ( [eE] [-+]? [0-9]+ )? | tag:yaml.org,2002:float |
* | Error |
Note: The regular expression for float
does not exactly match the one inthe JSON specification, where at least one digit is required after the dot: (. [0-9]+ )
. The YAML 1.2 specification intended to match JSON behavior, butthis cannot be addressed in the 1.2.2 specification.
Example 10.8 JSON Tag Resolution
10.3. Core Schema
The Core schema is an extension of the JSON schema, allowing for morehuman-readable presentation of the same types.This is the recommended default schema that YAML processor should useunless instructed otherwise.It is also strongly recommended that other schemas should be based on it.
10.3.1. Tags
The core schema uses the same tags as the JSON schema.
10.3.2. Tag Resolution
The core schematag resolution is an extension of the JSON schematagresolution.
All nodes with the '!
' non-specific tag are resolved, by the standardconvention, to 'tag:yaml.org,2002:seq
', 'tag:yaml.org,2002:map
' or'tag:yaml.org,2002:str
', according to their kind.
Collections with the '?
' non-specific tag (that is, untaggedcollections) are resolved to 'tag:yaml.org,2002:seq
' or'tag:yaml.org,2002:map
' according to their kind.
Scalars with the '?
' non-specific tag (that is, plain scalars) arematched with an extended list of regular expressions.However, in this case, if none of the regular expressions matches, the scalaris resolved to tag:yaml.org,2002:str
(that is, considered to be a string).
Regular expression | Resolved to tag |
---|---|
null | Null | NULL | ~ | tag:yaml.org,2002:null |
/* Empty */ | tag:yaml.org,2002:null |
true | True | TRUE | false | False | FALSE | tag:yaml.org,2002:bool |
[-+]? [0-9]+ | tag:yaml.org,2002:int (Base 10) |
0o [0-7]+ | tag:yaml.org,2002:int (Base 8) |
0x [0-9a-fA-F]+ | tag:yaml.org,2002:int (Base 16) |
[-+]? ( . [0-9]+ | [0-9]+ ( . [0-9]* )? ) ( [eE] [-+]? [0-9]+ )? | tag:yaml.org,2002:float (Number) |
[-+]? ( .inf | .Inf | .INF ) | tag:yaml.org,2002:float (Infinity) |
.nan | .NaN | .NAN | tag:yaml.org,2002:float (Not a number) |
* | tag:yaml.org,2002:str (Default) |
10.4. Other Schemas
None of the above recommended schemas preclude the use of arbitrary explicittags.Hence YAML processors for a particular programming language typically providesome form of local tags that map directly to the language's native datastructures (e.g., !ruby/object:Set
).
While such local tags are useful for ad hoc applications, they do notsuffice for stable, interoperable cross-application or cross-platform dataexchange.
Interoperable schemas make use of global tags (URIs) that represent thesame data across different programming languages.In addition, an interoperable schema may provide additional tag resolutionrules.Such rules may provide additional regular expressions, as well as consider thepath to the node.This allows interoperable schemas to use untaggednodes.
It is strongly recommended that such schemas be based on the core schemadefined above.