root/trunk/spec/refcard.txt

Revision 7, 2.5 KB (checked in by oren, 8 months ago)

April 06, 2008 draft.

Implemented by YamlReference? 0.9.

Contains new productions, new examples, all the changes collected throughout
the last 3 years, and of course JSON compatibility.

Line 
1%YAML 1.1   # Reference card
2---
3Collection indicators:
4     '? ' : Key indicator.
5     ': ' : Value indicator.
6     '- ' : Nested series entry indicator.
7     ', ' : Separate in-line branch entries.
8     '[]' : Surround in-line series branch.
9     '{}' : Surround in-line keyed branch.
10Scalar indicators:
11    '''' : Surround in-line unescaped scalar ('' escaped ').
12     '"' : Surround in-line escaped scalar (see escape codes below).
13     '|' : Block scalar indicator.
14     '>' : Folded scalar indicator.
15     '-' : Strip chomp modifier ('|-' or '>-').
16     '+' : Keep chomp modifier ('|+' or '>+').
17     1-9 : Explicit indentation modifier ('|1' or '>2').
18         # Modifiers can be combined ('|2-', '>+1').
19Alias indicators:
20     '&' : Anchor property.
21     '*' : Alias indicator.
22Tag property: # Usually unspecified.
23    none : Unspecified tag (automatically resolved by application).
24   '!'   : Non-specific tag (by default, "!!map"/"!!seq"/"!!str").
25   '!foo': Primary (by convention, means a local "!foo" tag).
26  '!!foo': Secondary (by convention, means "tag:yaml.org,2002:foo").
27 '!h!foo': Requires "%TAG !h! <prefix>" (and then means "<prefix>foo").
28 '!<foo>': Verbatim tag (always means "foo").
29Document indicators:
30    '%'  : Directive indicator.
31   '---' : Document header.
32   '...' : Document terminator.
33Misc indicators:
34     '#' : Throwaway comment indicator.
35    '`@' : Both reserved for future use.
36Special keys:
37     '=' : Default "value" mapping key.
38    '<<' : Merge keys from another mapping.
39Core types: # Default automatic tags.
40    '!!map' : [ Hash table, dictionary, mapping ]
41    '!!seq' : [ List, array, tuple, vector, sequence ]
42    '!!str' : Unicode string
43More types:
44    '!!set' : { cherries, plums, apples }
45   '!!omap' : [ one: 1, two: 2 ]
46Language Independent Scalar types:
47    { ~, null }               : Null (no value).
48    { 1234, 0x4D2, 02333 }    : [ Decimal int, Hexadecimal int, Octal int ]
49    { 1_230.15, 12.3015e+02 } : [ Fixed float, Exponential float ]
50    { .inf, -.Inf, .NAN }     : [ Infinity (float), Negative, Not a number ]
51    { Y, true, Yes, ON  }     : Boolean true
52    { n, FALSE, No, off }     : Boolean false
53    ? !!binary >
54        R0lG...BADS=
55    : >-
56        Base 64 binary value.
57Escape codes:
58 Numeric   : { "\xXX": 8-bit, "\uXXXX": 16-bit, "\UXXXXXXXX": 32-bit }
59 Protective: { "\\": '\', "\"": '"', "\ ": ' ', "\<TAB>": "<TAB>", "\^": '^' }
60 C: { "\a": BEL, "\b": BS, "\f": FF, "\n": LF, "\r": CR, "\t": TAB, "\v": VTAB }
61 Additional: { "\e": ESC, "\0": NUL, "\_": NBSP, "\N": NEL, "\L": LS, "\P": PS }
62...
Note: See TracBrowser for help on using the browser.