| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701 | --- %YAML:1.0test: Sequence of scalarsspec: 2.1yaml: |  - Mark McGwire  - Sammy Sosa  - Ken Griffeyphp: |  ['Mark McGwire', 'Sammy Sosa', 'Ken Griffey']---test: Mapping of scalars to scalarsspec: 2.2yaml: |  hr:  65  avg: 0.278  rbi: 147php: |  ['hr' => 65, 'avg' => 0.278, 'rbi' => 147]---test: Mapping of scalars to sequencesspec: 2.3yaml: |    american:       - Boston Red Sox       - Detroit Tigers       - New York Yankees    national:       - New York Mets       - Chicago Cubs       - Atlanta Bravesphp: |    ['american' =>        ['Boston Red Sox', 'Detroit Tigers',          'New York Yankees'],      'national' =>        ['New York Mets', 'Chicago Cubs',          'Atlanta Braves']    ]---test: Sequence of mappingsspec: 2.4yaml: |    -      name: Mark McGwire      hr:   65      avg:  0.278    -      name: Sammy Sosa      hr:   63      avg:  0.288php: |    [      ['name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278],      ['name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288]    ]---test: Legacy A5todo: truespec: legacy_A5yaml: |    ?        - New York Yankees        - Atlanta Braves    :      - 2001-07-02      - 2001-08-12      - 2001-08-14    ?        - Detroit Tigers        - Chicago Cubs    :      - 2001-07-23perl-busted: >    YAML.pm will be able to emulate this behavior soon. In this regard    it may be somewhat more correct than Python's native behavior which    can only use tuples as mapping keys. PyYAML will also need to figure    out some clever way to roundtrip structured keys.python: |    [    {        ('New York Yankees', 'Atlanta Braves'):            [yaml.timestamp('2001-07-02'),             yaml.timestamp('2001-08-12'),             yaml.timestamp('2001-08-14')],        ('Detroit Tigers', 'Chicago Cubs'):        [yaml.timestamp('2001-07-23')]    }    ]ruby: |    {      [ 'New York Yankees', 'Atlanta Braves' ] =>        [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ],      [ 'Detroit Tigers', 'Chicago Cubs' ] =>        [ Date.new( 2001, 7, 23 ) ]    }syck: |  struct test_node seq1[] = {      { T_STR, 0, "New York Yankees" },      { T_STR, 0, "Atlanta Braves" },      end_node  };  struct test_node seq2[] = {      { T_STR, 0, "2001-07-02" },      { T_STR, 0, "2001-08-12" },      { T_STR, 0, "2001-08-14" },      end_node  };  struct test_node seq3[] = {      { T_STR, 0, "Detroit Tigers" },      { T_STR, 0, "Chicago Cubs" },      end_node  };  struct test_node seq4[] = {      { T_STR, 0, "2001-07-23" },      end_node  };  struct test_node map[] = {      { T_SEQ, 0, 0, seq1 },      { T_SEQ, 0, 0, seq2 },      { T_SEQ, 0, 0, seq3 },      { T_SEQ, 0, 0, seq4 },      end_node  };  struct test_node stream[] = {      { T_MAP, 0, 0, map },      end_node  };---test: Sequence of sequencesspec: 2.5yaml: |  - [ name         , hr , avg   ]  - [ Mark McGwire , 65 , 0.278 ]  - [ Sammy Sosa   , 63 , 0.288 ]php: |  [    [ 'name', 'hr', 'avg' ],    [ 'Mark McGwire', 65, 0.278 ],    [ 'Sammy Sosa', 63, 0.288 ]  ]---test: Mapping of mappingstodo: truespec: 2.6yaml: |  Mark McGwire: {hr: 65, avg: 0.278}  Sammy Sosa: {      hr: 63,      avg: 0.288    }php: |  [    'Mark McGwire' =>      [ 'hr' => 65, 'avg' => 0.278 ],    'Sammy Sosa' =>      [ 'hr' => 63, 'avg' => 0.288 ]  ]---test: Two documents in a stream each with a leading commenttodo: truespec: 2.7yaml: |  # Ranking of 1998 home runs  ---  - Mark McGwire  - Sammy Sosa  - Ken Griffey  # Team ranking  ---  - Chicago Cubs  - St Louis Cardinalsruby: |  y = YAML::Stream.new  y.add( [ 'Mark McGwire', 'Sammy Sosa', 'Ken Griffey' ] )  y.add( [ 'Chicago Cubs', 'St Louis Cardinals' ] )documents: 2---test: Play by play feed from a gametodo: truespec: 2.8yaml: |  ---  time: 20:03:20  player: Sammy Sosa  action: strike (miss)  ...  ---  time: 20:03:47  player: Sammy Sosa  action: grand slam  ...perl: |  [ 'Mark McGwire', 'Sammy Sosa', 'Ken Griffey' ]documents: 2---test: Single document with two commentsspec: 2.9yaml: |  hr: # 1998 hr ranking    - Mark McGwire    - Sammy Sosa  rbi:    # 1998 rbi ranking    - Sammy Sosa    - Ken Griffeyphp: |  [    'hr' => [ 'Mark McGwire', 'Sammy Sosa' ],    'rbi' => [ 'Sammy Sosa', 'Ken Griffey' ]  ]---test: Node for Sammy Sosa appears twice in this documentspec: 2.10yaml: |   ---   hr:      - Mark McGwire      # Following node labeled SS      - &SS Sammy Sosa   rbi:      - *SS # Subsequent occurrence      - Ken Griffeyphp: |   [      'hr' =>         ['Mark McGwire', 'Sammy Sosa'],      'rbi' =>         ['Sammy Sosa', 'Ken Griffey']   ]---test: Mapping between sequencestodo: truespec: 2.11yaml: |   ? # PLAY SCHEDULE     - Detroit Tigers     - Chicago Cubs   :     - 2001-07-23   ? [ New York Yankees,       Atlanta Braves ]   : [ 2001-07-02, 2001-08-12,       2001-08-14 ]ruby: |   {      [ 'Detroit Tigers', 'Chicago Cubs' ] => [ Date.new( 2001, 7, 23 ) ],      [ 'New York Yankees', 'Atlanta Braves' ] => [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ]   }syck: |  struct test_node seq1[] = {      { T_STR, 0, "New York Yankees" },      { T_STR, 0, "Atlanta Braves" },      end_node  };  struct test_node seq2[] = {      { T_STR, 0, "2001-07-02" },      { T_STR, 0, "2001-08-12" },      { T_STR, 0, "2001-08-14" },      end_node  };  struct test_node seq3[] = {      { T_STR, 0, "Detroit Tigers" },      { T_STR, 0, "Chicago Cubs" },      end_node  };  struct test_node seq4[] = {      { T_STR, 0, "2001-07-23" },      end_node  };  struct test_node map[] = {      { T_SEQ, 0, 0, seq3 },      { T_SEQ, 0, 0, seq4 },      { T_SEQ, 0, 0, seq1 },      { T_SEQ, 0, 0, seq2 },      end_node  };  struct test_node stream[] = {      { T_MAP, 0, 0, map },      end_node  };---test: Sequence key shortcutspec: 2.12yaml: |  ---  # products purchased  - item    : Super Hoop    quantity: 1  - item    : Basketball    quantity: 4  - item    : Big Shoes    quantity: 1php: |  [    [      'item' => 'Super Hoop',      'quantity' => 1,    ],    [      'item' => 'Basketball',      'quantity' => 4,    ],    [      'item' => 'Big Shoes',      'quantity' => 1,    ]  ]perl: |  [     { item => 'Super Hoop', quantity => 1 },     { item => 'Basketball', quantity => 4 },     { item => 'Big Shoes',  quantity => 1 }  ]ruby: |  [     { 'item' => 'Super Hoop', 'quantity' => 1 },     { 'item' => 'Basketball', 'quantity' => 4 },     { 'item' => 'Big Shoes', 'quantity' => 1 }  ]python: |  [       { 'item': 'Super Hoop', 'quantity': 1 },       { 'item': 'Basketball', 'quantity': 4 },       { 'item': 'Big Shoes',  'quantity': 1 }  ]syck: |  struct test_node map1[] = {      { T_STR, 0, "item" },          { T_STR, 0, "Super Hoop" },      { T_STR, 0, "quantity" },          { T_STR, 0, "1" },      end_node  };  struct test_node map2[] = {      { T_STR, 0, "item" },          { T_STR, 0, "Basketball" },      { T_STR, 0, "quantity" },          { T_STR, 0, "4" },      end_node  };  struct test_node map3[] = {      { T_STR, 0, "item" },          { T_STR, 0, "Big Shoes" },      { T_STR, 0, "quantity" },          { T_STR, 0, "1" },      end_node  };  struct test_node seq[] = {      { T_MAP, 0, 0, map1 },      { T_MAP, 0, 0, map2 },      { T_MAP, 0, 0, map3 },      end_node  };  struct test_node stream[] = {      { T_SEQ, 0, 0, seq },      end_node  };---test: Literal perserves newlinestodo: truespec: 2.13yaml: |  # ASCII Art  --- |    \//||\/||    // ||  ||_perl: |  "\\//||\\/||\n// ||  ||_\n"ruby: |  "\\//||\\/||\n// ||  ||_\n"python: |    [        flushLeft(        """        \//||\/||        // ||  ||_        """        )    ]syck: |  struct test_node stream[] = {      { T_STR, 0, "\\//||\\/||\n// ||  ||_\n" },      end_node  };---test: Folded treats newlines as a spacetodo: truespec: 2.14yaml: |  ---    Mark McGwire's    year was crippled    by a knee injury.perl: |  "Mark McGwire's year was crippled by a knee injury."ruby: |  "Mark McGwire's year was crippled by a knee injury."python: |    [ "Mark McGwire's year was crippled by a knee injury." ]syck: |  struct test_node stream[] = {      { T_STR, 0, "Mark McGwire's year was crippled by a knee injury." },      end_node  };---test: Newlines preserved for indented and blank linestodo: truespec: 2.15yaml: |  --- >   Sammy Sosa completed another   fine season with great stats.     63 Home Runs     0.288 Batting Average   What a year!perl: |  "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n"ruby: |  "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n"python: |    [        flushLeft(        """        Sammy Sosa completed another fine season with great stats.          63 Home Runs          0.288 Batting Average        What a year!        """        )    ]syck: |  struct test_node stream[] = {      { T_STR, 0, "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n" },      end_node  };---test: Indentation determines scopespec: 2.16yaml: |  name: Mark McGwire  accomplishment: >     Mark set a major league     home run record in 1998.  stats: |     65 Home Runs     0.278 Batting Averagephp: |  [    'name' => 'Mark McGwire',    'accomplishment' => "Mark set a major league home run record in 1998.\n",    'stats' => "65 Home Runs\n0.278 Batting Average\n"  ]---test: Quoted scalarstodo: truespec: 2.17yaml: |  unicode: "Sosa did fine.\u263A"  control: "\b1998\t1999\t2000\n"  hexesc:  "\x0D\x0A is \r\n"  single: '"Howdy!" he cried.'  quoted: ' # not a ''comment''.'  tie-fighter: '|\-*-/|'ruby: |  {    "tie-fighter" => "|\\-*-/|",    "control"=>"\0101998\t1999\t2000\n",    "unicode"=>"Sosa did fine." + ["263A".hex ].pack('U*'),    "quoted"=>" # not a 'comment'.",    "single"=>"\"Howdy!\" he cried.",    "hexesc"=>"\r\n is \r\n"  }---test: Multiline flow scalarstodo: truespec: 2.18yaml: |  plain:    This unquoted scalar    spans many lines.  quoted: "So does this    quoted scalar.\n"ruby: |  {    'plain' => 'This unquoted scalar spans many lines.',    'quoted' => "So does this quoted scalar.\n"  }---test: Integersspec: 2.19yaml: |  canonical: 12345  octal: 014  hexadecimal: 0xCphp: |  [    'canonical' => 12345,    'octal' => 014,    'hexadecimal' => 0xC  ]---test: Decimal Integerdeprecated: truespec: 2.19yaml: |  decimal: +12,345php: |  [    'decimal' => 12345.0,  ]---# FIX: spec shows parens around -inf and NaNtest: Floating pointspec: 2.20yaml: |  canonical: 1.23015e+3  exponential: 12.3015e+02  negative infinity: -.inf  not a number: .NaN  float as whole number: !!float 1php: |  [    'canonical' => 1230.15,    'exponential' => 1230.15,    'negative infinity' => log(0),    'not a number' => -log(0),    'float as whole number' => (float) 1  ]---test: Fixed Floating pointdeprecated: truespec: 2.20yaml: |  fixed: 1,230.15php: |  [    'fixed' => 1230.15,  ]---test: Timestampstodo: truespec: 2.22yaml: |  canonical: 2001-12-15T02:59:43.1Z  iso8601:  2001-12-14t21:59:43.10-05:00  spaced:  2001-12-14 21:59:43.10 -05:00  date:   2002-12-14 # Time is noon UTCphp: |  [    'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),    'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),    'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),    'date' => Date.new( 2002, 12, 14 )  ]---test: legacy Timestamps testtodo: truespec: legacy D4yaml: |    canonical: 2001-12-15T02:59:43.00Z    iso8601:  2001-02-28t21:59:43.00-05:00    spaced:  2001-12-14 21:59:43.00 -05:00    date:   2002-12-14php: |   [     'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ),     'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ),     'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ),     'date' => Date.new( 2002, 12, 14 )   ]---test: Various explicit familiestodo: truespec: 2.23yaml: |  not-date: !!str 2002-04-28  picture: !binary |   R0lGODlhDAAMAIQAAP//9/X   17unp5WZmZgAAAOfn515eXv   Pz7Y6OjuDg4J+fn5OTk6enp   56enmleECcgggoBADs=  application specific tag: !!something |   The semantics of the tag   above may be different for   different documents.ruby-setup: |  YAML.add_private_type( "something" ) do |type, val|    "SOMETHING: #{val}"  endruby: |  {    'not-date' => '2002-04-28',    'picture' => "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236i^\020' \202\n\001\000;",    'application specific tag' => "SOMETHING: The semantics of the tag\nabove may be different for\ndifferent documents.\n"  }---test: Application specific familytodo: truespec: 2.24yaml: |  # Establish a tag prefix  --- !clarkevans.com,2002/graph/^shape    # Use the prefix: shorthand for    # !clarkevans.com,2002/graph/circle  - !^circle    center: &ORIGIN {x: 73, 'y': 129}    radius: 7  - !^line # !clarkevans.com,2002/graph/line    start: *ORIGIN    finish: { x: 89, 'y': 102 }  - !^label    start: *ORIGIN    color: 0xFFEEBB    value: Pretty vector drawing.ruby-setup: |  YAML.add_domain_type( "clarkevans.com,2002", 'graph/shape' ) { |type, val|    if Array === val      val << "Shape Container"      val    else      raise YAML::Error, "Invalid graph of class #{ val.class }: " + val.inspect    end  }  one_shape_proc = Proc.new { |type, val|    scheme, domain, type = type.split( /:/, 3 )    if val.is_a? ::Hash      val['TYPE'] = "Shape: #{type}"      val    else      raise YAML::Error, "Invalid graph of class #{ val.class }: " + val.inspect    end  }  YAML.add_domain_type( "clarkevans.com,2002", 'graph/circle', &one_shape_proc )  YAML.add_domain_type( "clarkevans.com,2002", 'graph/line', &one_shape_proc )  YAML.add_domain_type( "clarkevans.com,2002", 'graph/label', &one_shape_proc )ruby: |  [    {      "radius" => 7,      "center"=>      {        "x" => 73,        "y" => 129      },      "TYPE" => "Shape: graph/circle"    }, {      "finish" =>      {        "x" => 89,        "y" => 102      },      "TYPE" => "Shape: graph/line",      "start" =>      {        "x" => 73,        "y" => 129      }    }, {      "TYPE" => "Shape: graph/label",      "value" => "Pretty vector drawing.",      "start" =>      {        "x" => 73,        "y" => 129      },      "color" => 16772795    },    "Shape Container"  ]# ---# test: Unordered set# spec: 2.25# yaml: |#   # sets are represented as a#   # mapping where each key is#   # associated with the empty string#   --- !set#   ? Mark McGwire#   ? Sammy Sosa#   ? Ken Griff---test: Ordered mappingstodo: truespec: 2.26yaml: |  # ordered maps are represented as  # a sequence of mappings, with  # each mapping having one key  --- !omap  - Mark McGwire: 65  - Sammy Sosa: 63  - Ken Griffy: 58ruby: |  YAML::Omap[    'Mark McGwire', 65,    'Sammy Sosa', 63,    'Ken Griffy', 58  ]---test: Invoicedump_skip: truespec: 2.27yaml: |  --- !clarkevans.com,2002/^invoice  invoice: 34843  date   : 2001-01-23  bill-to: &id001      given  : Chris      family : Dumars      address:          lines: |              458 Walkman Dr.              Suite #292          city    : Royal Oak          state   : MI          postal  : 48046  ship-to: *id001  product:      -        sku         : BL394D        quantity    : 4        description : Basketball        price       : 450.00      -        sku         : BL4438H        quantity    : 1        description : Super Hoop        price       : 2392.00  tax  : 251.42  total: 4443.52  comments: >    Late afternoon is best.    Backup contact is Nancy    Billsmer @ 338-4338.php: |  [     'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),     'bill-to' =>      [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ]     , 'ship-to' =>      [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ]     , 'product' =>       [        [ 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ],        [ 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 ]       ],     'tax' => 251.42, 'total' => 4443.52,     'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n"  ]---test: Log filetodo: truespec: 2.28yaml: |  ---  Time: 2001-11-23 15:01:42 -05:00  User: ed  Warning: >    This is an error message    for the log file  ---  Time: 2001-11-23 15:02:31 -05:00  User: ed  Warning: >    A slightly different error    message.  ---  Date: 2001-11-23 15:03:17 -05:00  User: ed  Fatal: >    Unknown variable "bar"  Stack:    - file: TopClass.py      line: 23      code: |        x = MoreObject("345\n")    - file: MoreClass.py      line: 58      code: |-        foo = barruby: |  y = YAML::Stream.new  y.add( { 'Time' => YAML::mktime( 2001, 11, 23, 15, 01, 42, 00, "-05:00" ),           'User' => 'ed', 'Warning' => "This is an error message for the log file\n" } )  y.add( { 'Time' => YAML::mktime( 2001, 11, 23, 15, 02, 31, 00, "-05:00" ),           'User' => 'ed', 'Warning' => "A slightly different error message.\n" } )  y.add( { 'Date' => YAML::mktime( 2001, 11, 23, 15, 03, 17, 00, "-05:00" ),           'User' => 'ed', 'Fatal' => "Unknown variable \"bar\"\n",           'Stack' => [           { 'file' => 'TopClass.py', 'line' => 23, 'code' => "x = MoreObject(\"345\\n\")\n" },           { 'file' => 'MoreClass.py', 'line' => 58, 'code' => "foo = bar" } ] } )documents: 3---test: Throwaway commentsyaml: |   ### These are four throwaway comment  ###   ### lines (the second line is empty). ###   this: |   # Comments may trail lines.      contains three lines of text.      The third one starts with a      # character. This isn't a comment.   # These are three throwaway comment   # lines (the first line is empty).php: |   [     'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n"   ]---test: Document with a single valuetodo: trueyaml: |   --- >   This YAML stream contains a single text value.   The next stream is a log file - a sequence of   log entries. Adding an entry to the log is a   simple matter of appending it at the end.ruby: |   "This YAML stream contains a single text value. The next stream is a log file - a sequence of log entries. Adding an entry to the log is a simple matter of appending it at the end.\n"---test: Document streamtodo: trueyaml: |   ---   at: 2001-08-12 09:25:00.00 Z   type: GET   HTTP: '1.0'   url: '/index.html'   ---   at: 2001-08-12 09:25:10.00 Z   type: GET   HTTP: '1.0'   url: '/toc.html'ruby: |   y = YAML::Stream.new   y.add( {      'at' => Time::utc( 2001, 8, 12, 9, 25, 00 ),      'type' => 'GET',      'HTTP' => '1.0',      'url' => '/index.html'   } )   y.add( {      'at' => Time::utc( 2001, 8, 12, 9, 25, 10 ),      'type' => 'GET',      'HTTP' => '1.0',      'url' => '/toc.html'   } )documents: 2---test: Top level mappingyaml: |   # This stream is an example of a top-level mapping.   invoice : 34843   date    : 2001-01-23   total   : 4443.52php: |   [      'invoice' => 34843,      'date' => gmmktime(0, 0, 0, 1, 23, 2001),      'total' => 4443.52   ]---test: Single-line documentstodo: trueyaml: |  # The following is a sequence of three documents.  # The first contains an empty mapping, the second  # an empty sequence, and the last an empty string.  --- {}  --- [ ]  --- ''ruby: |  y = YAML::Stream.new  y.add( {} )  y.add( [] )  y.add( '' )documents: 3---test: Document with pausetodo: trueyaml: |  # A communication channel based on a YAML stream.  ---  sent at: 2002-06-06 11:46:25.10 Z  payload: Whatever  # Receiver can process this as soon as the following is sent:  ...  # Even if the next message is sent long after:  ---  sent at: 2002-06-06 12:05:53.47 Z  payload: Whatever  ...ruby: |  y = YAML::Stream.new  y.add(    { 'sent at' => YAML::mktime( 2002, 6, 6, 11, 46, 25, 0.10 ),      'payload' => 'Whatever' }  )  y.add(    { "payload" => "Whatever", "sent at" => YAML::mktime( 2002, 6, 6, 12, 5, 53, 0.47 ) }  )documents: 2---test: Explicit typingdeprecated: Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0.yaml: |   integer: 12   also int: ! "12"   string: !!str 12php: |   [ 'integer' => 12, 'also int' => 12, 'string' => '12' ]---test: Private typestodo: trueyaml: |  # Both examples below make use of the 'x-private:ball'  # type family URI, but with different semantics.  ---  pool: !!ball    number: 8    color: black  ---  bearing: !!ball    material: steelruby: |  y = YAML::Stream.new  y.add( { 'pool' =>    YAML::PrivateType.new( 'ball',      { 'number' => 8, 'color' => 'black' } ) }  )  y.add( { 'bearing' =>    YAML::PrivateType.new( 'ball',      { 'material' => 'steel' } ) }  )documents: 2---test: Type family under yaml.orgyaml: |  # The URI is 'tag:yaml.org,2002:str'  - !!str a Unicode stringphp: |  [ 'a Unicode string' ]---test: Type family under perl.yaml.orgtodo: trueyaml: |  # The URI is 'tag:perl.yaml.org,2002:Text::Tabs'  - !perl/Text::Tabs {}ruby: |  [ YAML::DomainType.new( 'perl.yaml.org,2002', 'Text::Tabs', {} ) ]---test: Type family under clarkevans.comtodo: trueyaml: |  # The URI is 'tag:clarkevans.com,2003-02:timesheet'  - !clarkevans.com,2003-02/timesheet {}ruby: |  [ YAML::DomainType.new( 'clarkevans.com,2003-02', 'timesheet', {} ) ]---test: URI Escapingtodo: trueyaml: |  same:    - !domain.tld,2002/type\x30 value    - !domain.tld,2002/type0 value  different: # As far as the YAML parser is concerned    - !domain.tld,2002/type%30 value    - !domain.tld,2002/type0 valueruby-setup: |  YAML.add_domain_type( "domain.tld,2002", "type0" ) { |type, val|    "ONE: #{val}"  }  YAML.add_domain_type( "domain.tld,2002", "type%30" ) { |type, val|    "TWO: #{val}"  }ruby: |  { 'same' => [ 'ONE: value', 'ONE: value' ], 'different' => [ 'TWO: value', 'ONE: value' ] }---test: URI Prefixingtodo: trueyaml: |  # 'tag:domain.tld,2002:invoice' is some type family.  invoice: !domain.tld,2002/^invoice    # 'seq' is shorthand for 'tag:yaml.org,2002:seq'.    # This does not effect '^customer' below    # because it is does not specify a prefix.    customers: !seq      # '^customer' is shorthand for the full      # notation 'tag:domain.tld,2002:customer'.      - !^customer        given : Chris        family : Dumarsruby-setup: |  YAML.add_domain_type( "domain.tld,2002", /(invoice|customer)/ ) { |type, val|    if val.is_a? ::Hash      scheme, domain, type = type.split( /:/, 3 )      val['type'] = "domain #{type}"      val    else      raise YAML::Error, "Not a Hash in domain.tld/invoice: " + val.inspect    end  }ruby: |  { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }---test: Overriding anchorsyaml: |  anchor : &A001 This scalar has an anchor.  override : &A001 >   The alias node below is a   repeated use of this value.  alias : *A001php: |  [ 'anchor' => 'This scalar has an anchor.',    'override' => "The alias node below is a repeated use of this value.\n",    'alias' => "The alias node below is a repeated use of this value.\n"]---test: Flow and block formattingtodo: trueyaml: |  empty: []  flow: [ one, two, three # May span lines,           , four,           # indentation is             five ]          # mostly ignored.  block:   - First item in top sequence   -    - Subordinate sequence entry   - >     A folded sequence entry   - Sixth item in top sequenceruby: |  { 'empty' => [], 'flow' => [ 'one', 'two', 'three', 'four', 'five' ],    'block' => [ 'First item in top sequence', [ 'Subordinate sequence entry' ],    "A folded sequence entry\n", 'Sixth item in top sequence' ] }---test: Complete mapping testtodo: trueyaml: | empty: {} flow: { one: 1, two: 2 } spanning: { one: 1,    two: 2 } block:  first : First entry  second:   key: Subordinate mapping  third:   - Subordinate sequence   - { }   - Previous mapping is empty.   - A key: value pair in a sequence.     A second: key:value pair.   - The previous entry is equal to the following one.   -     A key: value pair in a sequence.     A second: key:value pair.  !float 12 : This key is a float.  ? >   ?  : This key had to be protected.  "\a" : This key had to be escaped.  ? >   This is a   multi-line   folded key  : Whose value is    also multi-line.  ? this also works as a key  : with a value at the next line.  ?   - This key   - is a sequence  :   - With a sequence value.  ?   This: key   is a: mapping  :   with a: mapping value.ruby: |  { 'empty' => {}, 'flow' => { 'one' => 1, 'two' => 2 },    'spanning' => { 'one' => 1, 'two' => 2 },    'block' => { 'first' => 'First entry', 'second' =>    { 'key' => 'Subordinate mapping' }, 'third' =>      [ 'Subordinate sequence', {}, 'Previous mapping is empty.',        { 'A key' => 'value pair in a sequence.', 'A second' => 'key:value pair.' },        'The previous entry is equal to the following one.',        { 'A key' => 'value pair in a sequence.', 'A second' => 'key:value pair.' } ],    12.0 => 'This key is a float.', "?\n" => 'This key had to be protected.',    "\a" => 'This key had to be escaped.',    "This is a multi-line folded key\n" => "Whose value is also multi-line.",    'this also works as a key' => 'with a value at the next line.',    [ 'This key', 'is a sequence' ] => [ 'With a sequence value.' ] } }  # Couldn't recreate map exactly, so we'll do a detailed check to be sure it's entact  obj_y['block'].keys.each { |k|    if Hash === k      v = obj_y['block'][k]      if k['This'] == 'key' and k['is a'] == 'mapping' and v['with a'] == 'mapping value.'         obj_r['block'][k] = v      end    end  }---test: Literal explicit indentationyaml: |   # Explicit indentation must   # be given in all the three   # following cases.   leading spaces: |2         This value starts with four spaces.   leading line break: |2     This value starts with a line break.   leading comment indicator: |2     # first line starts with a     # character.   # Explicit indentation may   # also be given when it is   # not required.   redundant: |2     This value is indented 2 spaces.php: |   [      'leading spaces' => "    This value starts with four spaces.\n",      'leading line break' => "\nThis value starts with a line break.\n",      'leading comment indicator' => "# first line starts with a\n# character.\n",      'redundant' => "This value is indented 2 spaces.\n"   ]---test: Chomping and keep modifiersyaml: |    clipped: |        This has one newline.    same as "clipped" above: "This has one newline.\n"    stripped: |-        This has no newline.    same as "stripped" above: "This has no newline."    kept: |+        This has two newlines.    same as "kept" above: "This has two newlines.\n\n"php: |    [      'clipped' => "This has one newline.\n",      'same as "clipped" above' => "This has one newline.\n",      'stripped' => 'This has no newline.',      'same as "stripped" above' => 'This has no newline.',      'kept' => "This has two newlines.\n\n",      'same as "kept" above' => "This has two newlines.\n\n"    ]---test: Literal combinationstodo: trueyaml: |   empty: |   literal: |    The \ ' " characters may be    freely used. Leading white       space is significant.    Line breaks are significant.    Thus this value contains one    empty line and ends with a    single line break, but does    not start with one.   is equal to: "The \\ ' \" characters may \    be\nfreely used. Leading white\n   space \    is significant.\n\nLine breaks are \    significant.\nThus this value contains \    one\nempty line and ends with a\nsingle \    line break, but does\nnot start with one.\n"   # Comments may follow a block   # scalar value. They must be   # less indented.   # Modifiers may be combined in any order.   indented and chomped: |2-       This has no newline.   also written as: |-2       This has no newline.   both are equal to: "  This has no newline."php: |   [     'empty' => '',     'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n   space " +       "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +       "empty line and ends with a\nsingle line break, but does\nnot start with one.\n",     'is equal to' => "The \\ ' \" characters may be\nfreely used. Leading white\n   space " +       "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +       "empty line and ends with a\nsingle line break, but does\nnot start with one.\n",     'indented and chomped' => '  This has no newline.',     'also written as' => '  This has no newline.',     'both are equal to' => '  This has no newline.'   [---test: Folded combinationstodo: trueyaml: |   empty: >   one paragraph: >    Line feeds are converted    to spaces, so this value    contains no line breaks    except for the final one.   multiple paragraphs: >2     An empty line, either     at the start or in     the value:     Is interpreted as a     line break. Thus this     value contains three     line breaks.   indented text: >       This is a folded       paragraph followed       by a list:        * first entry        * second entry       Followed by another       folded paragraph,       another list:        * first entry        * second entry       And a final folded       paragraph.   above is equal to: |       This is a folded paragraph followed by a list:        * first entry        * second entry       Followed by another folded paragraph, another list:        * first entry        * second entry       And a final folded paragraph.   # Explicit comments may follow   # but must be less indented.php: |   [     'empty' => '',     'one paragraph' => 'Line feeds are converted to spaces, so this value'.       " contains no line breaks except for the final one.\n",     'multiple paragraphs' => "\nAn empty line, either at the start or in the value:\n".       "Is interpreted as a line break. Thus this value contains three line breaks.\n",     'indented text' => "This is a folded paragraph followed by a list:\n".       " * first entry\n * second entry\nFollowed by another folded paragraph, ".       "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n",     'above is equal to' => "This is a folded paragraph followed by a list:\n".       " * first entry\n * second entry\nFollowed by another folded paragraph, ".       "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n"   ]---test: Single quotestodo: trueyaml: |   empty: ''   second: '! : \ etc. can be used freely.'   third: 'a single quote '' must be escaped.'   span: 'this contains         six spaces         and one         line break'   is same as: "this contains six spaces\nand one line break"php: |   [     'empty' => '',     'second' => '! : \\ etc. can be used freely.',     'third' => "a single quote ' must be escaped.",     'span' => "this contains six spaces\nand one line break",     'is same as' => "this contains six spaces\nand one line break"   ]---test: Double quotestodo: trueyaml: |   empty: ""   second: "! : etc. can be used freely."   third: "a \" or a \\ must be escaped."   fourth: "this value ends with an LF.\n"   span: "this contains     four  \         spaces"   is equal to: "this contains four  spaces"php: |   [     'empty' => '',     'second' => '! : etc. can be used freely.',     'third' => 'a " or a \\ must be escaped.',     'fourth' => "this value ends with an LF.\n",     'span' => "this contains four  spaces",     'is equal to' => "this contains four  spaces"   ]---test: Unquoted stringstodo: trueyaml: |   first: There is no unquoted empty string.   second: 12          ## This is an integer.   third: !!str 12      ## This is a string.   span: this contains         six spaces         and one         line break   indicators: this has no comments.               #:foo and bar# are               both text.   flow: [ can span              lines, # comment              like              this ]   note: { one-line keys: but multi-line values }php: |   [     'first' => 'There is no unquoted empty string.',     'second' => 12,     'third' => '12',     'span' => "this contains six spaces\nand one line break",     'indicators' => "this has no comments. #:foo and bar# are both text.",     'flow' => [ 'can span lines', 'like this' ],     'note' => { 'one-line keys' => 'but multi-line values' }   ]---test: Spanning sequencestodo: trueyaml: |   # The following are equal seqs   # with different identities.   flow: [ one, two ]   spanning: [ one,        two ]   block:     - one     - twophp: |   [     'flow' => [ 'one', 'two' ],     'spanning' => [ 'one', 'two' ],     'block' => [ 'one', 'two' ]   ]---test: Flow mappingsyaml: |   # The following are equal maps   # with different identities.   flow: { one: 1, two: 2 }   block:       one: 1       two: 2php: |   [     'flow' => [ 'one' => 1, 'two' => 2 ],     'block' => [ 'one' => 1, 'two' => 2 ]   ]---test: Representations of 12todo: trueyaml: |   - 12 # An integer   # The following scalars   # are loaded to the   # string value '1' '2'.   - !!str 12   - '12'   - "12"   - "\     1\     2\     "   # Strings containing paths and regexps can be unquoted:   - /foo/bar   - d:/foo/bar   - foo/bar   - /a.*b/php: |   [ 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' ]---test: "Null"todo: trueyaml: |   canonical: ~   english: null   # This sequence has five   # entries, two with values.   sparse:     - ~     - 2nd entry     - Null     - 4th entry     -   four: This mapping has five keys,         only two with values.php: |   [     'canonical' => null,     'english' => null,     'sparse' => [ null, '2nd entry', null, '4th entry', null ]],     'four' => 'This mapping has five keys, only two with values.'   ]---test: Omaptodo: trueyaml: |   # Explicitly typed dictionary.   Bestiary: !omap     - aardvark: African pig-like ant eater. Ugly.     - anteater: South-American ant eater. Two species.     - anaconda: South-American constrictor snake. Scary.     # Etc.ruby: |   {     'Bestiary' => YAML::Omap[       'aardvark', 'African pig-like ant eater. Ugly.',       'anteater', 'South-American ant eater. Two species.',       'anaconda', 'South-American constrictor snake. Scary.'     ]   }---test: Pairstodo: trueyaml: |  # Explicitly typed pairs.  tasks: !pairs    - meeting: with team.    - meeting: with boss.    - break: lunch.    - meeting: with client.ruby: |  {    'tasks' => YAML::Pairs[      'meeting', 'with team.',      'meeting', 'with boss.',      'break', 'lunch.',      'meeting', 'with client.'    ]  }---test: Settodo: trueyaml: |  # Explicitly typed set.  baseball players: !set    Mark McGwire:    Sammy Sosa:    Ken Griffey:ruby: |  {    'baseball players' => YAML::Set[      'Mark McGwire', nil,      'Sammy Sosa', nil,      'Ken Griffey', nil    ]  }---test: Integeryaml: |   canonical: 12345   octal: 014   hexadecimal: 0xCphp: |   [     'canonical' => 12345,     'octal' => 12,     'hexadecimal' => 12   ]---test: Decimaldeprecated: trueyaml: |   decimal: +12,345php: |   [     'decimal' => 12345.0,   ]---test: Fixed Floatdeprecated: trueyaml: |   fixed: 1,230.15php: |  [    'fixed' => 1230.15,  ]---test: Floatyaml: |   canonical: 1.23015e+3   exponential: 12.3015e+02   negative infinity: -.inf   not a number: .NaNphp: |  [    'canonical' => 1230.15,    'exponential' => 1230.15,    'negative infinity' => log(0),    'not a number' => -log(0)  ]---test: Timestamptodo: trueyaml: |   canonical:       2001-12-15T02:59:43.1Z   valid iso8601:   2001-12-14t21:59:43.10-05:00   space separated: 2001-12-14 21:59:43.10 -05:00   date (noon UTC): 2002-12-14ruby: |   [     'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),     'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),     'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),     'date (noon UTC)' => Date.new( 2002, 12, 14 )   ]---test: Binarytodo: trueyaml: |   canonical: !binary "\    R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\    OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\    +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\    AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="   base64: !binary |    R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5    OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+    +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC    AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=   description: >    The binary value above is a tiny arrow    encoded as a gif image.ruby-setup: |   arrow_gif = "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236iiiccc\243\243\243\204\204\204\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371!\376\016Made with GIMP\000,\000\000\000\000\f\000\f\000\000\005,  \216\2010\236\343@\024\350i\020\304\321\212\010\034\317\200M$z\357\3770\205p\270\2601f\r\e\316\001\303\001\036\020' \202\n\001\000;"ruby: |   {     'canonical' => arrow_gif,     'base64' => arrow_gif,     'description' => "The binary value above is a tiny arrow encoded as a gif image.\n"   }---test: Merge keytodo: trueyaml: |  ---  - &CENTER { x: 1, y: 2 }  - &LEFT { x: 0, y: 2 }  - &BIG { r: 10 }  - &SMALL { r: 1 }  # All the following maps are equal:  - # Explicit keys    x: 1    y: 2    r: 10    label: center/big  - # Merge one map    << : *CENTER    r: 10    label: center/big  - # Merge multiple maps    << : [ *CENTER, *BIG ]    label: center/big  - # Override    << : [ *BIG, *LEFT, *SMALL ]    x: 1    label: center/bigruby-setup: |  center = { 'x' => 1, 'y' => 2 }  left = { 'x' => 0, 'y' => 2 }  big = { 'r' => 10 }  small = { 'r' => 1 }  node1 = { 'x' => 1, 'y' => 2, 'r' => 10, 'label' => 'center/big' }  node2 = center.dup  node2.update( { 'r' => 10, 'label' => 'center/big' } )  node3 = big.dup  node3.update( center )  node3.update( { 'label' => 'center/big' } )  node4 = small.dup  node4.update( left )  node4.update( big )  node4.update( { 'x' => 1, 'label' => 'center/big' } )ruby: |  [    center, left, big, small, node1, node2, node3, node4  ]---test: Default keytodo: trueyaml: |   ---     # Old schema   link with:     - library1.dll     - library2.dll   ---     # New schema   link with:     - = : library1.dll       version: 1.2     - = : library2.dll       version: 2.3ruby: |   y = YAML::Stream.new   y.add( { 'link with' => [ 'library1.dll', 'library2.dll' ] } )   obj_h = Hash[ 'version' => 1.2 ]   obj_h.default = 'library1.dll'   obj_h2 = Hash[ 'version' => 2.3 ]   obj_h2.default = 'library2.dll'   y.add( { 'link with' => [ obj_h, obj_h2 ] } )documents: 2---test: Special keystodo: trueyaml: |   "!": These three keys   "&": had to be quoted   "=": and are normal strings.   # NOTE: the following node should NOT be serialized this way.   encoded node :    !special '!' : '!type'    !special|canonical '&' : 12    = : value   # The proper way to serialize the above node is as follows:   node : !!type &12 valueruby: |   { '!' => 'These three keys', '&' => 'had to be quoted',     '=' => 'and are normal strings.',     'encoded node' => YAML::PrivateType.new( 'type', 'value' ),     'node' => YAML::PrivateType.new( 'type', 'value' ) }
 |