specexamples.h (16900B)
1 namespace { 2 const char *ex2_1 = 3 "- Mark McGwire\n" 4 "- Sammy Sosa\n" 5 "- Ken Griffey"; 6 7 const char *ex2_2 = 8 "hr: 65 # Home runs\n" 9 "avg: 0.278 # Batting average\n" 10 "rbi: 147 # Runs Batted In"; 11 12 const char *ex2_3 = 13 "american:\n" 14 "- Boston Red Sox\n" 15 "- Detroit Tigers\n" 16 "- New York Yankees\n" 17 "national:\n" 18 "- New York Mets\n" 19 "- Chicago Cubs\n" 20 "- Atlanta Braves"; 21 22 const char *ex2_4 = 23 "-\n" 24 " name: Mark McGwire\n" 25 " hr: 65\n" 26 " avg: 0.278\n" 27 "-\n" 28 " name: Sammy Sosa\n" 29 " hr: 63\n" 30 " avg: 0.288"; 31 32 const char *ex2_5 = 33 "- [name , hr, avg ]\n" 34 "- [Mark McGwire, 65, 0.278]\n" 35 "- [Sammy Sosa , 63, 0.288]"; 36 37 const char *ex2_6 = 38 "Mark McGwire: {hr: 65, avg: 0.278}\n" 39 "Sammy Sosa: {\n" 40 " hr: 63,\n" 41 " avg: 0.288\n" 42 " }"; 43 44 const char *ex2_7 = 45 "# Ranking of 1998 home runs\n" 46 "---\n" 47 "- Mark McGwire\n" 48 "- Sammy Sosa\n" 49 "- Ken Griffey\n" 50 "\n" 51 "# Team ranking\n" 52 "---\n" 53 "- Chicago Cubs\n" 54 "- St Louis Cardinals"; 55 56 const char *ex2_8 = 57 "---\n" 58 "time: 20:03:20\n" 59 "player: Sammy Sosa\n" 60 "action: strike (miss)\n" 61 "...\n" 62 "---\n" 63 "time: 20:03:47\n" 64 "player: Sammy Sosa\n" 65 "action: grand slam\n" 66 "..."; 67 68 const char *ex2_9 = 69 "---\n" 70 "hr: # 1998 hr ranking\n" 71 " - Mark McGwire\n" 72 " - Sammy Sosa\n" 73 "rbi:\n" 74 " # 1998 rbi ranking\n" 75 " - Sammy Sosa\n" 76 " - Ken Griffey"; 77 78 const char *ex2_10 = 79 "---\n" 80 "hr:\n" 81 " - Mark McGwire\n" 82 " # Following node labeled SS\n" 83 " - &SS Sammy Sosa\n" 84 "rbi:\n" 85 " - *SS # Subsequent occurrence\n" 86 " - Ken Griffey"; 87 88 const char *ex2_11 = 89 "? - Detroit Tigers\n" 90 " - Chicago cubs\n" 91 ":\n" 92 " - 2001-07-23\n" 93 "\n" 94 "? [ New York Yankees,\n" 95 " Atlanta Braves ]\n" 96 ": [ 2001-07-02, 2001-08-12,\n" 97 " 2001-08-14 ]"; 98 99 const char *ex2_12 = 100 "---\n" 101 "# Products purchased\n" 102 "- item : Super Hoop\n" 103 " quantity: 1\n" 104 "- item : Basketball\n" 105 " quantity: 4\n" 106 "- item : Big Shoes\n" 107 " quantity: 1"; 108 109 const char *ex2_13 = 110 "# ASCII Art\n" 111 "--- |\n" 112 " \\//||\\/||\n" 113 " // || ||__"; 114 115 const char *ex2_14 = 116 "--- >\n" 117 " Mark McGwire's\n" 118 " year was crippled\n" 119 " by a knee injury."; 120 121 const char *ex2_15 = 122 ">\n" 123 " Sammy Sosa completed another\n" 124 " fine season with great stats.\n" 125 " \n" 126 " 63 Home Runs\n" 127 " 0.288 Batting Average\n" 128 " \n" 129 " What a year!"; 130 131 const char *ex2_16 = 132 "name: Mark McGwire\n" 133 "accomplishment: >\n" 134 " Mark set a major league\n" 135 " home run record in 1998.\n" 136 "stats: |\n" 137 " 65 Home Runs\n" 138 " 0.278 Batting Average\n"; 139 140 const char *ex2_17 = 141 "unicode: \"Sosa did fine.\\u263A\"\n" 142 "control: \"\\b1998\\t1999\\t2000\\n\"\n" 143 "hex esc: \"\\x0d\\x0a is \\r\\n\"\n" 144 "\n" 145 "single: '\"Howdy!\" he cried.'\n" 146 "quoted: ' # Not a ''comment''.'\n" 147 "tie-fighter: '|\\-*-/|'"; 148 149 const char *ex2_18 = 150 "plain:\n" 151 " This unquoted scalar\n" 152 " spans many lines.\n" 153 "\n" 154 "quoted: \"So does this\n" 155 " quoted scalar.\\n\""; 156 157 const char *ex2_19 = 158 "canonical: 12345\n" 159 "decimal: +12345\n" 160 "octal: 0o14\n" 161 "hexadecimal: 0xC\n"; 162 163 const char *ex2_20 = 164 "canonical: 1.23015e+3\n" 165 "exponential: 12.3015e+02\n" 166 "fixed: 1230.15\n" 167 "negative infinity: -.inf\n" 168 "not a number: .NaN\n"; 169 170 const char *ex2_21 = 171 "null:\n" 172 "booleans: [ true, false ]\n" 173 "string: '012345'\n"; 174 175 const char *ex2_22 = 176 "canonical: 2001-12-15T02:59:43.1Z\n" 177 "iso8601: 2001-12-14t21:59:43.10-05:00\n" 178 "spaced: 2001-12-14 21:59:43.10 -5\n" 179 "date: 2002-12-14\n"; 180 181 const char *ex2_23 = 182 "---\n" 183 "not-date: !!str 2002-04-28\n" 184 "\n" 185 "picture: !!binary |\n" 186 " R0lGODlhDAAMAIQAAP//9/X\n" 187 " 17unp5WZmZgAAAOfn515eXv\n" 188 " Pz7Y6OjuDg4J+fn5OTk6enp\n" 189 " 56enmleECcgggoBADs=\n" 190 "\n" 191 "application specific tag: !something |\n" 192 " The semantics of the tag\n" 193 " above may be different for\n" 194 " different documents."; 195 196 const char *ex2_24 = 197 "%TAG ! tag:clarkevans.com,2002:\n" 198 "--- !shape\n" 199 " # Use the ! handle for presenting\n" 200 " # tag:clarkevans.com,2002:circle\n" 201 "- !circle\n" 202 " center: &ORIGIN {x: 73, y: 129}\n" 203 " radius: 7\n" 204 "- !line\n" 205 " start: *ORIGIN\n" 206 " finish: { x: 89, y: 102 }\n" 207 "- !label\n" 208 " start: *ORIGIN\n" 209 " color: 0xFFEEBB\n" 210 " text: Pretty vector drawing."; 211 212 const char *ex2_25 = 213 "# Sets are represented as a\n" 214 "# Mapping where each key is\n" 215 "# associated with a null value\n" 216 "--- !!set\n" 217 "? Mark McGwire\n" 218 "? Sammy Sosa\n" 219 "? Ken Griffey"; 220 221 const char *ex2_26 = 222 "# Ordered maps are represented as\n" 223 "# A sequence of mappings, with\n" 224 "# each mapping having one key\n" 225 "--- !!omap\n" 226 "- Mark McGwire: 65\n" 227 "- Sammy Sosa: 63\n" 228 "- Ken Griffey: 58"; 229 230 const char *ex2_27 = 231 "--- !<tag:clarkevans.com,2002:invoice>\n" 232 "invoice: 34843\n" 233 "date : 2001-01-23\n" 234 "bill-to: &id001\n" 235 " given : Chris\n" 236 " family : Dumars\n" 237 " address:\n" 238 " lines: |\n" 239 " 458 Walkman Dr.\n" 240 " Suite #292\n" 241 " city : Royal Oak\n" 242 " state : MI\n" 243 " postal : 48046\n" 244 "ship-to: *id001\n" 245 "product:\n" 246 " - sku : BL394D\n" 247 " quantity : 4\n" 248 " description : Basketball\n" 249 " price : 450.00\n" 250 " - sku : BL4438H\n" 251 " quantity : 1\n" 252 " description : Super Hoop\n" 253 " price : 2392.00\n" 254 "tax : 251.42\n" 255 "total: 4443.52\n" 256 "comments:\n" 257 " Late afternoon is best.\n" 258 " Backup contact is Nancy\n" 259 " Billsmer @ 338-4338."; 260 261 const char *ex2_28 = 262 "---\n" 263 "Time: 2001-11-23 15:01:42 -5\n" 264 "User: ed\n" 265 "Warning:\n" 266 " This is an error message\n" 267 " for the log file\n" 268 "---\n" 269 "Time: 2001-11-23 15:02:31 -5\n" 270 "User: ed\n" 271 "Warning:\n" 272 " A slightly different error\n" 273 " message.\n" 274 "---\n" 275 "Date: 2001-11-23 15:03:17 -5\n" 276 "User: ed\n" 277 "Fatal:\n" 278 " Unknown variable \"bar\"\n" 279 "Stack:\n" 280 " - file: TopClass.py\n" 281 " line: 23\n" 282 " code: |\n" 283 " x = MoreObject(\"345\\n\")\n" 284 " - file: MoreClass.py\n" 285 " line: 58\n" 286 " code: |-\n" 287 " foo = bar"; 288 289 // TODO: 5.1 - 5.2 BOM 290 291 const char *ex5_3 = 292 "sequence:\n" 293 "- one\n" 294 "- two\n" 295 "mapping:\n" 296 " ? sky\n" 297 " : blue\n" 298 " sea : green"; 299 300 const char *ex5_4 = 301 "sequence: [ one, two, ]\n" 302 "mapping: { sky: blue, sea: green }"; 303 304 const char *ex5_5 = "# Comment only."; 305 306 const char *ex5_6 = 307 "anchored: !local &anchor value\n" 308 "alias: *anchor"; 309 310 const char *ex5_7 = 311 "literal: |\n" 312 " some\n" 313 " text\n" 314 "folded: >\n" 315 " some\n" 316 " text\n"; 317 318 const char *ex5_8 = 319 "single: 'text'\n" 320 "double: \"text\""; 321 322 // TODO: 5.9 directive 323 // TODO: 5.10 reserved indicator 324 325 const char *ex5_11 = 326 "|\n" 327 " Line break (no glyph)\n" 328 " Line break (glyphed)\n"; 329 330 const char *ex5_12 = 331 "# Tabs and spaces\n" 332 "quoted: \"Quoted\t\"\n" 333 "block: |\n" 334 " void main() {\n" 335 " \tprintf(\"Hello, world!\\n\");\n" 336 " }"; 337 338 const char *ex5_13 = 339 "\"Fun with \\\\\n" 340 "\\\" \\a \\b \\e \\f \\\n" 341 "\\n \\r \\t \\v \\0 \\\n" 342 "\\ \\_ \\N \\L \\P \\\n" 343 "\\x41 \\u0041 \\U00000041\""; 344 345 const char *ex5_14 = 346 "Bad escapes:\n" 347 " \"\\c\n" 348 " \\xq-\""; 349 350 const char *ex6_1 = 351 " # Leading comment line spaces are\n" 352 " # neither content nor indentation.\n" 353 " \n" 354 "Not indented:\n" 355 " By one space: |\n" 356 " By four\n" 357 " spaces\n" 358 " Flow style: [ # Leading spaces\n" 359 " By two, # in flow style\n" 360 " Also by two, # are neither\n" 361 " \tStill by two # content nor\n" 362 " ] # indentation."; 363 364 const char *ex6_2 = 365 "? a\n" 366 ": -\tb\n" 367 " - -\tc\n" 368 " - d"; 369 370 const char *ex6_3 = 371 "- foo:\t bar\n" 372 "- - baz\n" 373 " -\tbaz"; 374 375 const char *ex6_4 = 376 "plain: text\n" 377 " lines\n" 378 "quoted: \"text\n" 379 " \tlines\"\n" 380 "block: |\n" 381 " text\n" 382 " \tlines\n"; 383 384 const char *ex6_5 = 385 "Folding:\n" 386 " \"Empty line\n" 387 " \t\n" 388 " as a line feed\"\n" 389 "Chomping: |\n" 390 " Clipped empty lines\n" 391 " "; 392 393 const char *ex6_6 = 394 ">-\n" 395 " trimmed\n" 396 " \n" 397 " \n" 398 "\n" 399 " as\n" 400 " space"; 401 402 const char *ex6_7 = 403 ">\n" 404 " foo \n" 405 " \n" 406 " \t bar\n" 407 "\n" 408 " baz\n"; 409 410 const char *ex6_8 = 411 "\"\n" 412 " foo \n" 413 " \n" 414 " \t bar\n" 415 "\n" 416 " baz\n" 417 "\""; 418 419 const char *ex6_9 = 420 "key: # Comment\n" 421 " value"; 422 423 const char *ex6_10 = 424 " # Comment\n" 425 " \n" 426 "\n"; 427 428 const char *ex6_11 = 429 "key: # Comment\n" 430 " # lines\n" 431 " value\n" 432 "\n"; 433 434 const char *ex6_12 = 435 "{ first: Sammy, last: Sosa }:\n" 436 "# Statistics:\n" 437 " hr: # Home runs\n" 438 " 65\n" 439 " avg: # Average\n" 440 " 0.278"; 441 442 const char *ex6_13 = 443 "%FOO bar baz # Should be ignored\n" 444 " # with a warning.\n" 445 "--- \"foo\""; 446 447 const char *ex6_14 = 448 "%YAML 1.3 # Attempt parsing\n" 449 " # with a warning\n" 450 "---\n" 451 "\"foo\""; 452 453 const char *ex6_15 = 454 "%YAML 1.2\n" 455 "%YAML 1.1\n" 456 "foo"; 457 458 const char *ex6_16 = 459 "%TAG !yaml! tag:yaml.org,2002:\n" 460 "---\n" 461 "!yaml!str \"foo\""; 462 463 const char *ex6_17 = 464 "%TAG ! !foo\n" 465 "%TAG ! !foo\n" 466 "bar"; 467 468 const char *ex6_18 = 469 "# Private\n" 470 "!foo \"bar\"\n" 471 "...\n" 472 "# Global\n" 473 "%TAG ! tag:example.com,2000:app/\n" 474 "---\n" 475 "!foo \"bar\""; 476 477 const char *ex6_19 = 478 "%TAG !! tag:example.com,2000:app/\n" 479 "---\n" 480 "!!int 1 - 3 # Interval, not integer"; 481 482 const char *ex6_20 = 483 "%TAG !e! tag:example.com,2000:app/\n" 484 "---\n" 485 "!e!foo \"bar\""; 486 487 const char *ex6_21 = 488 "%TAG !m! !my-\n" 489 "--- # Bulb here\n" 490 "!m!light fluorescent\n" 491 "...\n" 492 "%TAG !m! !my-\n" 493 "--- # Color here\n" 494 "!m!light green"; 495 496 const char *ex6_22 = 497 "%TAG !e! tag:example.com,2000:app/\n" 498 "---\n" 499 "- !e!foo \"bar\""; 500 501 const char *ex6_23 = 502 "!!str &a1 \"foo\":\n" 503 " !!str bar\n" 504 "&a2 baz : *a1"; 505 506 const char *ex6_24 = 507 "!<tag:yaml.org,2002:str> foo :\n" 508 " !<!bar> baz"; 509 510 const char *ex6_25 = 511 "- !<!> foo\n" 512 "- !<$:?> bar\n"; 513 514 const char *ex6_26 = 515 "%TAG !e! tag:example.com,2000:app/\n" 516 "---\n" 517 "- !local foo\n" 518 "- !!str bar\n" 519 "- !e!tag%21 baz\n"; 520 521 const char *ex6_27a = 522 "%TAG !e! tag:example,2000:app/\n" 523 "---\n" 524 "- !e! foo"; 525 526 const char *ex6_27b = 527 "%TAG !e! tag:example,2000:app/\n" 528 "---\n" 529 "- !h!bar baz"; 530 531 const char *ex6_28 = 532 "# Assuming conventional resolution:\n" 533 "- \"12\"\n" 534 "- 12\n" 535 "- ! 12"; 536 537 const char *ex6_29 = 538 "First occurrence: &anchor Value\n" 539 "Second occurrence: *anchor"; 540 541 const char *ex7_1 = 542 "First occurrence: &anchor Foo\n" 543 "Second occurrence: *anchor\n" 544 "Override anchor: &anchor Bar\n" 545 "Reuse anchor: *anchor"; 546 547 const char *ex7_2 = 548 "{\n" 549 " foo : !!str,\n" 550 " !!str : bar,\n" 551 "}"; 552 553 const char *ex7_3 = 554 "{\n" 555 " ? foo :,\n" 556 " : bar,\n" 557 "}\n"; 558 559 const char *ex7_4 = 560 "\"implicit block key\" : [\n" 561 " \"implicit flow key\" : value,\n" 562 " ]"; 563 564 const char *ex7_5 = 565 "\"folded \n" 566 "to a space,\t\n" 567 " \n" 568 "to a line feed, or \t\\\n" 569 " \\ \tnon-content\""; 570 571 const char *ex7_6 = 572 "\" 1st non-empty\n" 573 "\n" 574 " 2nd non-empty \n" 575 "\t3rd non-empty \""; 576 577 const char *ex7_7 = " 'here''s to \"quotes\"'"; 578 579 const char *ex7_8 = 580 "'implicit block key' : [\n" 581 " 'implicit flow key' : value,\n" 582 " ]"; 583 584 const char *ex7_9 = 585 "' 1st non-empty\n" 586 "\n" 587 " 2nd non-empty \n" 588 "\t3rd non-empty '"; 589 590 const char *ex7_10 = 591 "# Outside flow collection:\n" 592 "- ::vector\n" 593 "- \": - ()\"\n" 594 "- Up, up, and away!\n" 595 "- -123\n" 596 "- http://example.com/foo#bar\n" 597 "# Inside flow collection:\n" 598 "- [ ::vector,\n" 599 " \": - ()\",\n" 600 " \"Up, up, and away!\",\n" 601 " -123,\n" 602 " http://example.com/foo#bar ]"; 603 604 const char *ex7_11 = 605 "implicit block key : [\n" 606 " implicit flow key : value,\n" 607 " ]"; 608 609 const char *ex7_12 = 610 "1st non-empty\n" 611 "\n" 612 " 2nd non-empty \n" 613 "\t3rd non-empty"; 614 615 const char *ex7_13 = 616 "- [ one, two, ]\n" 617 "- [three ,four]"; 618 619 const char *ex7_14 = 620 "[\n" 621 "\"double\n" 622 " quoted\", 'single\n" 623 " quoted',\n" 624 "plain\n" 625 " text, [ nested ],\n" 626 "single: pair,\n" 627 "]"; 628 629 const char *ex7_15 = 630 "- { one : two , three: four , }\n" 631 "- {five: six,seven : eight}"; 632 633 const char *ex7_16 = 634 "{\n" 635 "? explicit: entry,\n" 636 "implicit: entry,\n" 637 "?\n" 638 "}"; 639 640 const char *ex7_17 = 641 "{\n" 642 "unquoted : \"separate\",\n" 643 "http://foo.com,\n" 644 "omitted value:,\n" 645 ": omitted key,\n" 646 "}"; 647 648 const char *ex7_18 = 649 "{\n" 650 "\"adjacent\":value,\n" 651 "\"readable\":value,\n" 652 "\"empty\":\n" 653 "}"; 654 655 const char *ex7_19 = 656 "[\n" 657 "foo: bar\n" 658 "]"; 659 660 const char *ex7_20 = 661 "[\n" 662 "? foo\n" 663 " bar : baz\n" 664 "]"; 665 666 const char *ex7_21 = 667 "- [ YAML : separate ]\n" 668 "- [ : empty key entry ]\n" 669 "- [ {JSON: like}:adjacent ]"; 670 671 const char *ex7_22 = 672 "[ foo\n" 673 " bar: invalid,"; // Note: we don't check (on purpose) the >1K chars for an 674 // implicit key 675 676 const char *ex7_23 = 677 "- [ a, b ]\n" 678 "- { a: b }\n" 679 "- \"a\"\n" 680 "- 'b'\n" 681 "- c"; 682 683 const char *ex7_24 = 684 "- !!str \"a\"\n" 685 "- 'b'\n" 686 "- &anchor \"c\"\n" 687 "- *anchor\n" 688 "- !!str"; 689 690 const char *ex8_1 = 691 "- | # Empty header\n" 692 " literal\n" 693 "- >1 # Indentation indicator\n" 694 " folded\n" 695 "- |+ # Chomping indicator\n" 696 " keep\n" 697 "\n" 698 "- >1- # Both indicators\n" 699 " strip\n"; 700 701 const char *ex8_2 = 702 "- |\n" 703 " detected\n" 704 "- >\n" 705 " \n" 706 " \n" 707 " # detected\n" 708 "- |1\n" 709 " explicit\n" 710 "- >\n" 711 " \t\n" 712 " detected\n"; 713 714 const char *ex8_3a = 715 "- |\n" 716 " \n" 717 " text"; 718 719 const char *ex8_3b = 720 "- >\n" 721 " text\n" 722 " text"; 723 724 const char *ex8_3c = 725 "- |2\n" 726 " text"; 727 728 const char *ex8_4 = 729 "strip: |-\n" 730 " text\n" 731 "clip: |\n" 732 " text\n" 733 "keep: |+\n" 734 " text\n"; 735 736 const char *ex8_5 = 737 " # Strip\n" 738 " # Comments:\n" 739 "strip: |-\n" 740 " # text\n" 741 " \n" 742 " # Clip\n" 743 " # comments:\n" 744 "\n" 745 "clip: |\n" 746 " # text\n" 747 " \n" 748 " # Keep\n" 749 " # comments:\n" 750 "\n" 751 "keep: |+\n" 752 " # text\n" 753 "\n" 754 " # Trail\n" 755 " # Comments\n"; 756 757 const char *ex8_6 = 758 "strip: >-\n" 759 "\n" 760 "clip: >\n" 761 "\n" 762 "keep: |+\n" 763 "\n"; 764 765 const char *ex8_7 = 766 "|\n" 767 " literal\n" 768 " \ttext\n" 769 "\n"; 770 771 const char *ex8_8 = 772 "|\n" 773 " \n" 774 " \n" 775 " literal\n" 776 " \n" 777 " \n" 778 " text\n" 779 "\n" 780 " # Comment\n"; 781 782 const char *ex8_9 = 783 ">\n" 784 " folded\n" 785 " text\n" 786 "\n"; 787 788 const char *ex8_10 = 789 ">\n" 790 "\n" 791 " folded\n" 792 " line\n" 793 "\n" 794 " next\n" 795 " line\n" 796 " * bullet\n" 797 "\n" 798 " * list\n" 799 " * lines\n" 800 "\n" 801 " last\n" 802 " line\n" 803 "\n" 804 "# Comment\n"; 805 806 const char *ex8_11 = ex8_10; 807 const char *ex8_12 = ex8_10; 808 const char *ex8_13 = ex8_10; 809 810 const char *ex8_14 = 811 "block sequence:\n" 812 " - one\n" 813 " - two : three\n"; 814 815 const char *ex8_15 = 816 "- # Empty\n" 817 "- |\n" 818 " block node\n" 819 "- - one # Compact\n" 820 " - two # sequence\n" 821 "- one: two # Compact mapping\n"; 822 823 const char *ex8_16 = 824 "block mapping:\n" 825 " key: value\n"; 826 827 const char *ex8_17 = 828 "? explicit key # Empty value\n" 829 "? |\n" 830 " block key\n" 831 ": - one # Explicit compact\n" 832 " - two # block value\n"; 833 834 const char *ex8_18 = 835 "plain key: in-line value\n" 836 ": # Both empty\n" 837 "\"quoted key\":\n" 838 "- entry\n"; 839 840 const char *ex8_19 = 841 "- sun: yellow\n" 842 "- ? earth: blue\n" 843 " : moon: white\n"; 844 845 const char *ex8_20 = 846 "-\n" 847 " \"flow in block\"\n" 848 "- >\n" 849 " Block scalar\n" 850 "- !!map # Block collection\n" 851 " foo : bar\n"; 852 853 const char *ex8_21 = 854 "literal: |2\n" 855 " value\n" 856 "folded:\n" 857 " !foo\n" 858 " >1\n" 859 " value\n"; 860 861 const char *ex8_22 = 862 "sequence: !!seq\n" 863 "- entry\n" 864 "- !!seq\n" 865 " - nested\n" 866 "mapping: !!map\n" 867 " foo: bar\n"; 868 }