Changeset 8 for trunk/spec/spec.dbk
- Timestamp:
- 05/11/08 17:47:56 (5 months ago)
- Files:
-
- 1 modified
-
trunk/spec/spec.dbk (modified) (193 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/spec/spec.dbk
r7 r8 8 8 <title> 9 9 YAML Ain<q/>t Markup Language (<trademark>YAML</trademark>) 10 Version 1. 110 Version 1.2 11 11 </title> 12 12 13 13 <subtitle> 14 Working Draft 2008-0 4-0614 Working Draft 2008-05-11 15 15 </subtitle> 16 16 … … 52 52 <ulink url="http://yaml.org/spec/cvs/current.ps">ps</ulink>, 53 53 <ulink url="http://yaml.org/spec/cvs/current.pdf">pdf</ulink>.<sbr/> 54 <!-- Only for posted revisions:55 <ulink56 url="http://yaml.org/spec/history/????-??-??/????-??-??.html">html</ulink>,57 <ulink58 url="http://yaml.org/spec/history/????-??-??/????-??-??.ps">ps</ulink>,59 <ulink60 url="http://yaml.org/spec/history/????-??-??/????-??-??.pdf">pdf</ulink>.<sbr/>61 -->62 <!-- Only for CVS revisions:63 <ulink url="http://yaml.org/spec/cvs/current.html">html</ulink>,64 <ulink url="http://yaml.org/spec/cvs/current.ps">ps</ulink>,65 <ulink url="http://yaml.org/spec/cvs/current.pdf">pdf</ulink>.<sbr/>66 67 <emphasis>Latest version:</emphasis>68 <ulink url="http://yaml.org/spec/current.html">html</ulink>,69 <ulink url="http://yaml.org/spec/current.ps">ps</ulink>,70 <ulink url="http://yaml.org/spec/current.pdf">pdf</ulink>.71 -->72 54 </releaseinfo> 73 55 … … 104 86 url="http://www.unicode.org/">Unicode standard for characters</ulink>, 105 87 this specification provides all the information necessary to understand 106 YAML Version 1. 1and to create programs that process YAML information.88 YAML Version 1.2 and to create programs that process YAML information. 107 89 </para> 108 90 </abstract> … … 244 226 (RFC2045), YAML<q/>s top-level production is a <refterm 245 227 primary="stream">stream</refterm> of independent <refterm 246 primary="document">documents</refterm> ;ideal for message-based228 primary="document">documents</refterm>, ideal for message-based 247 229 distributed processing systems. 248 230 </para> … … 330 312 YAML was designed to support incremental interfaces that include both 331 313 input (<uquote>getNextEvent()</uquote>) and output 332 <uquote>sendNextEvent()</uquote>) one-pass interfaces. Together, these314 (<uquote>sendNextEvent()</uquote>) one-pass interfaces. Together, these 333 315 enable YAML to support the processing of large <refterm 334 316 primary="document">documents</refterm> (e.g. transaction logs) or … … 392 374 is also the case in practice; every JSON file is also a valid YAML 393 375 file. This makes it easy to migrate from JSON to YAML if/when the 394 additional features are requi tred.376 additional features are required. 395 377 </para> 396 378 … … 431 413 The word <emphasis>may</emphasis>, or the adjective 432 414 <emphasis>optional</emphasis>, mean that conforming YAML <refterm 433 primary="processor">processors</refterm> are permitted , but415 primary="processor">processors</refterm> are permitted to, but 434 416 <defterm primary="need not">need not</defterm> behave as 435 417 described. … … 472 454 model and the YAML text format. The bulk of the document, chapters <link 473 455 linkend="Syntax">4</link> through <link linkend="YAML">9</link>, formally 474 define this text format. 456 define this text format. Finally, chapter <link 457 linkend="Syntax">10</link> recommends basic YAML schemas. 475 458 </para> 476 459 </chapter> … … 619 602 <keep-together> 620 603 <para> 621 YAML uses three dashes (<refterm primary="document boundary622 marker"><uquote>---</uquote></refterm>) to separate <refterm623 primary="document">documents</refterm> within a <refterm624 primary="stream">stream</refterm>. Three dots ( <refterm625 primary="document boundary marker"><uquote>...</uquote></refterm>)626 indicate the end of a document without starting a new one, for use in627 communication channels. <refterm primary="comment">Comments</refterm>628 begin with an octothorpe (also called a <quote>hash</quote>,629 <quote>sharp</quote>, <quote>pound</quote>, or <quote>number630 sign</quote> - <refterm primary="# comment">631 <uquote>#</uquote></refterm>).604 YAML uses three dashes (<refterm primary="document" 605 secondary="boundary marker"><uquote>---</uquote></refterm>) to 606 separate <refterm primary="document">documents</refterm> within a 607 <refterm primary="stream">stream</refterm>. Three dots ( 608 <refterm primary="document" secondary="boundary 609 marker"><uquote>...</uquote></refterm>) indicate the end of a 610 document without starting a new one, for use in communication 611 channels. <refterm primary="comment">Comments</refterm> begin with an 612 octothorpe (also called a <quote>hash</quote>, <quote>sharp</quote>, 613 <quote>pound</quote>, or <quote>number sign</quote> - <refterm 614 primary="# comment"> <uquote>#</uquote></refterm>). 632 615 </para> 633 616 … … 677 660 <keep-together> 678 661 <para> 679 Repeated <refterm primary="node">nodes</refterm> are first <refterm680 primary="alias" secondary="identified">identified</refterm> by an681 <refterm primary="anchor">anchor</refterm> (marked with the662 Repeated <refterm primary="node">nodes</refterm> (objects) are first 663 <refterm primary="alias" secondary="identified">identified</refterm> 664 by an <refterm primary="anchor">anchor</refterm> (marked with the 682 665 ampersand - <refterm primary="& 683 666 anchor"><uquote>&</uquote></refterm>), and are then <refterm … … 816 799 <example> 817 800 <title> 818 In the plain scalar,<sbr/>801 In the folded scalars,<sbr/> 819 802 newlines become spaces 820 803 </title> 821 <programlisting>--- <sbr/>804 <programlisting>--- ><sbr/> 822 805 Mark McGwire's 823 806 year was crippled … … 890 873 <programlisting>unicode: "Sosa did fine.\u263A"<sbr/> 891 874 control: "\b1998\t1999\t2000\n" 892 hex esc:"\x0d\x0a is \r\n"875 hex esc: "\x0d\x0a is \r\n" 893 876 894 877 single: '"Howdy!" he cried.' … … 937 920 and <ulink 938 921 url="http://yaml.org/type/null.html"><uquote>null</uquote></ulink> 939 types. The repository includes additional types such as <ulink 940 url="http://yaml.org/type/binary.html" 922 types. The <refterm primary="tag" 923 secondary="repository">repository</refterm> includes additional types 924 such as <ulink url="http://yaml.org/type/binary.html" 941 925 ><uquote>binary</uquote></ulink>, <ulink 942 926 url="http://yaml.org/type/bool.html"><uquote>bool</uquote></ulink>, … … 1242 1226 1243 1227 <para> 1244 This section details the processes shown in the diagram above. Note a1245 YAML <refterm primary="processor">processor</refterm> need not provide1246 all these processes. For example, a YAML library may provide only YAML1247 input ability, for loading configuration files, or only output ability,1248 for sending data to other <refterm1228 This section details the processes shown in the diagram above. Note 1229 that a YAML <refterm primary="processor">processor</refterm> need not 1230 provide all these processes. For example, a YAML library may provide 1231 only YAML input ability, for loading configuration files, or only 1232 output ability, for sending data to other <refterm 1249 1233 primary="application">applications</refterm>. 1250 1234 </para> … … 1417 1401 </sect2> 1418 1402 </sect1> 1403 1404 <pagebreak/> 1419 1405 1420 1406 <sect1> … … 1470 1456 </figure> 1471 1457 1458 <pagebreak/> 1459 1472 1460 <sect2> 1473 1461 <title>Representation Graph</title> … … 1578 1566 a unified collections view for sequences and mappings is helpful 1579 1567 both for theoretical analysis and for creating practical YAML tools 1580 and APIs. This strategy is also used by the Java Script programming1568 and APIs. This strategy is also used by the Javascript programming 1581 1569 language. 1582 1570 </para> 1583 1571 </sect3> 1584 1585 <pagebreak/>1586 1572 1587 1573 <sect3> … … 1633 1619 primary="sequence">sequence</refterm>, or <refterm 1634 1620 primary="mapping">mapping</refterm>). <refterm 1635 primary="scalar">Scalar</refterm> tags must also provide mechanism1636 for converting <refterm primary="scalar" secondary="content1637 format">formatted scontent</refterm> to a <refterm primary="scalar"1638 secondary="canonical form">canonical form</refterm> for supporting1639 <refterm primary="equality">equality</refterm> testing.1640 Furthermore, a tag may provide additional information such as the1641 set of allowed <refterm primary="content">content</refterm> values1642 for validation, a mechanism for <refterm primary="tag"1643 secondary="resolution">tag resolution</refterm>, or any other data1644 that is applicable to all of the tag<q/>s <refterm1645 primary="node">nodes</refterm>.1621 primary="scalar">Scalar</refterm> tags must also provide a 1622 mechanism for converting <refterm primary="scalar" 1623 secondary="content format">formatted content</refterm> to a 1624 <refterm primary="scalar" secondary="canonical form">canonical 1625 form</refterm> for supporting <refterm 1626 primary="equality">equality</refterm> testing. Furthermore, a tag 1627 may provide additional information such as the set of allowed 1628 <refterm primary="content">content</refterm> values for validation, 1629 a mechanism for <refterm primary="tag" secondary="resolution">tag 1630 resolution</refterm>, or any other data that is applicable to all 1631 of the tag<q/>s <refterm primary="node">nodes</refterm>. 1646 1632 </para> 1647 1633 </sect3> … … 1751 1737 To express a YAML <refterm 1752 1738 primary="representation">representation</refterm> using a serial API, 1753 it necessary to impose an <refterm primary="key"1739 it is necessary to impose an <refterm primary="key" 1754 1740 secondary="order">order</refterm> on <refterm primary="key" >mapping 1755 1741 keys</refterm> and employ <refterm primary="alias">alias … … 1861 1847 contained in the same YAML character stream, as a series of <refterm 1862 1848 primary="document">documents</refterm> separated by <refterm 1863 primary="document boundary marker">document boundary1849 primary="document" secondary="boundary marker">document boundary 1864 1850 markers</refterm>. Documents appearing in the same stream are 1865 1851 independent; that is, a <refterm primary="node">node</refterm> must … … 1877 1863 </mediaobject> 1878 1864 </figure> 1865 1866 <pagebreak/> 1879 1867 1880 1868 <sect3> … … 2130 2118 2131 2119 <para> 2132 Note resolution must not consider <refterm primary="presentation" 2133 secondary="detail">presentation details</refterm> such as <refterm 2120 Note that resolution must not consider <refterm 2121 primary="presentation" secondary="detail">presentation 2122 details</refterm> such as <refterm 2134 2123 primary="comment">comments</refterm>, <refterm primary="space" 2135 2124 secondary="indentation">indentation</refterm> and <refterm … … 2215 2204 representation</refterm> graph. In such a case, the YAML <refterm 2216 2205 primary="processor">processor</refterm> may <refterm 2217 primary="compose">compose</refterm> a n<refterm2206 primary="compose">compose</refterm> a <refterm 2218 2207 primary="representation" secondary="partial">partial 2219 2208 representation</refterm>, based on each <refterm … … 2250 2239 of the <refterm primary="collection">collection<q/>s</refterm> data 2251 2240 type. However, such a <refterm primary="representation" 2252 secondary="complete">complete representation</refterm> can not be2241 secondary="complete">complete representation</refterm> cannot be 2253 2242 used to <refterm primary="construct">construct</refterm> a <refterm 2254 2243 primary="native data structure">native data structure</refterm>. … … 2283 2272 <para> 2284 2273 The following chapters formally define the syntax of YAML character 2285 <refterm primary="stream">streams</refterm>, using (paramet erized) BNF2274 <refterm primary="stream">streams</refterm>, using (parametrized) BNF 2286 2275 productions. Each BNF production is both named and numbered for easy 2287 2276 reference. Whenever possible, basic structures are specified before the … … 2414 2403 YAML<q/>s syntax is designed for maximal human readability. This 2415 2404 requires parsing to depend on the surrounding text. For notational 2416 compactness, this dependency is expressed using paramet erized BNF2405 compactness, this dependency is expressed using parametrized BNF 2417 2406 productions. 2418 2407 </para> … … 2581 2570 </productionset> 2582 2571 </keep-together> 2572 2573 <keep-together> 2574 <para> 2575 To ensure <refterm primary="JSON compatibility">JSON 2576 compatibility</refterm>, YAML <refterm 2577 primary="processor">processors</refterm> must allow all non-control 2578 characters inside <refterm primary="style" secondary="flow" 2579 tertiary="double-quoted">quoted</refterm> <refterm primary="style" 2580 secondary="flow" tertiary="single-quoted">scalars</refterm>. On 2581 output, such characters should be <refterm primary="escaping" 2582 secondary="in double-quoted scalars">escaped</refterm> to ensure 2583 readability. 2584 </para> 2585 2586 <productionset> 2587 <production id="c-json"> 2588 <lhs>c-json</lhs> 2589 <rhs> 2590 #x9 | #xA | #xD | [#x20-#x10FFFF] 2591 </rhs> 2592 </production> 2593 </productionset> 2594 </keep-together> 2583 2595 </sect1> 2584 2596 … … 2586 2598 <title>Character Encodings</title> 2587 2599 2600 <para> 2601 All characters mentioned in this specification are Unicode code points. 2602 Each such code point is written as one or more bytes depending on the 2603 <defterm primary="character encoding">character encoding</defterm> 2604 used. Note that in UTF-16, characters above 2605 <userinput>#xFFFF</userinput> are written as four bytes, using a 2606 surrogate pair. 2607 </para> 2608 2609 <para> 2610 The character encoding is a <refterm primary="presentation" 2611 secondary="detail">presentation detail</refterm> and must not be used 2612 to convey <refterm primary="content">content</refterm> information. 2613 </para> 2614 2615 <para> 2616 On input, a YAML <refterm primary="processor">processor</refterm> must 2617 support the UTF-8 and UTF-16 character encodings. For <refterm 2618 primary="JSON compatibility">JSON compatibility</refterm>, the UTF-32 2619 encodings must also be supported. 2620 </para> 2621 2622 <para> 2623 If a character <refterm primary="stream">stream</refterm> begins with a 2624 <defterm primary="byte order mark">byte order mark</defterm>, the 2625 character encoding will be taken to be as as indicated by the byte 2626 order mark. Otherwise, the <refterm primary="stream">stream</refterm> 2627 must begin with an ASCII character. This allows the encoding to be 2628 deduced by the pattern of null (<userinput>#x00</userinput>) 2629 characters. 2630 </para> 2631 2588 2632 <keep-together> 2589 2633 <para> 2590 All characters mentioned in this specification are Unicode code 2591 points. Each such code point is written as one or more bytes 2592 depending on the <defterm primary="character encoding">character 2593 encoding</defterm> used. Note that in UTF-16, characters above 2594 <userinput>#xFFFF</userinput> are written as four bytes, using a 2595 surrogate pair. 2634 The encoding can therefore be deduced by matching the first few bytes 2635 of the <refterm primary="stream">stream</refterm> with the following 2636 table rows (in order): 2596 2637 </para> 2597 2638 2639 <informaltable> 2640 <tgroup cols="6"> 2641 <tbody> 2642 <row> 2643 <entry> <emphasis>Byte0 </emphasis></entry> 2644 <entry> <emphasis>Byte1 </emphasis></entry> 2645 <entry> <emphasis>Byte2 </emphasis></entry> 2646 <entry> <emphasis>Byte3 </emphasis></entry> 2647 <entry> <emphasis>Encoding</emphasis></entry> 2648 <entry></entry> 2649 </row> 2650 2651 <row> 2652 <entry> <userinput>#x00</userinput></entry> 2653 <entry> <userinput>#x00</userinput></entry> 2654 <entry> <userinput>#xFE</userinput></entry> 2655 <entry> <userinput>#xFF</userinput></entry> 2656 <entry> UTF-32BE</entry> 2657 <entry> <emphasis> Explicit BOM</emphasis></entry> 2658 </row> 2659 2660 <row> 2661 <entry> <userinput>#x00</userinput></entry> 2662 <entry> <userinput>#x00</userinput></entry> 2663 <entry> <userinput>#x00</userinput></entry> 2664 <entry> <emphasis>any</emphasis></entry> 2665 <entry> UTF-32BE</entry> 2666 <entry> <emphasis> ASCII first character</emphasis></entry> 2667 </row> 2668 2669 <row> 2670 <entry> <userinput>#xFF</userinput></entry> 2671 <entry> <userinput>#xFE</userinput></entry> 2672 <entry> <userinput>#x00</userinput></entry> 2673 <entry> <userinput>#x00</userinput></entry> 2674 <entry> UTF-32LE</entry> 2675 <entry> <emphasis> Explicit BOM</emphasis></entry> 2676 </row> 2677 2678 <row> 2679 <entry> <emphasis>any</emphasis></entry> 2680 <entry> <userinput>#x00</userinput></entry> 2681 <entry> <userinput>#x00</userinput></entry> 2682 <entry> <userinput>#x00</userinput></entry> 2683 <entry> UTF-32LE</entry> 2684 <entry> <emphasis> ASCII first character</emphasis></entry> 2685 </row> 2686 2687 <row> 2688 <entry> <userinput>#xFE</userinput></entry> 2689 <entry> <userinput>#xFF</userinput></entry> 2690 <entry></entry> 2691 <entry></entry> 2692 <entry> UTF-16BE</entry> 2693 <entry> <emphasis> Explicit BOM</emphasis></entry> 2694 </row> 2695 2696 <row> 2697 <entry> <userinput>#x00</userinput></entry> 2698 <entry> <emphasis>any</emphasis></entry> 2699 <entry></entry> 2700 <entry></entry> 2701 <entry> UTF-16BE</entry> 2702 <entry> <emphasis> ASCII first character</emphasis></entry> 2703 </row> 2704 2705 <row> 2706 <entry> <userinput>#xFF</userinput></entry> 2707 <entry> <userinput>#xFE</userinput></entry> 2708 <entry></entry> 2709 <entry></entry> 2710 <entry> UTF-16LE</entry> 2711 <entry> <emphasis> Explicit BOM</emphasis></entry> 2712 </row> 2713 2714 <row> 2715 <entry> <emphasis>any</emphasis></entry> 2716 <entry> <userinput>#x00</userinput></entry> 2717 <entry></entry> 2718 <entry></entry> 2719 <entry> UTF-16LE</entry> 2720 <entry> <emphasis> ASCII first character</emphasis></entry> 2721 </row> 2722 2723 <row> 2724 <entry> <userinput>#xEF</userinput></entry> 2725 <entry> <userinput>#xBB</userinput></entry> 2726 <entry> <userinput>#xBF</userinput></entry> 2727 <entry></entry> 2728 <entry> UTF-8</entry> 2729 <entry> <emphasis> Explicit BOM</emphasis></entry> 2730 </row> 2731 2732 <row> 2733 <entry></entry> 2734 <entry></entry> 2735 <entry></entry> 2736 <entry></entry> 2737 <entry> UTF-8</entry> 2738 <entry> <emphasis> Default</emphasis></entry> 2739 </row> 2740 </tbody> 2741 </tgroup> 2742 </informaltable> 2743 </keep-together> 2744 2598 2745 <para> 2599 On input, a YAML <refterm primary="processor">processor</refterm> 2600 must support the UTF-8 and UTF-16 character encodings. If a character 2601 <refterm primary="stream">stream</refterm> does not begin with a 2602 <defterm primary="byte order mark">byte order mark</defterm> 2603 (<userinput>#FEFF</userinput>), the character encoding will be taken 2604 to be UTF-8. Otherwise it shall be either UTF-8, UTF-16 LE, or UTF-16 2605 BE as indicated by the byte order mark. 2746 The recommended output encoding is UTF-8. If another encoding is 2747 used, it is recommended that an explicit byte order mark be used, 2748 even if the first <refterm primary="stream">stream</refterm> 2749 character is ASCII. 2606 2750 </para> 2607 2751 2752 <keep-together> 2608 2753 <para> 2609 On output, it is recommended that a byte order mark should only be 2610 emitted for UTF-16 character encodings. 2611 </para> 2612 2613 <para> 2614 Note that the UTF-32 encoding is explicitly not supported. For more 2615 information about the byte order mark and the Unicode character 2616 encoding schemes see the <ulink 2754 For more information about the byte order mark and the Unicode 2755 character encoding schemes see the <ulink 2617 2756 url="http://www.unicode.org/unicode/faq/utf_bom.html">Unicode 2618 2757 FAQ</ulink>. 2619 </para>2620 2621 <para>2622 The character encoding is a <refterm primary="presentation"2623 secondary="detail">presentation detail</refterm> and must not be used2624 to convey <refterm primary="content">content</refterm> information.2625 2758 </para> 2626 2759 … … 2765 2898 </member> 2766 2899 <member> 2767 <programlisting>%YAML 1. 1<sbr/>2900 <programlisting>%YAML 1.2<sbr/> 2768 2901 --- 2769 2902 !!map { … … 2896 3029 </member> 2897 3030 <member> 2898 <programlisting>%YAML 1. 1<sbr/>3031 <programlisting>%YAML 1.2<sbr/> 2899 3032 --- 2900 3033 !!map { … … 2950 3083 </example> 2951 3084 3085 <pagebreak/> 3086 2952 3087 <simplelist type="horiz" columns="2"> 2953 3088 <member> … … 3010 3145 primary="tag" secondary="local">local tags</refterm>; and as the 3011 3146 <refterm primary="tag" secondary="non-specific">non-specific 3012 tag</refterm> for <refterm primary="collection">collections</refterm> 3013 and non-<refterm primary="style" secondary="flow" 3147 tag</refterm> for non-<refterm primary="style" secondary="flow" 3014 3148 tertiary="plain">plain</refterm> scalars. 3015 3149 </member> … … 3029 3163 </member> 3030 3164 <member> 3031 <programlisting>%YAML 1. 1<sbr/>3165 <programlisting>%YAML 1.2<sbr/> 3032 3166 --- 3033 3167 !!map { … … 3097 3231 </member> 3098 3232 <member> 3099 <programlisting>%YAML 1. 1<sbr/>3233 <programlisting>%YAML 1.2<sbr/> 3100 3234 --- 3101 3235 !!map { … … 3164 3298 </member> 3165 3299 <member> 3166 <programlisting>%YAML 1. 1<sbr/>3300 <programlisting>%YAML 1.2<sbr/> 3167 3301 --- 3168 3302 !!map { … … 3177 3311 </example> 3178 3312 3313 <pagebreak/> 3314 3179 3315 <simplelist type="horiz" columns="2"> 3180 3316 <member> … … 3201 3337 <simplelist type="horiz" columns="2"> 3202 3338 <member> 3203 <programlisting><hl1>%</hl1>YAML 1. 1<sbr/>3339 <programlisting><hl1>%</hl1>YAML 1.2<sbr/> 3204 3340 --- text 3205 3341 </programlisting> … … 3209 3345 </member> 3210 3346 <member> 3211 <programlisting>%YAML 1. 1<sbr/>3347 <programlisting>%YAML 1.2<sbr/> 3212 3348 --- 3213 3349 !!str "text" … … 3305 3441 </productionset> 3306 3442 </keep-together> 3443 3444 <keep-together> 3445 <para> 3446 The <refterm primary="[ start flow 3447 sequence"><uquote>[</uquote></refterm>, <refterm primary="] end flow 3448 sequence"><uquote>]</uquote></refterm>, <refterm primary="{ start 3449 flow mapping"><uquote>{</uquote></refterm>, <refterm primary="} end
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)