Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Ben-Kiki O.YAML ain't markup language.V1.1.pdf
Скачиваний:
7
Добавлен:
23.08.2013
Размер:
1.06 Mб
Скачать

YAML Ain'tMarkup Language (YAML™ )

Version 1.1

Working Draft 2004-12-28

Oren Ben-Kiki <oren@ben-kiki.org>

Clark Evans <cce@clarkevans.com>

Brian Ingerson <ingy@ttul.org>

XSLFO

RenderX

YAML Ain'tMarkup Language (YAML) Version 1.1 Working Draft 2004-12-28

by Oren Ben-Kiki, Clark Evans, and Brian Ingerson

Copyright © 2001-2004 Oren Ben-Kiki, Clark Evans, Brian Ingerson

Status of this Document

This specification is a draft reflecting consensus reached by members of the yaml-core mailing list [http://lists.sourceforge.net/lists/listinfo/yaml-core]. Any questions regarding this draft should be raised on this list. We expect all further changes will be strictly limited to wording corrections and fixing production bugs.

We wish to thank implementers who have tirelessly tracked earlier versions of this specification, and our fabulous user community whose feedback has both validated and clarified our direction.

Abstract

YAML™ (rhymes with “camel”) is a human-friendly, cross language, Unicode based data serialization language designed around the common native data structures of agile programming languages. It is broadly useful for programming needs ranging from configuration files to Internet messaging to object persistence to data auditing. Together with the Unicode standard for characters [http://www.unicode.org/], this specification provides all the information necessary to understand YAML Version 1.1 and to creating programs that process YAML information.

This document may be freely copied provided it is not modified.

XSLFO

RenderX

Table of Contents

 

1. Introduction ........................................................................................................................................

1

1.1. Goals ..........................................................................................................................................

1

1.2. Prior Art ......................................................................................................................................

1

1.3. Relation to XML ...........................................................................................................................

2

1.4. Terminology .................................................................................................................................

3

2. Preview ..............................................................................................................................................

4

2.1. Collections ...................................................................................................................................

4

2.2. Structures .....................................................................................................................................

5

2.3. Scalars .........................................................................................................................................

6

2.4. Tags ............................................................................................................................................

7

2.5. Full Length Example ......................................................................................................................

9

3. Processing YAML Information .............................................................................................................

10

3.1. Processes ....................................................................................................................................

10

3.1.1. Represent .............................................................................................................................

10

3.1.2. Serialize ..............................................................................................................................

11

3.1.3. Present ................................................................................................................................

11

3.1.4. Parse ...................................................................................................................................

11

3.1.5. Compose ..............................................................................................................................

11

3.1.6. Construct .............................................................................................................................

11

3.2. Information Models ......................................................................................................................

11

3.2.1. Representation Graph .............................................................................................................

12

3.2.1.1. Nodes ...........................................................................................................................

13

3.2.1.2. Tags .............................................................................................................................

13

3.2.1.3. Nodes Comparison ..........................................................................................................

14

3.2.2. Serialization Tree ..................................................................................................................

14

3.2.2.1. Keys Order ....................................................................................................................

15

3.2.2.2. Anchors and Aliases ........................................................................................................

15

3.2.3. Presentation Stream ...............................................................................................................

15

3.2.3.1. Node Styles ...................................................................................................................

16

3.2.3.2. Scalar Formats ................................................................................................................

17

3.2.3.3. Comments .....................................................................................................................

17

3.2.3.4. Directives ......................................................................................................................

17

3.3. Loading Failure Points ..................................................................................................................

17

3.3.1. Well-Formed and Identified .....................................................................................................

18

3.3.2. Resolved ..............................................................................................................................

18

3.3.3. Recognized and Valid ............................................................................................................

19

3.3.4. Available .............................................................................................................................

19

4. Syntax ..............................................................................................................................................

20

4.1. Characters ..................................................................................................................................

20

4.1.1. Character Set ........................................................................................................................

20

4.1.2. Character Encoding ................................................................................................................

21

4.1.3. Indicator Characters ...............................................................................................................

21

4.1.4. Line Break Characters ............................................................................................................

25

4.1.5. Miscellaneous Characters ........................................................................................................

26

4.1.6. Escape Sequences ..................................................................................................................

28

4.2. Syntax Primitives .........................................................................................................................

30

4.2.1. Production Parameters ............................................................................................................

30

4.2.2. Indentation Spaces .................................................................................................................

31

4.2.3. Comments ............................................................................................................................

32

4.2.4. Separation Spaces ..................................................................................................................

33

4.2.5. Ignored Line Prefix ................................................................................................................

34

 

iii

XSLFO

RenderX

YAML Ain't Markup Lan-

guage (YAML™

) Version 1.1

4.2.6. Line Folding .........................................................................................................................

35

4.3. YAML Character Stream ...............................................................................................................

36

4.3.1. Directives ............................................................................................................................

37

4.3.1.1. YAML Directive .............................................................................................................

37

4.3.1.2. TAG Directive ................................................................................................................

38

4.3.1.2.1. Tag Prefixes ............................................................................................................

38

4.3.1.2.2. Tag Handles ............................................................................................................

39

4.3.2. Document Boundary Markers ..................................................................................................

40

4.3.3. Documents ...........................................................................................................................

41

4.3.4. Complete Stream ...................................................................................................................

42

4.4. Nodes ........................................................................................................................................

43

4.4.1. Node Anchors .......................................................................................................................

44

4.4.2. Node Tags ............................................................................................................................

44

4.4.3. Node Content .......................................................................................................................

47

4.4.4. Alias Nodes ..........................................................................................................................

49

4.4.5. Complete Nodes ....................................................................................................................

49

4.4.5.1. Flow Nodes ...................................................................................................................

49

4.4.5.2. Block Nodes ..................................................................................................................

50

4.5. Scalar Styles ...............................................................................................................................

51

4.5.1. Flow Scalar Styles .................................................................................................................

51

4.5.1.1. Double Quoted ...............................................................................................................

51

4.5.1.2. Single Quoted ................................................................................................................

54

4.5.1.3. Plain .............................................................................................................................

57

4.5.2. Block Scalar Header ...............................................................................................................

60

4.5.2.1. Block Style Indicator .......................................................................................................

61

4.5.2.2. Block Indentation Indicator ...............................................................................................

61

4.5.2.3. Block Chomping Indicator ................................................................................................

62

4.5.3. Block Scalar Styles ................................................................................................................

64

4.5.3.1. Literal ...........................................................................................................................

65

4.5.3.2. Folded ..........................................................................................................................

66

4.6. Collection Styles ..........................................................................................................................

69

4.6.1. Sequence Styles ....................................................................................................................

69

4.6.1.1. Flow Sequences ..............................................................................................................

69

4.6.1.2. Block Sequences .............................................................................................................

70

4.6.2. Mapping Styles .....................................................................................................................

72

4.6.2.1. Flow Mappings ...............................................................................................................

72

4.6.2.2. Block Mappings .............................................................................................................

76

Terms Index .........................................................................................................................................

79

iv

XSLFO

RenderX

Соседние файлы в предмете Электротехника