├── .github ├── renovate.json5 └── workflows │ └── ci.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── bench ├── .cargo │ └── config.toml ├── Cargo.toml ├── LICENSE ├── README.md ├── justfile ├── src │ └── lib.rs └── tools │ ├── README.md │ ├── bench_compare │ ├── .gitignore │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs │ ├── dump_events.rs │ └── gen_large_yaml │ ├── .gitignore │ ├── Cargo.toml │ └── src │ ├── gen.rs │ ├── main.rs │ └── nested.rs ├── fuzz ├── Cargo.toml └── fuzz_targets │ └── parse.rs ├── garden.yaml ├── justfile ├── parser ├── .cargo │ └── config.toml ├── .gitattributes ├── .licenses │ ├── ChenYuheng-Apache │ ├── ChenYuheng-MIT │ ├── Ethiraric-Apache │ └── Ethiraric-MIT ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE ├── README.md ├── documents │ ├── 2024-03-15-FirstRelease.md │ └── img │ │ ├── 2024-03-15-benchmarks.csv │ │ └── benchmarks-v0.6.svg ├── justfile ├── src │ ├── char_traits.rs │ ├── debug.rs │ ├── input.rs │ ├── input │ │ ├── buffered.rs │ │ └── str.rs │ ├── lib.rs │ ├── parser.rs │ └── scanner.rs ├── tests │ ├── basic.rs │ ├── fuzz.rs │ ├── issues.rs │ ├── span.rs │ ├── spec_test.rs │ ├── spec_test.rs.inc │ ├── specexamples.rs.inc │ ├── yaml-test-suite.rs │ └── yaml-test-suite │ │ ├── .bpan │ │ └── run-or-docker.bash │ │ ├── .github │ │ └── workflows │ │ │ └── test.yaml │ │ ├── .gitignore │ │ ├── License │ │ ├── Makefile │ │ ├── ReadMe.md │ │ ├── bin │ │ ├── YAMLTestSuite.pm │ │ ├── new-test-file │ │ ├── new-test-id │ │ ├── run-all-parsers │ │ ├── suite-to-data │ │ ├── suite-to-data.pl │ │ ├── suite-to-testml │ │ ├── suite-to-tsv │ │ ├── tsv-to-json │ │ ├── tsv-to-new │ │ └── yaml-to-test │ │ ├── doc │ │ └── tag-usage.md │ │ └── src │ │ ├── 229Q.yaml │ │ ├── 236B.yaml │ │ ├── 26DV.yaml │ │ ├── 27NA.yaml │ │ ├── 2AUY.yaml │ │ ├── 2CMS.yaml │ │ ├── 2EBW.yaml │ │ ├── 2G84.yaml │ │ ├── 2JQS.yaml │ │ ├── 2LFX.yaml │ │ ├── 2SXE.yaml │ │ ├── 2XXW.yaml │ │ ├── 33X3.yaml │ │ ├── 35KP.yaml │ │ ├── 36F6.yaml │ │ ├── 3ALJ.yaml │ │ ├── 3GZX.yaml │ │ ├── 3HFZ.yaml │ │ ├── 3MYT.yaml │ │ ├── 3R3P.yaml │ │ ├── 3RLN.yaml │ │ ├── 3UYS.yaml │ │ ├── 4ABK.yaml │ │ ├── 4CQQ.yaml │ │ ├── 4EJS.yaml │ │ ├── 4FJ6.yaml │ │ ├── 4GC6.yaml │ │ ├── 4H7K.yaml │ │ ├── 4HVU.yaml │ │ ├── 4JVG.yaml │ │ ├── 4MUZ.yaml │ │ ├── 4Q9F.yaml │ │ ├── 4QFQ.yaml │ │ ├── 4RWC.yaml │ │ ├── 4UYU.yaml │ │ ├── 4V8U.yaml │ │ ├── 4WA9.yaml │ │ ├── 4ZYM.yaml │ │ ├── 52DL.yaml │ │ ├── 54T7.yaml │ │ ├── 55WF.yaml │ │ ├── 565N.yaml │ │ ├── 57H4.yaml │ │ ├── 58MP.yaml │ │ ├── 5BVJ.yaml │ │ ├── 5C5M.yaml │ │ ├── 5GBF.yaml │ │ ├── 5KJE.yaml │ │ ├── 5LLU.yaml │ │ ├── 5MUD.yaml │ │ ├── 5NYZ.yaml │ │ ├── 5T43.yaml │ │ ├── 5TRB.yaml │ │ ├── 5TYM.yaml │ │ ├── 5U3A.yaml │ │ ├── 5WE3.yaml │ │ ├── 62EZ.yaml │ │ ├── 652Z.yaml │ │ ├── 65WH.yaml │ │ ├── 6BCT.yaml │ │ ├── 6BFJ.yaml │ │ ├── 6CA3.yaml │ │ ├── 6CK3.yaml │ │ ├── 6FWR.yaml │ │ ├── 6H3V.yaml │ │ ├── 6HB6.yaml │ │ ├── 6JQW.yaml │ │ ├── 6JTT.yaml │ │ ├── 6JWB.yaml │ │ ├── 6KGN.yaml │ │ ├── 6LVF.yaml │ │ ├── 6M2F.yaml │ │ ├── 6PBE.yaml │ │ ├── 6S55.yaml │ │ ├── 6SLA.yaml │ │ ├── 6VJK.yaml │ │ ├── 6WLZ.yaml │ │ ├── 6WPF.yaml │ │ ├── 6XDY.yaml │ │ ├── 6ZKB.yaml │ │ ├── 735Y.yaml │ │ ├── 74H7.yaml │ │ ├── 753E.yaml │ │ ├── 7A4E.yaml │ │ ├── 7BMT.yaml │ │ ├── 7BUB.yaml │ │ ├── 7FWL.yaml │ │ ├── 7LBH.yaml │ │ ├── 7MNF.yaml │ │ ├── 7T8X.yaml │ │ ├── 7TMG.yaml │ │ ├── 7W2P.yaml │ │ ├── 7Z25.yaml │ │ ├── 7ZZ5.yaml │ │ ├── 82AN.yaml │ │ ├── 87E4.yaml │ │ ├── 8CWC.yaml │ │ ├── 8G76.yaml │ │ ├── 8KB6.yaml │ │ ├── 8MK2.yaml │ │ ├── 8QBE.yaml │ │ ├── 8UDB.yaml │ │ ├── 8XDJ.yaml │ │ ├── 8XYN.yaml │ │ ├── 93JH.yaml │ │ ├── 93WF.yaml │ │ ├── 96L6.yaml │ │ ├── 96NN.yaml │ │ ├── 98YD.yaml │ │ ├── 9BXH.yaml │ │ ├── 9C9N.yaml │ │ ├── 9CWY.yaml │ │ ├── 9DXL.yaml │ │ ├── 9FMG.yaml │ │ ├── 9HCY.yaml │ │ ├── 9J7A.yaml │ │ ├── 9JBA.yaml │ │ ├── 9KAX.yaml │ │ ├── 9KBC.yaml │ │ ├── 9MAG.yaml │ │ ├── 9MMA.yaml │ │ ├── 9MMW.yaml │ │ ├── 9MQT.yaml │ │ ├── 9SA2.yaml │ │ ├── 9SHH.yaml │ │ ├── 9TFX.yaml │ │ ├── 9U5K.yaml │ │ ├── 9WXW.yaml │ │ ├── 9YRD.yaml │ │ ├── A2M4.yaml │ │ ├── A6F9.yaml │ │ ├── A984.yaml │ │ ├── AB8U.yaml │ │ ├── AVM7.yaml │ │ ├── AZ63.yaml │ │ ├── AZW3.yaml │ │ ├── B3HG.yaml │ │ ├── B63P.yaml │ │ ├── BD7L.yaml │ │ ├── BEC7.yaml │ │ ├── BF9H.yaml │ │ ├── BS4K.yaml │ │ ├── BU8L.yaml │ │ ├── C2DT.yaml │ │ ├── C2SP.yaml │ │ ├── C4HZ.yaml │ │ ├── CC74.yaml │ │ ├── CFD4.yaml │ │ ├── CML9.yaml │ │ ├── CN3R.yaml │ │ ├── CPZ3.yaml │ │ ├── CQ3W.yaml │ │ ├── CT4Q.yaml │ │ ├── CTN5.yaml │ │ ├── CUP7.yaml │ │ ├── CVW2.yaml │ │ ├── CXX2.yaml │ │ ├── D49Q.yaml │ │ ├── D83L.yaml │ │ ├── D88J.yaml │ │ ├── D9TU.yaml │ │ ├── DBG4.yaml │ │ ├── DC7X.yaml │ │ ├── DE56.yaml │ │ ├── DFF7.yaml │ │ ├── DHP8.yaml │ │ ├── DK3J.yaml │ │ ├── DK4H.yaml │ │ ├── DK95.yaml │ │ ├── DMG6.yaml │ │ ├── DWX9.yaml │ │ ├── E76Z.yaml │ │ ├── EB22.yaml │ │ ├── EHF6.yaml │ │ ├── EW3V.yaml │ │ ├── EX5H.yaml │ │ ├── EXG3.yaml │ │ ├── F2C7.yaml │ │ ├── F3CP.yaml │ │ ├── F6MC.yaml │ │ ├── F8F9.yaml │ │ ├── FBC9.yaml │ │ ├── FH7J.yaml │ │ ├── FP8R.yaml │ │ ├── FQ7F.yaml │ │ ├── FRK4.yaml │ │ ├── FTA2.yaml │ │ ├── FUP4.yaml │ │ ├── G4RS.yaml │ │ ├── G5U8.yaml │ │ ├── G7JE.yaml │ │ ├── G992.yaml │ │ ├── G9HC.yaml │ │ ├── GDY7.yaml │ │ ├── GH63.yaml │ │ ├── GT5M.yaml │ │ ├── H2RW.yaml │ │ ├── H3Z8.yaml │ │ ├── H7J7.yaml │ │ ├── H7TQ.yaml │ │ ├── HM87.yaml │ │ ├── HMK4.yaml │ │ ├── HMQ5.yaml │ │ ├── HRE5.yaml │ │ ├── HS5T.yaml │ │ ├── HU3P.yaml │ │ ├── HWV9.yaml │ │ ├── J3BT.yaml │ │ ├── J5UC.yaml │ │ ├── J7PZ.yaml │ │ ├── J7VC.yaml │ │ ├── J9HZ.yaml │ │ ├── JEF9.yaml │ │ ├── JHB9.yaml │ │ ├── JKF3.yaml │ │ ├── JQ4R.yaml │ │ ├── JR7V.yaml │ │ ├── JS2J.yaml │ │ ├── JTV5.yaml │ │ ├── JY7Z.yaml │ │ ├── K3WX.yaml │ │ ├── K4SU.yaml │ │ ├── K527.yaml │ │ ├── K54U.yaml │ │ ├── K858.yaml │ │ ├── KH5V.yaml │ │ ├── KK5P.yaml │ │ ├── KMK3.yaml │ │ ├── KS4U.yaml │ │ ├── KSS4.yaml │ │ ├── L24T.yaml │ │ ├── L383.yaml │ │ ├── L94M.yaml │ │ ├── L9U5.yaml │ │ ├── LE5A.yaml │ │ ├── LHL4.yaml │ │ ├── LP6E.yaml │ │ ├── LQZ7.yaml │ │ ├── LX3P.yaml │ │ ├── M29M.yaml │ │ ├── M2N8.yaml │ │ ├── M5C3.yaml │ │ ├── M5DY.yaml │ │ ├── M6YH.yaml │ │ ├── M7A3.yaml │ │ ├── M7NX.yaml │ │ ├── M9B4.yaml │ │ ├── MJS9.yaml │ │ ├── MUS6.yaml │ │ ├── MXS3.yaml │ │ ├── MYW6.yaml │ │ ├── MZX3.yaml │ │ ├── N4JP.yaml │ │ ├── N782.yaml │ │ ├── NAT4.yaml │ │ ├── NB6Z.yaml │ │ ├── NHX8.yaml │ │ ├── NJ66.yaml │ │ ├── NKF9.yaml │ │ ├── NP9H.yaml │ │ ├── P2AD.yaml │ │ ├── P2EQ.yaml │ │ ├── P76L.yaml │ │ ├── P94K.yaml │ │ ├── PBJ2.yaml │ │ ├── PRH3.yaml │ │ ├── PUW8.yaml │ │ ├── PW8X.yaml │ │ ├── Q4CL.yaml │ │ ├── Q5MG.yaml │ │ ├── Q88A.yaml │ │ ├── Q8AD.yaml │ │ ├── Q9WF.yaml │ │ ├── QB6E.yaml │ │ ├── QF4Y.yaml │ │ ├── QLJ7.yaml │ │ ├── QT73.yaml │ │ ├── R4YG.yaml │ │ ├── R52L.yaml │ │ ├── RHX7.yaml │ │ ├── RLU9.yaml │ │ ├── RR7F.yaml │ │ ├── RTP8.yaml │ │ ├── RXY3.yaml │ │ ├── RZP5.yaml │ │ ├── RZT7.yaml │ │ ├── S3PD.yaml │ │ ├── S4GJ.yaml │ │ ├── S4JQ.yaml │ │ ├── S4T7.yaml │ │ ├── S7BG.yaml │ │ ├── S98Z.yaml │ │ ├── S9E8.yaml │ │ ├── SBG9.yaml │ │ ├── SF5V.yaml │ │ ├── SKE5.yaml │ │ ├── SM9W.yaml │ │ ├── SR86.yaml │ │ ├── SSW6.yaml │ │ ├── SU5Z.yaml │ │ ├── SU74.yaml │ │ ├── SY6V.yaml │ │ ├── SYW4.yaml │ │ ├── T26H.yaml │ │ ├── T4YY.yaml │ │ ├── T5N4.yaml │ │ ├── T833.yaml │ │ ├── TD5N.yaml │ │ ├── TE2A.yaml │ │ ├── TL85.yaml │ │ ├── TS54.yaml │ │ ├── U3C3.yaml │ │ ├── U3XV.yaml │ │ ├── U44R.yaml │ │ ├── U99R.yaml │ │ ├── U9NS.yaml │ │ ├── UDM2.yaml │ │ ├── UDR7.yaml │ │ ├── UGM3.yaml │ │ ├── UKK6.yaml │ │ ├── UT92.yaml │ │ ├── UV7Q.yaml │ │ ├── V55R.yaml │ │ ├── V9D5.yaml │ │ ├── VJP3.yaml │ │ ├── W42U.yaml │ │ ├── W4TN.yaml │ │ ├── W5VH.yaml │ │ ├── W9L4.yaml │ │ ├── WZ62.yaml │ │ ├── X38W.yaml │ │ ├── X4QW.yaml │ │ ├── X8DW.yaml │ │ ├── XLQ9.yaml │ │ ├── XV9V.yaml │ │ ├── XW4D.yaml │ │ ├── Y2GN.yaml │ │ ├── Y79Y.yaml │ │ ├── YD5X.yaml │ │ ├── YJV2.yaml │ │ ├── Z67P.yaml │ │ ├── Z9M4.yaml │ │ ├── ZCZ6.yaml │ │ ├── ZF4X.yaml │ │ ├── ZH7C.yaml │ │ ├── ZK9H.yaml │ │ ├── ZL4Z.yaml │ │ ├── ZVH3.yaml │ │ ├── ZWK4.yaml │ │ ├── ZXT5.yaml │ │ └── ZYU8.yaml └── tools │ ├── README.md │ ├── dump_events.rs │ ├── run_bench.rs │ ├── time_parse.rs │ └── walk │ ├── Cargo.toml │ └── src │ └── main.rs └── saphyr ├── .cargo └── config.toml ├── .gitattributes ├── .licenses ├── ChenYuheng-Apache ├── ChenYuheng-MIT ├── Ethiraric-Apache └── Ethiraric-MIT ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE ├── appveyor.yml ├── documents ├── 2024-03-15-FirstRelease.md └── img │ ├── 2024-03-15-benchmarks.csv │ └── benchmarks-v0.6.svg ├── examples └── dump_yaml.rs ├── justfile ├── src ├── annotated.rs ├── annotated │ ├── marked_yaml.rs │ ├── marked_yaml_owned.rs │ ├── yaml_data.rs │ └── yaml_data_owned.rs ├── char_traits.rs ├── emitter.rs ├── encoding.rs ├── lib.rs ├── loader.rs ├── macros.rs ├── scalar.rs ├── yaml.rs └── yaml_owned.rs └── tests ├── basic.rs ├── emitter.rs ├── index.rs ├── quickcheck.rs ├── spec_test.rs ├── spec_test.rs.inc ├── specexamples.rs.inc └── test_round_trip.rs /.gitignore: -------------------------------------------------------------------------------- 1 | **Cargo.lock 2 | !/Cargo.lock 3 | /bench/perf.* 4 | /bench/coverage.sh 5 | /parser/perf.* 6 | /parser/coverage.sh 7 | /target 8 | *.swp 9 | fuzz/artifacts 10 | fuzz/corpus 11 | -------------------------------------------------------------------------------- /bench/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | gen_large_yaml = "run --profile=release-lto --package gen_large_yaml --bin gen_large_yaml --manifest-path tools/gen_large_yaml/Cargo.toml --" 3 | bench_compare = "run --package bench_compare --bin bench_compare --manifest-path tools/bench_compare/Cargo.toml --" 4 | -------------------------------------------------------------------------------- /bench/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "saphyr-bench" 3 | authors = [ "Ethiraric " ] 4 | description = "Utilities to benchmark saphyr" 5 | license = "MIT" 6 | readme = "README.md" 7 | edition = { workspace = true } 8 | version = { workspace = true } 9 | 10 | [dependencies] 11 | saphyr-parser = { workspace = true } 12 | -------------------------------------------------------------------------------- /bench/README.md: -------------------------------------------------------------------------------- 1 | # `saphyr-bench` 2 | 3 | Set of utilities to benchmark the `saphyr` library. 4 | -------------------------------------------------------------------------------- /bench/justfile: -------------------------------------------------------------------------------- 1 | before_commit: 2 | cargo clippy --release --all-targets -- -D warnings 3 | cargo clippy --all-targets -- -D warnings 4 | cargo build --release --all-targets 5 | cargo build --all-targets 6 | cargo build --profile=release-lto --package gen_large_yaml --bin gen_large_yaml --manifest-path tools/gen_large_yaml/Cargo.toml 7 | cargo build --profile=release-lto --package bench_compare --bin bench_compare --manifest-path tools/bench_compare/Cargo.toml 8 | 9 | ethi_bench: 10 | cargo build --release --all-targets 11 | cd ../Yaml-rust && cargo build --release --all-targets 12 | cd ../serde-yaml/ && cargo build --release --all-targets 13 | cd ../libfyaml/build && ninja 14 | cargo bench_compare run_bench 15 | -------------------------------------------------------------------------------- /bench/src/lib.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bench/tools/bench_compare/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /bench/tools/bench_compare/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bench_compare" 3 | version = "0.6.0" 4 | authors = [ 5 | "Ethiraric " 6 | ] 7 | license = "MIT OR Apache-2.0" 8 | description = "Run multiple YAML parsers and compare their times" 9 | repository = "https://github.com/Ethiraric/yaml-rust2" 10 | readme = "README.md" 11 | edition = "2018" 12 | 13 | [dependencies] 14 | anyhow = { version = "1.0.81", features = ["backtrace"] } 15 | serde = { version = "1.0.197", features = ["derive"] } 16 | serde_yaml = "0.9.32" 17 | toml = "0.8.11" 18 | -------------------------------------------------------------------------------- /bench/tools/gen_large_yaml/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /bench/tools/gen_large_yaml/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "gen_large_yaml" 3 | version = "0.6.0" 4 | authors = [ 5 | "Ethiraric " 6 | ] 7 | license = "MIT OR Apache-2.0" 8 | description = "A helper to generate large YAML files" 9 | repository = "https://github.com/Ethiraric/yaml-rust2" 10 | readme = "README.md" 11 | edition = "2018" 12 | 13 | [dependencies] 14 | rand = { version = "0.8.5", features = [ "small_rng" ] } 15 | lipsum = "0.9.0" 16 | -------------------------------------------------------------------------------- /fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "saphyr-fuzz" 3 | version = "0.0.0" 4 | publish = false 5 | edition = "2021" 6 | 7 | [package.metadata] 8 | cargo-fuzz = true 9 | 10 | [dependencies] 11 | libfuzzer-sys = "0.4" 12 | saphyr.workspace = true 13 | saphyr-parser.workspace = true 14 | 15 | [[bin]] 16 | name = "parse" 17 | path = "fuzz_targets/parse.rs" 18 | test = false 19 | doc = false 20 | bench = false 21 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | before_commit: 2 | cargo fmt --check 3 | cargo clippy --release --all-targets -- -D warnings 4 | cargo clippy --all-targets -- -D warnings 5 | cargo build --release --all-targets 6 | cargo build --all-targets 7 | cargo test 8 | cargo test --release 9 | cargo test --doc 10 | cargo build --release --package gen_large_yaml --bin gen_large_yaml --manifest-path bench/tools/gen_large_yaml/Cargo.toml 11 | cargo build --release --package bench_compare --bin bench_compare --manifest-path bench/tools/bench_compare/Cargo.toml 12 | cargo build --release --package walk --bin walk --manifest-path parser/tools/walk/Cargo.toml 13 | just check_doc 14 | 15 | check_doc: 16 | RUSTDOCFLAGS="-D warnings" cargo doc --all-features --document-private-items 17 | 18 | fuzz: 19 | CARGO_PROFILE_RELEASE_LTO=false cargo +nightly fuzz run parse 20 | -------------------------------------------------------------------------------- /parser/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | gen_large_yaml = "run --profile=release-lto --package gen_large_yaml --bin gen_large_yaml --manifest-path tools/gen_large_yaml/Cargo.toml --" 3 | bench_compare = "run --package bench_compare --bin bench_compare --manifest-path tools/bench_compare/Cargo.toml --" 4 | -------------------------------------------------------------------------------- /parser/.gitattributes: -------------------------------------------------------------------------------- 1 | tests/*.rs.inc linguist-language=Rust linguist-generated 2 | -------------------------------------------------------------------------------- /parser/LICENSE: -------------------------------------------------------------------------------- 1 | Code up to and including commit `da52a68615f2ecdd6b7e4567019f280c433c1521` is licensed by Chen Yuheng under either of: 2 | - [Apache License, Version 2.0](.licenses/ChenYuheng-Apache) (http://www.apache.org/licenses/LICENSE-2.0) 3 | - [MIT License](./licenses/ChenYuheng-MIT) (http://opensource.org/licenses/MIT) 4 | 5 | Code modifications starting with commit `1d71a23b151dcc12b289d0f06d8207dd9c764216` (included) are licenced by Ethiraric under either of: 6 | - [Apache License, Version 2.0](.licenses/Ethiraric-Apache) (http://www.apache.org/licenses/LICENSE-2.0) 7 | - [MIT License](./licenses/Ethiraric-MIT) (http://opensource.org/licenses/MIT) 8 | 9 | Redistributions of this Work must include licenses of both Chen Yuheng and Ethiraric. 10 | -------------------------------------------------------------------------------- /parser/documents/img/2024-03-15-benchmarks.csv: -------------------------------------------------------------------------------- 1 | ,yaml-rust2,yaml-rust,libfyaml 2 | big.yaml,1644933464,2097747837,1642761913 3 | nested.yaml,1186706803,1461738560,1104480120 4 | small_objects.yaml,5459915062,5686715239,4402878726 5 | strings_array.yaml,1698194153,2044921291,924246153 6 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: yaml-test-suite Repository Testing 2 | 3 | on: 4 | push: 5 | pull_request: 6 | types: [opened] 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - run: make test 15 | # - uses: mxschmitt/action-tmate@v3 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/.gitignore: -------------------------------------------------------------------------------- 1 | /data/ 2 | /gh-pages/ 3 | /export.tsv 4 | /import.tsv 5 | /matrix/ 6 | /new/ 7 | /node_modules/ 8 | /testml/ 9 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/bin/new-test-id: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ( 4 | while true; do 5 | id=$( 6 | cat /dev/urandom | 7 | LC_ALL=C tr -cd A-HJ-NP-Z2-9 | 8 | fold -w4 | 9 | grep '[A-Z]' | 10 | grep '[0-9]' | 11 | head -n1 12 | ) 13 | 14 | [[ -e src/$id.yaml ]] || break 15 | done 16 | 17 | echo "$id" 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/bin/suite-to-data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #------------------------------------------------------------------------------ 4 | # 5 | # This program runs bin/suite-to-data.pl using Docker if the Perl module 6 | # dependencies are not installed locally. 7 | # 8 | #------------------------------------------------------------------------------ 9 | 10 | version=0.0.8 11 | 12 | RUN_OR_DOCKER_PULL=true 13 | 14 | source "${ROOT:-$PWD}/.bpan/run-or-docker.bash" 15 | 16 | check() ( 17 | need bash 4.4 18 | need perl 5.28 19 | need perl YAML::PP=0.030 20 | ) 21 | 22 | dockerfile() ( 23 | from alpine 24 | cpan YAML::PP@0.030 25 | ) 26 | 27 | run "$@" 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/bin/tsv-to-json: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use strict; use warnings; 4 | use JSON::PP; 5 | 6 | $_ = do { local $/; }; 7 | s/(?=[^\n])\z/\n/; 8 | 9 | my $rows = []; 10 | my $row = []; 11 | my $cell = ''; 12 | my $E = '(?=[\t\n]|\z)'; 13 | while (length != 0) { 14 | # warn ">>${\ substr($_, 0, 30)}<<\n"; 15 | if (s/^\t//) { 16 | push @$row, $cell; 17 | $cell = ''; 18 | next; 19 | } 20 | if (s/^\n//) { 21 | push @$row, $cell; 22 | $cell = ''; 23 | push @$rows, $row; 24 | $row = []; 25 | next; 26 | } 27 | if (s/\A"((?:""|.)*?)"$E//s) { 28 | $cell = $1; 29 | $cell =~ s/""/"/g; 30 | } 31 | elsif (s/\A(.*?)$E//) { 32 | $cell = $1; 33 | } 34 | else { 35 | die "failed to parse here >>${\ substr($_, 0, 80)}<<"; 36 | } 37 | } 38 | 39 | print JSON::PP->new->encode($rows); 40 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/236B.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid value after mapping 3 | from: '@perlpunk' 4 | tags: error mapping 5 | fail: true 6 | yaml: | 7 | foo: 8 | bar 9 | invalid 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :foo 15 | =VAL :bar 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/27NA.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.9. Directive Indicator 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2774058 4 | tags: spec directive 1.3-err 5 | yaml: | 6 | %YAML 1.2 7 | --- text 8 | tree: | 9 | +STR 10 | +DOC --- 11 | =VAL :text 12 | -DOC 13 | -STR 14 | json: | 15 | "text" 16 | dump: | 17 | --- text 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2AUY.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags in Block Sequence 3 | from: NimYAML tests 4 | tags: tag sequence 5 | yaml: |2 6 | - !!str a 7 | - b 8 | - !!int 42 9 | - d 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL :a 15 | =VAL :b 16 | =VAL :42 17 | =VAL :d 18 | -SEQ 19 | -DOC 20 | -STR 21 | json: | 22 | [ 23 | "a", 24 | "b", 25 | 42, 26 | "d" 27 | ] 28 | dump: | 29 | - !!str a 30 | - b 31 | - !!int 42 32 | - d 33 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2CMS.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid mapping in plain multiline 3 | from: '@perlpunk' 4 | tags: error mapping 5 | fail: true 6 | yaml: | 7 | this 8 | is 9 | invalid: x 10 | tree: | 11 | +STR 12 | +DOC 13 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2G84.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Literal modifers 3 | from: '@ingydotnet' 4 | tags: literal scalar 5 | fail: true 6 | yaml: | 7 | --- |0 8 | tree: | 9 | +STR 10 | +DOC --- 11 | 12 | - fail: true 13 | yaml: | 14 | --- |10 15 | 16 | - yaml: | 17 | --- |1-∎ 18 | tree: | 19 | +STR 20 | +DOC --- 21 | =VAL | 22 | -DOC 23 | -STR 24 | json: | 25 | "" 26 | emit: | 27 | --- "" 28 | 29 | - yaml: | 30 | --- |1+∎ 31 | tree: | 32 | +STR 33 | +DOC --- 34 | =VAL | 35 | -DOC 36 | -STR 37 | emit: | 38 | --- "" 39 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2JQS.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Mapping with Missing Keys 3 | from: NimYAML tests 4 | tags: duplicate-key mapping empty-key 5 | yaml: | 6 | : a 7 | : b 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL : 13 | =VAL :a 14 | =VAL : 15 | =VAL :b 16 | -MAP 17 | -DOC 18 | -STR 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2LFX.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.13. Reserved Directives [1.3] 3 | from: 6LVF, modified for YAML 1.3 4 | tags: spec directive header double 1.3-mod 5 | yaml: | 6 | %FOO bar baz # Should be ignored 7 | # with a warning. 8 | --- 9 | "foo" 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL "foo 14 | -DOC 15 | -STR 16 | json: | 17 | "foo" 18 | dump: | 19 | --- 20 | "foo" 21 | emit: | 22 | --- "foo" 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2SXE.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchors With Colon in Name 3 | from: Mailing List Discussion 4 | tags: alias edge mapping 1.3-err 5 | yaml: | 6 | &a: key: &a value 7 | foo: 8 | *a: 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL &a: :key 14 | =VAL &a :value 15 | =VAL :foo 16 | =ALI *a: 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "key": "value", 23 | "foo": "key" 24 | } 25 | dump: | 26 | &a: key: &a value 27 | foo: *a: 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/2XXW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.25. Unordered Sets 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2761758 4 | tags: spec mapping unknown-tag explicit-key 5 | yaml: | 6 | # Sets are represented as a 7 | # Mapping where each key is 8 | # associated with a null value 9 | --- !!set 10 | ? Mark McGwire 11 | ? Sammy Sosa 12 | ? Ken Griff 13 | tree: | 14 | +STR 15 | +DOC --- 16 | +MAP 17 | =VAL :Mark McGwire 18 | =VAL : 19 | =VAL :Sammy Sosa 20 | =VAL : 21 | =VAL :Ken Griff 22 | =VAL : 23 | -MAP 24 | -DOC 25 | -STR 26 | json: | 27 | { 28 | "Mark McGwire": null, 29 | "Sammy Sosa": null, 30 | "Ken Griff": null 31 | } 32 | dump: | 33 | --- !!set 34 | Mark McGwire: 35 | Sammy Sosa: 36 | Ken Griff: 37 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/33X3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Three explicit integers in a block sequence 3 | from: IRC 4 | tags: sequence tag 5 | yaml: | 6 | --- 7 | - !!int 1 8 | - !!int -2 9 | - !!int 33 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ 14 | =VAL :1 15 | =VAL :-2 16 | =VAL :33 17 | -SEQ 18 | -DOC 19 | -STR 20 | json: | 21 | [ 22 | 1, 23 | -2, 24 | 33 25 | ] 26 | dump: | 27 | --- 28 | - !!int 1 29 | - !!int -2 30 | - !!int 33 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/35KP.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags for Root Objects 3 | from: NimYAML tests 4 | tags: explicit-key header mapping tag 5 | yaml: | 6 | --- !!map 7 | ? a 8 | : b 9 | --- !!seq 10 | - !!str c 11 | --- !!str 12 | d 13 | e 14 | tree: | 15 | +STR 16 | +DOC --- 17 | +MAP 18 | =VAL :a 19 | =VAL :b 20 | -MAP 21 | -DOC 22 | +DOC --- 23 | +SEQ 24 | =VAL :c 25 | -SEQ 26 | -DOC 27 | +DOC --- 28 | =VAL :d e 29 | -DOC 30 | -STR 31 | json: | 32 | { 33 | "a": "b" 34 | } 35 | [ 36 | "c" 37 | ] 38 | "d e" 39 | dump: | 40 | --- !!map 41 | a: b 42 | --- !!seq 43 | - !!str c 44 | --- !!str d e 45 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/36F6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline plain scalar with empty line 3 | from: '@perlpunk' 4 | tags: mapping scalar 5 | yaml: | 6 | --- 7 | plain: a 8 | b 9 | 10 | c 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :plain 16 | =VAL :a b\nc 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "plain": "a b\nc" 23 | } 24 | dump: | 25 | --- 26 | plain: 'a b 27 | 28 | c' 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/3ALJ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Sequence in Block Sequence 3 | from: NimYAML tests 4 | tags: sequence 5 | yaml: | 6 | - - s1_i1 7 | - s1_i2 8 | - s2 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | +SEQ 14 | =VAL :s1_i1 15 | =VAL :s1_i2 16 | -SEQ 17 | =VAL :s2 18 | -SEQ 19 | -DOC 20 | -STR 21 | json: | 22 | [ 23 | [ 24 | "s1_i1", 25 | "s1_i2" 26 | ], 27 | "s2" 28 | ] 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/3GZX.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.1. Alias Nodes 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2786448 4 | tags: mapping spec alias 5 | yaml: | 6 | First occurrence: &anchor Foo 7 | Second occurrence: *anchor 8 | Override anchor: &anchor Bar 9 | Reuse anchor: *anchor 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :First occurrence 15 | =VAL &anchor :Foo 16 | =VAL :Second occurrence 17 | =ALI *anchor 18 | =VAL :Override anchor 19 | =VAL &anchor :Bar 20 | =VAL :Reuse anchor 21 | =ALI *anchor 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "First occurrence": "Foo", 28 | "Second occurrence": "Foo", 29 | "Override anchor": "Bar", 30 | "Reuse anchor": "Bar" 31 | } 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/3HFZ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid content after document end marker 3 | from: '@perlpunk' 4 | tags: error footer 5 | fail: true 6 | yaml: | 7 | --- 8 | key: value 9 | ... invalid 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +MAP 14 | =VAL :key 15 | =VAL :value 16 | -MAP 17 | -DOC ... 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/3MYT.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Plain Scalar looking like key, comment, anchor and tag 3 | from: https://gist.github.com/anonymous/a98d50ce42a59b1e999552bea7a31f57 via @ingydotnet 4 | tags: scalar 5 | yaml: | 6 | --- 7 | k:#foo 8 | &a !t s 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL :k:#foo &a !t s 13 | -DOC 14 | -STR 15 | json: | 16 | "k:#foo &a !t s" 17 | dump: | 18 | --- k:#foo &a !t s 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/3R3P.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Single block sequence with anchor 3 | from: '@perlpunk' 4 | tags: anchor sequence 5 | yaml: | 6 | &sequence 7 | - a 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ &sequence 12 | =VAL :a 13 | -SEQ 14 | -DOC 15 | -STR 16 | json: | 17 | [ 18 | "a" 19 | ] 20 | dump: | 21 | &sequence 22 | - a 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/3UYS.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Escaped slash in double quotes 3 | from: '@perlpunk' 4 | tags: double 5 | yaml: | 6 | escaped slash: "a\/b" 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP 11 | =VAL :escaped slash 12 | =VAL "a/b 13 | -MAP 14 | -DOC 15 | -STR 16 | json: | 17 | { 18 | "escaped slash": "a/b" 19 | } 20 | dump: | 21 | escaped slash: "a/b" 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4ABK.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Mapping Separate Values 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2791704 4 | tags: flow mapping 5 | yaml: | 6 | { 7 | unquoted : "separate", 8 | http://foo.com, 9 | omitted value:, 10 | } 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP {} 15 | =VAL :unquoted 16 | =VAL "separate 17 | =VAL :http://foo.com 18 | =VAL : 19 | =VAL :omitted value 20 | =VAL : 21 | -MAP 22 | -DOC 23 | -STR 24 | dump: | 25 | unquoted: "separate" 26 | http://foo.com: null 27 | omitted value: null 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4CQQ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.18. Multi-line Flow Scalars 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2761268 4 | tags: spec scalar 5 | yaml: | 6 | plain: 7 | This unquoted scalar 8 | spans many lines. 9 | 10 | quoted: "So does this 11 | quoted scalar.\n" 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :plain 17 | =VAL :This unquoted scalar spans many lines. 18 | =VAL :quoted 19 | =VAL "So does this quoted scalar.\n 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "plain": "This unquoted scalar spans many lines.", 26 | "quoted": "So does this quoted scalar.\n" 27 | } 28 | dump: | 29 | plain: This unquoted scalar spans many lines. 30 | quoted: "So does this quoted scalar.\n" 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4EJS.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid tabs as indendation in a mapping 3 | from: https://github.com/nodeca/js-yaml/issues/80 4 | tags: error mapping whitespace 5 | fail: true 6 | yaml: | 7 | --- 8 | a: 9 | ———»b: 10 | ———»———»c: value 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :a 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4FJ6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nested implicit complex keys 3 | from: '@perlpunk' 4 | tags: complex-key flow mapping sequence 5 | yaml: | 6 | --- 7 | [ 8 | [ a, [ [[b,c]]: d, e]]: 23 9 | ] 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ [] 14 | +MAP {} 15 | +SEQ [] 16 | =VAL :a 17 | +SEQ [] 18 | +MAP {} 19 | +SEQ [] 20 | +SEQ [] 21 | =VAL :b 22 | =VAL :c 23 | -SEQ 24 | -SEQ 25 | =VAL :d 26 | -MAP 27 | =VAL :e 28 | -SEQ 29 | -SEQ 30 | =VAL :23 31 | -MAP 32 | -SEQ 33 | -DOC 34 | -STR 35 | dump: | 36 | --- 37 | - ? - a 38 | - - ? - - b 39 | - c 40 | : d 41 | - e 42 | : 23 43 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4GC6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.7. Single Quoted Characters 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2788307 4 | tags: spec scalar 1.3-err 5 | yaml: | 6 | 'here''s to "quotes"' 7 | tree: | 8 | +STR 9 | +DOC 10 | =VAL 'here's to "quotes" 11 | -DOC 12 | -STR 13 | json: | 14 | "here's to \"quotes\"" 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4H7K.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow sequence with invalid extra closing bracket 3 | from: '@perlpunk' 4 | tags: error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ a, b, c ] ] 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ 13 | =VAL :a 14 | =VAL :b 15 | =VAL :c 16 | -SEQ 17 | -DOC 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4HVU.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wrong indendation in Sequence 3 | from: '@perlpunk' 4 | tags: error sequence indent 5 | fail: true 6 | yaml: | 7 | key: 8 | - ok 9 | - also ok 10 | - wrong 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :key 16 | +SEQ 17 | =VAL :ok 18 | =VAL :also ok 19 | -SEQ 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4JVG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Scalar value with two anchors 3 | from: '@perlpunk' 4 | tags: anchor error mapping 5 | fail: true 6 | yaml: | 7 | top1: &node1 8 | &k1 key1: val1 9 | top2: &node2 10 | &v2 val2 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :top1 16 | +MAP &node1 17 | =VAL &k1 :key1 18 | =VAL :val1 19 | -MAP 20 | =VAL :top2 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4MUZ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow mapping colon on line after key 3 | from: '@ingydotnet' 4 | tags: flow mapping 5 | yaml: | 6 | {"foo" 7 | : "bar"} 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP {} 12 | =VAL "foo 13 | =VAL "bar 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "foo": "bar" 20 | } 21 | emit: | 22 | "foo": "bar" 23 | 24 | - yaml: | 25 | {"foo" 26 | : bar} 27 | tree: | 28 | +STR 29 | +DOC 30 | +MAP {} 31 | =VAL "foo 32 | =VAL :bar 33 | -MAP 34 | -DOC 35 | -STR 36 | emit: | 37 | "foo": bar 38 | 39 | - yaml: | 40 | {foo 41 | : bar} 42 | tree: | 43 | +STR 44 | +DOC 45 | +MAP {} 46 | =VAL :foo 47 | =VAL :bar 48 | -MAP 49 | -DOC 50 | -STR 51 | json: | 52 | { 53 | "foo": "bar" 54 | } 55 | emit: | 56 | foo: bar 57 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4Q9F.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Folded Block Scalar [1.3] 3 | from: TS54, modified for YAML 1.3 4 | tags: folded scalar 1.3-mod whitespace 5 | yaml: | 6 | --- > 7 | ab 8 | cd 9 | ␣ 10 | ef 11 | 12 | 13 | gh 14 | tree: | 15 | +STR 16 | +DOC --- 17 | =VAL >ab cd\nef\n\ngh\n 18 | -DOC 19 | -STR 20 | json: | 21 | "ab cd\nef\n\ngh\n" 22 | dump: | 23 | --- > 24 | ab cd 25 | 26 | ef 27 | 28 | 29 | gh 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4QFQ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.2. Block Indentation Indicator [1.3] 3 | from: R4YG, modified for YAML 1.3 4 | tags: spec literal folded scalar libyaml-err 1.3-mod whitespace 5 | yaml: | 6 | - | 7 | detected 8 | - > 9 | ␣ 10 | ␣␣ 11 | # detected 12 | - |1 13 | explicit 14 | - > 15 | detected 16 | tree: | 17 | +STR 18 | +DOC 19 | +SEQ 20 | =VAL |detected\n 21 | =VAL >\n\n# detected\n 22 | =VAL | explicit\n 23 | =VAL >detected\n 24 | -SEQ 25 | -DOC 26 | -STR 27 | json: | 28 | [ 29 | "detected\n", 30 | "\n\n# detected\n", 31 | " explicit\n", 32 | "detected\n" 33 | ] 34 | emit: | 35 | - | 36 | detected 37 | - >2 38 | 39 | 40 | # detected 41 | - |2 42 | explicit 43 | - > 44 | detected 45 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4RWC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Trailing spaces after flow collection 3 | tags: flow whitespace 4 | from: '@ingydotnet' 5 | yaml: |2 6 | [1, 2, 3]␣␣ 7 | ␣␣∎ 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ [] 12 | =VAL :1 13 | =VAL :2 14 | =VAL :3 15 | -SEQ 16 | -DOC 17 | -STR 18 | json: | 19 | [ 20 | 1, 21 | 2, 22 | 3 23 | ] 24 | dump: | 25 | - 1 26 | - 2 27 | - 3 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4UYU.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Colon in Double Quoted String 3 | from: NimYAML tests 4 | tags: mapping scalar 1.3-err 5 | yaml: | 6 | "foo: bar\": baz" 7 | tree: | 8 | +STR 9 | +DOC 10 | =VAL "foo: bar": baz 11 | -DOC 12 | -STR 13 | json: | 14 | "foo: bar\": baz" 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4V8U.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Plain scalar with backslashes 3 | from: '@perlpunk' 4 | tags: scalar 5 | yaml: | 6 | --- 7 | plain\value\with\backslashes 8 | tree: | 9 | +STR 10 | +DOC --- 11 | =VAL :plain\\value\\with\\backslashes 12 | -DOC 13 | -STR 14 | json: | 15 | "plain\\value\\with\\backslashes" 16 | dump: | 17 | --- plain\value\with\backslashes 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4WA9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Literal scalars 3 | from: '@ingydotnet' 4 | tags: indent literal 5 | yaml: | 6 | - aaa: |2 7 | xxx 8 | bbb: | 9 | xxx 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | +MAP 15 | =VAL :aaa 16 | =VAL |xxx\n 17 | =VAL :bbb 18 | =VAL |xxx\n 19 | -MAP 20 | -SEQ 21 | -DOC 22 | -STR 23 | json: | 24 | [ 25 | { 26 | "aaa" : "xxx\n", 27 | "bbb" : "xxx\n" 28 | } 29 | ] 30 | dump: | 31 | --- 32 | - aaa: | 33 | xxx 34 | bbb: | 35 | xxx 36 | emit: | 37 | - aaa: | 38 | xxx 39 | bbb: | 40 | xxx 41 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/4ZYM.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.4. Line Prefixes 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2778720 4 | tags: spec scalar literal double upto-1.2 whitespace 5 | yaml: | 6 | plain: text 7 | lines 8 | quoted: "text 9 | —»lines" 10 | block: | 11 | text 12 | »lines 13 | tree: | 14 | +STR 15 | +DOC 16 | +MAP 17 | =VAL :plain 18 | =VAL :text lines 19 | =VAL :quoted 20 | =VAL "text lines 21 | =VAL :block 22 | =VAL |text\n \tlines\n 23 | -MAP 24 | -DOC 25 | -STR 26 | json: | 27 | { 28 | "plain": "text lines", 29 | "quoted": "text lines", 30 | "block": "text\n \tlines\n" 31 | } 32 | dump: | 33 | plain: text lines 34 | quoted: "text lines" 35 | block: "text\n \tlines\n" 36 | emit: | 37 | plain: text lines 38 | quoted: "text lines" 39 | block: | 40 | text 41 | »lines 42 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/52DL.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Explicit Non-Specific Tag [1.3] 3 | from: 8MK2, modified for YAML 1.3 4 | tags: tag 1.3-mod 5 | yaml: | 6 | --- 7 | ! a 8 | tree: | 9 | +STR 10 | +DOC --- 11 | =VAL :a 12 | -DOC 13 | -STR 14 | json: | 15 | "a" 16 | dump: | 17 | --- ! a 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/54T7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Mapping 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/mapping.tml 4 | tags: flow mapping 5 | yaml: | 6 | {foo: you, bar: far} 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP {} 11 | =VAL :foo 12 | =VAL :you 13 | =VAL :bar 14 | =VAL :far 15 | -MAP 16 | -DOC 17 | -STR 18 | json: | 19 | { 20 | "foo": "you", 21 | "bar": "far" 22 | } 23 | dump: | 24 | foo: you 25 | bar: far 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/55WF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid escape in double quoted string 3 | from: '@perlpunk' 4 | tags: error double 5 | fail: true 6 | yaml: | 7 | --- 8 | "\." 9 | tree: | 10 | +STR 11 | +DOC --- 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/58MP.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow mapping edge cases 3 | from: '@ingydotnet' 4 | tags: edge flow mapping 5 | yaml: | 6 | {x: :x} 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP {} 11 | =VAL :x 12 | =VAL ::x 13 | -MAP 14 | -DOC 15 | -STR 16 | json: | 17 | { 18 | "x": ":x" 19 | } 20 | dump: | 21 | x: :x 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5BVJ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.7. Block Scalar Indicators 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2773653 4 | tags: spec literal folded scalar 5 | yaml: | 6 | literal: | 7 | some 8 | text 9 | folded: > 10 | some 11 | text 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :literal 17 | =VAL |some\ntext\n 18 | =VAL :folded 19 | =VAL >some text\n 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "literal": "some\ntext\n", 26 | "folded": "some text\n" 27 | } 28 | dump: | 29 | literal: | 30 | some 31 | text 32 | folded: > 33 | some text 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5C5M.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.15. Flow Mappings 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2791018 4 | tags: spec flow mapping 5 | yaml: | 6 | - { one : two , three: four , } 7 | - {five: six,seven : eight} 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | +MAP {} 13 | =VAL :one 14 | =VAL :two 15 | =VAL :three 16 | =VAL :four 17 | -MAP 18 | +MAP {} 19 | =VAL :five 20 | =VAL :six 21 | =VAL :seven 22 | =VAL :eight 23 | -MAP 24 | -SEQ 25 | -DOC 26 | -STR 27 | json: | 28 | [ 29 | { 30 | "one": "two", 31 | "three": "four" 32 | }, 33 | { 34 | "five": "six", 35 | "seven": "eight" 36 | } 37 | ] 38 | dump: | 39 | - one: two 40 | three: four 41 | - five: six 42 | seven: eight 43 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5GBF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.5. Empty Lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2778971 4 | tags: double literal spec scalar upto-1.2 whitespace 5 | yaml: | 6 | Folding: 7 | "Empty line 8 | » 9 | as a line feed" 10 | Chomping: | 11 | Clipped empty lines 12 | ␣ 13 | ↵ 14 | tree: | 15 | +STR 16 | +DOC 17 | +MAP 18 | =VAL :Folding 19 | =VAL "Empty line\nas a line feed 20 | =VAL :Chomping 21 | =VAL |Clipped empty lines\n 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "Folding": "Empty line\nas a line feed", 28 | "Chomping": "Clipped empty lines\n" 29 | } 30 | dump: | 31 | Folding: "Empty line\nas a line feed" 32 | Chomping: | 33 | Clipped empty lines 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5KJE.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.13. Flow Sequence 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2790506 4 | tags: spec flow sequence 5 | yaml: | 6 | - [ one, two, ] 7 | - [three ,four] 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | +SEQ [] 13 | =VAL :one 14 | =VAL :two 15 | -SEQ 16 | +SEQ [] 17 | =VAL :three 18 | =VAL :four 19 | -SEQ 20 | -SEQ 21 | -DOC 22 | -STR 23 | json: | 24 | [ 25 | [ 26 | "one", 27 | "two" 28 | ], 29 | [ 30 | "three", 31 | "four" 32 | ] 33 | ] 34 | dump: | 35 | - - one 36 | - two 37 | - - three 38 | - four 39 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5LLU.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block scalar with wrong indented line after spaces only 3 | from: '@perlpunk' 4 | tags: error folded whitespace 5 | fail: true 6 | yaml: | 7 | block scalar: > 8 | ␣ 9 | ␣␣ 10 | ␣␣␣ 11 | invalid 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :block scalar 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5MUD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Colon and adjacent value on next line 3 | from: '@perlpunk' 4 | tags: double flow mapping 5 | yaml: | 6 | --- 7 | { "foo" 8 | :bar } 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP {} 13 | =VAL "foo 14 | =VAL :bar 15 | -MAP 16 | -DOC 17 | -STR 18 | json: | 19 | { 20 | "foo": "bar" 21 | } 22 | dump: | 23 | --- 24 | "foo": bar 25 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5NYZ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.9. Separated Comment 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2780342 4 | tags: mapping spec comment 5 | yaml: | 6 | key: # Comment 7 | value 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :key 13 | =VAL :value 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "key": "value" 20 | } 21 | dump: | 22 | key: value 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5T43.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Colon at the beginning of adjacent flow scalar 3 | from: '@perlpunk' 4 | tags: flow mapping scalar 5 | yaml: | 6 | - { "key":value } 7 | - { "key"::value } 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | +MAP {} 13 | =VAL "key 14 | =VAL :value 15 | -MAP 16 | +MAP {} 17 | =VAL "key 18 | =VAL ::value 19 | -MAP 20 | -SEQ 21 | -DOC 22 | -STR 23 | json: | 24 | [ 25 | { 26 | "key": "value" 27 | }, 28 | { 29 | "key": ":value" 30 | } 31 | ] 32 | dump: | 33 | - key: value 34 | - key: :value 35 | emit: | 36 | - "key": value 37 | - "key": :value 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5TRB.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid document-start marker in doublequoted tring 3 | from: '@perlpunk' 4 | tags: header double error 5 | fail: true 6 | yaml: | 7 | --- 8 | " 9 | --- 10 | " 11 | tree: | 12 | +STR 13 | +DOC --- 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5TYM.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.21. Local Tag Prefix 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2783499 4 | tags: local-tag spec directive tag 5 | yaml: | 6 | %TAG !m! !my- 7 | --- # Bulb here 8 | !m!light fluorescent 9 | ... 10 | %TAG !m! !my- 11 | --- # Color here 12 | !m!light green 13 | tree: | 14 | +STR 15 | +DOC --- 16 | =VAL :fluorescent 17 | -DOC ... 18 | +DOC --- 19 | =VAL :green 20 | -DOC 21 | -STR 22 | json: | 23 | "fluorescent" 24 | "green" 25 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5U3A.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Sequence on same Line as Mapping Key 3 | from: '@perlpunk' 4 | tags: error sequence mapping 5 | fail: true 6 | yaml: | 7 | key: - a 8 | - b 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :key 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/5WE3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.17. Explicit Block Mapping Entries 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2798425 4 | tags: explicit-key spec mapping comment literal sequence 5 | yaml: | 6 | ? explicit key # Empty value 7 | ? | 8 | block key 9 | : - one # Explicit compact 10 | - two # block value 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :explicit key 16 | =VAL : 17 | =VAL |block key\n 18 | +SEQ 19 | =VAL :one 20 | =VAL :two 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "explicit key": null, 28 | "block key\n": [ 29 | "one", 30 | "two" 31 | ] 32 | } 33 | dump: | 34 | explicit key: 35 | ? | 36 | block key 37 | : - one 38 | - two 39 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/62EZ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid block mapping key on same line as previous key 3 | from: '@perlpunk' 4 | tags: error flow mapping 5 | fail: true 6 | yaml: | 7 | --- 8 | x: { y: z }in: valid 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP 13 | =VAL :x 14 | +MAP {} 15 | =VAL :y 16 | =VAL :z 17 | -MAP 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/652Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Question mark at start of flow key 3 | from: '@ingydotnet' 4 | tags: flow 5 | yaml: | 6 | { ?foo: bar, 7 | bar: 42 8 | } 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP {} 13 | =VAL :?foo 14 | =VAL :bar 15 | =VAL :bar 16 | =VAL :42 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "?foo" : "bar", 23 | "bar" : 42 24 | } 25 | dump: | 26 | --- 27 | ?foo: bar 28 | bar: 42 29 | emit: | 30 | ?foo: bar 31 | bar: 42 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/65WH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Single Entry Block Sequence 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/sequence.tml 4 | tags: sequence 5 | yaml: | 6 | - foo 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ 11 | =VAL :foo 12 | -SEQ 13 | -DOC 14 | -STR 15 | json: | 16 | [ 17 | "foo" 18 | ] 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6BCT.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.3. Separation Spaces 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2778394 4 | tags: spec libyaml-err sequence whitespace upto-1.2 5 | yaml: | 6 | - foo:—» bar 7 | - - baz 8 | -»baz 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | +MAP 14 | =VAL :foo 15 | =VAL :bar 16 | -MAP 17 | +SEQ 18 | =VAL :baz 19 | =VAL :baz 20 | -SEQ 21 | -SEQ 22 | -DOC 23 | -STR 24 | json: | 25 | [ 26 | { 27 | "foo": "bar" 28 | }, 29 | [ 30 | "baz", 31 | "baz" 32 | ] 33 | ] 34 | dump: | 35 | - foo: bar 36 | - - baz 37 | - baz 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6BFJ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Mapping, key and flow sequence item anchors 3 | from: '@perlpunk' 4 | tags: anchor complex-key flow mapping sequence 5 | yaml: | 6 | --- 7 | &mapping 8 | &key [ &item a, b, c ]: value 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP &mapping 13 | +SEQ [] &key 14 | =VAL &item :a 15 | =VAL :b 16 | =VAL :c 17 | -SEQ 18 | =VAL :value 19 | -MAP 20 | -DOC 21 | -STR 22 | dump: | 23 | --- &mapping 24 | ? &key 25 | - &item a 26 | - b 27 | - c 28 | : value 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6CA3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tab indented top flow 3 | from: '@ingydotnet' 4 | tags: indent whitespace 5 | yaml: | 6 | ————»[ 7 | ————»] 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ [] 12 | -SEQ 13 | -DOC 14 | -STR 15 | json: | 16 | [] 17 | emit: | 18 | --- [] 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6CK3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.26. Tag Shorthands 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2785009 4 | tags: spec tag local-tag 5 | yaml: | 6 | %TAG !e! tag:example.com,2000:app/ 7 | --- 8 | - !local foo 9 | - !!str bar 10 | - !e!tag%21 baz 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +SEQ 15 | =VAL :foo 16 | =VAL :bar 17 | =VAL :baz 18 | -SEQ 19 | -DOC 20 | -STR 21 | json: | 22 | [ 23 | "foo", 24 | "bar", 25 | "baz" 26 | ] 27 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6FWR.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Scalar Keep 3 | from: NimYAML tests 4 | tags: literal scalar whitespace 5 | yaml: | 6 | --- |+ 7 | ab 8 | ␣ 9 | ␣␣ 10 | ... 11 | tree: | 12 | +STR 13 | +DOC --- 14 | =VAL |ab\n\n \n 15 | -DOC ... 16 | -STR 17 | json: | 18 | "ab\n\n \n" 19 | dump: | 20 | "ab\n\n \n" 21 | ... 22 | emit: | 23 | --- | 24 | ab 25 | 26 | ␣␣␣ 27 | ... 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6H3V.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Backslashes in singlequotes 3 | from: '@perlpunk' 4 | tags: scalar single 5 | yaml: | 6 | 'foo: bar\': baz' 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP 11 | =VAL 'foo: bar\\ 12 | =VAL :baz' 13 | -MAP 14 | -DOC 15 | -STR 16 | json: | 17 | { 18 | "foo: bar\\": "baz'" 19 | } 20 | dump: | 21 | 'foo: bar\': baz' 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6JQW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.13. In literals, newlines are preserved 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2759963 4 | tags: spec scalar literal comment 5 | yaml: | 6 | # ASCII Art 7 | --- | 8 | \//||\/|| 9 | // || ||__ 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL |\\//||\\/||\n// || ||__\n 14 | -DOC 15 | -STR 16 | json: | 17 | "\\//||\\/||\n// || ||__\n" 18 | dump: | 19 | --- | 20 | \//||\/|| 21 | // || ||__ 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6JTT.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow sequence without closing bracket 3 | from: '@perlpunk' 4 | tags: error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ [ a, b, c ] 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ [] 13 | +SEQ [] 14 | =VAL :a 15 | =VAL :b 16 | =VAL :c 17 | -SEQ 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6JWB.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags for Block Objects 3 | from: NimYAML tests 4 | tags: mapping sequence tag 5 | yaml: | 6 | foo: !!seq 7 | - !!str a 8 | - !!map 9 | key: !!str value 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :foo 15 | +SEQ 16 | =VAL :a 17 | +MAP 18 | =VAL :key 19 | =VAL :value 20 | -MAP 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "foo": [ 28 | "a", 29 | { 30 | "key": "value" 31 | } 32 | ] 33 | } 34 | dump: | 35 | foo: !!seq 36 | - !!str a 37 | - !!map 38 | key: !!str value 39 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6KGN.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor for empty node 3 | from: https://github.com/nodeca/js-yaml/issues/301 4 | tags: alias anchor 5 | yaml: | 6 | --- 7 | a: &anchor 8 | b: *anchor 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP 13 | =VAL :a 14 | =VAL &anchor : 15 | =VAL :b 16 | =ALI *anchor 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "a": null, 23 | "b": null 24 | } 25 | dump: | 26 | --- 27 | a: &anchor 28 | b: *anchor 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6LVF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.13. Reserved Directives 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2781445 4 | tags: spec directive header double 1.3-err 5 | yaml: | 6 | %FOO bar baz # Should be ignored 7 | # with a warning. 8 | --- "foo" 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL "foo 13 | -DOC 14 | -STR 15 | json: | 16 | "foo" 17 | dump: | 18 | --- "foo" 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6M2F.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Aliases in Explicit Block Mapping 3 | from: NimYAML tests 4 | tags: alias explicit-key empty-key 5 | yaml: | 6 | ? &a a 7 | : &b b 8 | : *a 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL &a :a 14 | =VAL &b :b 15 | =VAL : 16 | =ALI *a 17 | -MAP 18 | -DOC 19 | -STR 20 | dump: | 21 | &a a: &b b 22 | : *a 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6PBE.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Zero-indented sequences in explicit mapping keys 3 | from: '@perlpunk' 4 | tags: explicit-key mapping sequence 5 | yaml: | 6 | --- 7 | ? 8 | - a 9 | - b 10 | : 11 | - c 12 | - d 13 | tree: | 14 | +STR 15 | +DOC --- 16 | +MAP 17 | +SEQ 18 | =VAL :a 19 | =VAL :b 20 | -SEQ 21 | +SEQ 22 | =VAL :c 23 | =VAL :d 24 | -SEQ 25 | -MAP 26 | -DOC 27 | -STR 28 | emit: | 29 | --- 30 | ? - a 31 | - b 32 | : - c 33 | - d 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6S55.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid scalar at the end of sequence 3 | from: '@perlpunk' 4 | tags: error mapping sequence 5 | fail: true 6 | yaml: | 7 | key: 8 | - bar 9 | - baz 10 | invalid 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :key 16 | +SEQ 17 | =VAL :bar 18 | =VAL :baz 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6SLA.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Allowed characters in quoted mapping key 3 | from: '@perlpunk' 4 | tags: mapping single double 5 | yaml: | 6 | "foo\nbar:baz\tx \\$%^&*()x": 23 7 | 'x\ny:z\tx $%^&*()x': 24 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL "foo\nbar:baz\tx \\$%^&*()x 13 | =VAL :23 14 | =VAL 'x\\ny:z\\tx $%^&*()x 15 | =VAL :24 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "foo\nbar:baz\tx \\$%^&*()x": 23, 22 | "x\\ny:z\\tx $%^&*()x": 24 23 | } 24 | dump: | 25 | ? "foo\nbar:baz\tx \\$%^&*()x" 26 | : 23 27 | 'x\ny:z\tx $%^&*()x': 24 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6VJK.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.15. Folded newlines are preserved for "more indented" and blank lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2761056 4 | tags: spec folded scalar 1.3-err 5 | yaml: | 6 | > 7 | Sammy Sosa completed another 8 | fine season with great stats. 9 | 10 | 63 Home Runs 11 | 0.288 Batting Average 12 | 13 | What a year! 14 | tree: | 15 | +STR 16 | +DOC 17 | =VAL >Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n 18 | -DOC 19 | -STR 20 | json: | 21 | "Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n" 22 | dump: | 23 | > 24 | Sammy Sosa completed another fine season with great stats. 25 | 26 | 63 Home Runs 27 | 0.288 Batting Average 28 | 29 | What a year! 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6WLZ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.18. Primary Tag Handle [1.3] 3 | from: 9WXW, modified for YAML 1.3 4 | tags: local-tag spec directive tag 1.3-mod 5 | yaml: | 6 | # Private 7 | --- 8 | !foo "bar" 9 | ... 10 | # Global 11 | %TAG ! tag:example.com,2000:app/ 12 | --- 13 | !foo "bar" 14 | tree: | 15 | +STR 16 | +DOC --- 17 | =VAL "bar 18 | -DOC ... 19 | +DOC --- 20 | =VAL "bar 21 | -DOC 22 | -STR 23 | json: | 24 | "bar" 25 | "bar" 26 | dump: | 27 | --- 28 | !foo "bar" 29 | ... 30 | --- ! 31 | "bar" 32 | emit: | 33 | --- !foo "bar" 34 | ... 35 | --- ! "bar" 36 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6WPF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.8. Flow Folding [1.3] 3 | from: TL85, modified for YAML 1.3 4 | tags: double spec whitespace scalar 1.3-mod 5 | yaml: | 6 | --- 7 | " 8 | foo␣ 9 | ␣ 10 | bar 11 | 12 | baz 13 | " 14 | tree: | 15 | +STR 16 | +DOC --- 17 | =VAL " foo\nbar\nbaz␣ 18 | -DOC 19 | -STR 20 | json: | 21 | " foo\nbar\nbaz " 22 | dump: | 23 | " foo\nbar\nbaz " 24 | emit: | 25 | --- " foo\nbar\nbaz " 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6XDY.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Two document start markers 3 | from: '@perlpunk' 4 | tags: header 5 | yaml: | 6 | --- 7 | --- 8 | tree: | 9 | +STR 10 | +DOC --- 11 | =VAL : 12 | -DOC 13 | +DOC --- 14 | =VAL : 15 | -DOC 16 | -STR 17 | json: | 18 | null 19 | null 20 | dump: | 21 | --- 22 | --- 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/6ZKB.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 9.6. Stream 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2801896 4 | tags: spec header 1.3-err 5 | yaml: | 6 | Document 7 | --- 8 | # Empty 9 | ... 10 | %YAML 1.2 11 | --- 12 | matches %: 20 13 | tree: | 14 | +STR 15 | +DOC 16 | =VAL :Document 17 | -DOC 18 | +DOC --- 19 | =VAL : 20 | -DOC ... 21 | +DOC --- 22 | +MAP 23 | =VAL :matches % 24 | =VAL :20 25 | -MAP 26 | -DOC 27 | -STR 28 | json: | 29 | "Document" 30 | null 31 | { 32 | "matches %": 20 33 | } 34 | emit: | 35 | Document 36 | --- 37 | ... 38 | %YAML 1.2 39 | --- 40 | matches %: 20 41 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/735Y.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.20. Block Node Types 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2799426 4 | tags: comment double spec folded tag 5 | yaml: | 6 | - 7 | "flow in block" 8 | - > 9 | Block scalar 10 | - !!map # Block collection 11 | foo : bar 12 | tree: | 13 | +STR 14 | +DOC 15 | +SEQ 16 | =VAL "flow in block 17 | =VAL >Block scalar\n 18 | +MAP 19 | =VAL :foo 20 | =VAL :bar 21 | -MAP 22 | -SEQ 23 | -DOC 24 | -STR 25 | json: | 26 | [ 27 | "flow in block", 28 | "Block scalar\n", 29 | { 30 | "foo": "bar" 31 | } 32 | ] 33 | dump: | 34 | - "flow in block" 35 | - > 36 | Block scalar 37 | - !!map 38 | foo: bar 39 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/74H7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags in Implicit Mapping 3 | from: NimYAML tests 4 | tags: tag mapping 5 | yaml: | 6 | !!str a: b 7 | c: !!int 42 8 | e: !!str f 9 | g: h 10 | !!str 23: !!bool false 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :a 16 | =VAL :b 17 | =VAL :c 18 | =VAL :42 19 | =VAL :e 20 | =VAL :f 21 | =VAL :g 22 | =VAL :h 23 | =VAL :23 24 | =VAL :false 25 | -MAP 26 | -DOC 27 | -STR 28 | json: | 29 | { 30 | "a": "b", 31 | "c": 42, 32 | "e": "f", 33 | "g": "h", 34 | "23": false 35 | } 36 | dump: | 37 | !!str a: b 38 | c: !!int 42 39 | e: !!str f 40 | g: h 41 | !!str 23: !!bool false 42 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/753E.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Scalar Strip [1.3] 3 | from: MYW6, modified for YAML 1.3 4 | tags: literal scalar 1.3-mod whitespace 5 | yaml: | 6 | --- |- 7 | ab 8 | ␣ 9 | ␣ 10 | ... 11 | tree: | 12 | +STR 13 | +DOC --- 14 | =VAL |ab 15 | -DOC ... 16 | -STR 17 | json: | 18 | "ab" 19 | dump: | 20 | --- |- 21 | ab 22 | ... 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7A4E.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.6. Double Quoted Lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2787994 4 | tags: spec scalar upto-1.2 whitespace 5 | yaml: | 6 | " 1st non-empty 7 | 8 | 2nd non-empty␣ 9 | ———»3rd non-empty " 10 | tree: | 11 | +STR 12 | +DOC 13 | =VAL " 1st non-empty\n2nd non-empty 3rd non-empty␣ 14 | -DOC 15 | -STR 16 | json: | 17 | " 1st non-empty\n2nd non-empty 3rd non-empty " 18 | dump: | 19 | " 1st non-empty\n2nd non-empty 3rd non-empty " 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7FWL.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.24. Verbatim Tags 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2784370 4 | tags: mapping spec tag unknown-tag 5 | yaml: | 6 | ! foo : 7 | ! baz 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :foo 13 | =VAL :baz 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "foo": "baz" 20 | } 21 | dump: | 22 | !!str foo: !bar baz 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7LBH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline double quoted implicit keys 3 | from: '@perlpunk' 4 | tags: error double 5 | fail: true 6 | yaml: | 7 | "a\nb": 1 8 | "c 9 | d": 1 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL "a\nb 15 | =VAL :1 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7MNF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Missing colon 3 | from: '@perlpunk' 4 | tags: error mapping 5 | fail: true 6 | yaml: | 7 | top1: 8 | key1: val1 9 | top2 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :top1 15 | +MAP 16 | =VAL :key1 17 | =VAL :val1 18 | -MAP 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7T8X.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.10. Folded Lines - 8.13. Final Empty Lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2796543 4 | tags: spec folded scalar comment 1.3-err 5 | yaml: | 6 | > 7 | 8 | folded 9 | line 10 | 11 | next 12 | line 13 | * bullet 14 | 15 | * list 16 | * lines 17 | 18 | last 19 | line 20 | 21 | # Comment 22 | tree: | 23 | +STR 24 | +DOC 25 | =VAL >\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n 26 | -DOC 27 | -STR 28 | json: | 29 | "\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n" 30 | dump: | 31 | > 32 | 33 | folded line 34 | 35 | next line 36 | * bullet 37 | 38 | * list 39 | * lines 40 | 41 | last line 42 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7TMG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment in flow sequence before comma 3 | from: '@perlpunk' 4 | tags: comment flow sequence 5 | yaml: | 6 | --- 7 | [ word1 8 | # comment 9 | , word2] 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ [] 14 | =VAL :word1 15 | =VAL :word2 16 | -SEQ 17 | -DOC 18 | -STR 19 | json: | 20 | [ 21 | "word1", 22 | "word2" 23 | ] 24 | dump: | 25 | --- 26 | - word1 27 | - word2 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7W2P.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Mapping with Missing Values 3 | from: NimYAML tests 4 | tags: explicit-key mapping 5 | yaml: | 6 | ? a 7 | ? b 8 | c: 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :a 14 | =VAL : 15 | =VAL :b 16 | =VAL : 17 | =VAL :c 18 | =VAL : 19 | -MAP 20 | -DOC 21 | -STR 22 | json: | 23 | { 24 | "a": null, 25 | "b": null, 26 | "c": null 27 | } 28 | dump: | 29 | a: 30 | b: 31 | c: 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/7Z25.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Bare document after document end marker 3 | from: '@perlpunk' 4 | tags: footer 5 | yaml: | 6 | --- 7 | scalar1 8 | ... 9 | key: value 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL :scalar1 14 | -DOC ... 15 | +DOC 16 | +MAP 17 | =VAL :key 18 | =VAL :value 19 | -MAP 20 | -DOC 21 | -STR 22 | json: | 23 | "scalar1" 24 | { 25 | "key": "value" 26 | } 27 | dump: | 28 | --- scalar1 29 | ... 30 | key: value 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/82AN.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Three dashes and content without space 3 | from: '@perlpunk' 4 | tags: scalar 1.3-err 5 | yaml: | 6 | ---word1 7 | word2 8 | tree: | 9 | +STR 10 | +DOC 11 | =VAL :---word1 word2 12 | -DOC 13 | -STR 14 | json: | 15 | "---word1 word2" 16 | dump: | 17 | '---word1 word2' 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/87E4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.8. Single Quoted Implicit Keys 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2788496 4 | tags: spec flow sequence mapping 5 | yaml: | 6 | 'implicit block key' : [ 7 | 'implicit flow key' : value, 8 | ] 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL 'implicit block key 14 | +SEQ [] 15 | +MAP {} 16 | =VAL 'implicit flow key 17 | =VAL :value 18 | -MAP 19 | -SEQ 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "implicit block key": [ 26 | { 27 | "implicit flow key": "value" 28 | } 29 | ] 30 | } 31 | dump: | 32 | 'implicit block key': 33 | - 'implicit flow key': value 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8CWC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Plain mapping key ending with colon 3 | from: '@perlpunk' 4 | tags: mapping scalar 5 | yaml: | 6 | --- 7 | key ends with two colons::: value 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +MAP 12 | =VAL :key ends with two colons:: 13 | =VAL :value 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "key ends with two colons::": "value" 20 | } 21 | dump: | 22 | --- 23 | 'key ends with two colons::': value 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8G76.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.10. Comment Lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2780544 4 | tags: spec comment empty scalar whitespace 5 | yaml: |2 6 | # Comment 7 | ␣␣␣ 8 | ↵ 9 | ↵ 10 | tree: | 11 | +STR 12 | -STR 13 | json: '' 14 | dump: '' 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8KB6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline plain flow mapping key without value 3 | from: '@perlpunk' 4 | tags: flow mapping 5 | yaml: | 6 | --- 7 | - { single line, a: b} 8 | - { multi 9 | line, a: b} 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ 14 | +MAP {} 15 | =VAL :single line 16 | =VAL : 17 | =VAL :a 18 | =VAL :b 19 | -MAP 20 | +MAP {} 21 | =VAL :multi line 22 | =VAL : 23 | =VAL :a 24 | =VAL :b 25 | -MAP 26 | -SEQ 27 | -DOC 28 | -STR 29 | json: | 30 | [ 31 | { 32 | "single line": null, 33 | "a": "b" 34 | }, 35 | { 36 | "multi line": null, 37 | "a": "b" 38 | } 39 | ] 40 | dump: | 41 | --- 42 | - single line: 43 | a: b 44 | - multi line: 45 | a: b 46 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8MK2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Explicit Non-Specific Tag 3 | from: NimYAML tests 4 | tags: tag 1.3-err 5 | yaml: | 6 | ! a 7 | tree: | 8 | +STR 9 | +DOC 10 | =VAL :a 11 | -DOC 12 | -STR 13 | json: | 14 | "a" 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8QBE.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Sequence in Block Mapping 3 | from: NimYAML tests 4 | tags: mapping sequence 5 | yaml: | 6 | key: 7 | - item1 8 | - item2 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :key 14 | +SEQ 15 | =VAL :item1 16 | =VAL :item2 17 | -SEQ 18 | -MAP 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "key": [ 24 | "item1", 25 | "item2" 26 | ] 27 | } 28 | dump: | 29 | key: 30 | - item1 31 | - item2 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8XDJ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment in plain multiline value 3 | from: https://gist.github.com/anonymous/deeb1ace28d5bf21fb56d80c13e2dc69 via @ingydotnet 4 | tags: error comment scalar 5 | fail: true 6 | yaml: | 7 | key: word1 8 | # xxx 9 | word2 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key 15 | =VAL :word1 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/8XYN.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor with unicode character 3 | from: https://github.com/yaml/pyyaml/issues/94 4 | tags: anchor 5 | yaml: | 6 | --- 7 | - &😁 unicode anchor 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +SEQ 12 | =VAL &😁 :unicode anchor 13 | -SEQ 14 | -DOC 15 | -STR 16 | json: | 17 | [ 18 | "unicode anchor" 19 | ] 20 | dump: | 21 | --- 22 | - &😁 unicode anchor 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/93JH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Mappings in Block Sequence 3 | from: NimYAML tests 4 | tags: mapping sequence 5 | yaml: |2 6 | - key: value 7 | key2: value2 8 | - 9 | key3: value3 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | +MAP 15 | =VAL :key 16 | =VAL :value 17 | =VAL :key2 18 | =VAL :value2 19 | -MAP 20 | +MAP 21 | =VAL :key3 22 | =VAL :value3 23 | -MAP 24 | -SEQ 25 | -DOC 26 | -STR 27 | json: | 28 | [ 29 | { 30 | "key": "value", 31 | "key2": "value2" 32 | }, 33 | { 34 | "key3": "value3" 35 | } 36 | ] 37 | dump: | 38 | - key: value 39 | key2: value2 40 | - key3: value3 41 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/93WF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.6. Line Folding [1.3] 3 | from: K527, modified for YAML 1.3 4 | tags: folded spec whitespace scalar 1.3-mod 5 | yaml: | 6 | --- >- 7 | trimmed 8 | ␣␣ 9 | ␣ 10 | 11 | as 12 | space 13 | tree: | 14 | +STR 15 | +DOC --- 16 | =VAL >trimmed\n\n\nas space 17 | -DOC 18 | -STR 19 | json: | 20 | "trimmed\n\n\nas space" 21 | dump: | 22 | --- >- 23 | trimmed 24 | 25 | 26 | 27 | as space 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/96L6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.14. In the folded scalars, newlines become spaces 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2761032 4 | tags: spec folded scalar 5 | yaml: | 6 | --- > 7 | Mark McGwire's 8 | year was crippled 9 | by a knee injury. 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL >Mark McGwire's year was crippled by a knee injury.\n 14 | -DOC 15 | -STR 16 | json: | 17 | "Mark McGwire's year was crippled by a knee injury.\n" 18 | dump: | 19 | --- > 20 | Mark McGwire's year was crippled by a knee injury. 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/96NN.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Leading tab content in literals 3 | from: '@ingydotnet' 4 | tags: indent literal whitespace 5 | yaml: | 6 | foo: |- 7 | ——»bar 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :foo 13 | =VAL |\tbar 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | {"foo":"\tbar"} 19 | dump: | 20 | foo: |- 21 | ——»bar 22 | 23 | - yaml: | 24 | foo: |- 25 | ——»bar∎ 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/98YD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.5. Comment Indicator 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2773032 4 | tags: spec comment empty 5 | yaml: | 6 | # Comment only. 7 | tree: | 8 | +STR 9 | -STR 10 | json: '' 11 | dump: '' 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9BXH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline doublequoted flow mapping key without value 3 | from: '@perlpunk' 4 | tags: double flow mapping 5 | yaml: | 6 | --- 7 | - { "single line", a: b} 8 | - { "multi 9 | line", a: b} 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ 14 | +MAP {} 15 | =VAL "single line 16 | =VAL : 17 | =VAL :a 18 | =VAL :b 19 | -MAP 20 | +MAP {} 21 | =VAL "multi line 22 | =VAL : 23 | =VAL :a 24 | =VAL :b 25 | -MAP 26 | -SEQ 27 | -DOC 28 | -STR 29 | json: | 30 | [ 31 | { 32 | "single line": null, 33 | "a": "b" 34 | }, 35 | { 36 | "multi line": null, 37 | "a": "b" 38 | } 39 | ] 40 | dump: | 41 | --- 42 | - "single line": 43 | a: b 44 | - "multi line": 45 | a: b 46 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9C9N.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wrong indented flow sequence 3 | from: '@perlpunk' 4 | tags: error flow indent sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | flow: [a, 9 | b, 10 | c] 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :flow 16 | +SEQ [] 17 | =VAL :a 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9CWY.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid scalar at the end of mapping 3 | from: '@perlpunk' 4 | tags: error mapping sequence 5 | fail: true 6 | yaml: | 7 | key: 8 | - item1 9 | - item2 10 | invalid 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :key 16 | +SEQ 17 | =VAL :item1 18 | =VAL :item2 19 | -SEQ 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9DXL.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 9.6. Stream [1.3] 3 | from: 6ZKB, modified for YAML 1.3 4 | tags: spec header 1.3-mod 5 | yaml: | 6 | Mapping: Document 7 | --- 8 | # Empty 9 | ... 10 | %YAML 1.2 11 | --- 12 | matches %: 20 13 | tree: | 14 | +STR 15 | +DOC 16 | +MAP 17 | =VAL :Mapping 18 | =VAL :Document 19 | -MAP 20 | -DOC 21 | +DOC --- 22 | =VAL : 23 | -DOC ... 24 | +DOC --- 25 | +MAP 26 | =VAL :matches % 27 | =VAL :20 28 | -MAP 29 | -DOC 30 | -STR 31 | json: | 32 | { 33 | "Mapping": "Document" 34 | } 35 | null 36 | { 37 | "matches %": 20 38 | } 39 | emit: | 40 | Mapping: Document 41 | --- 42 | ... 43 | %YAML 1.2 44 | --- 45 | matches %: 20 46 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9FMG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multi-level Mapping Indent 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/indent.tml 4 | tags: mapping indent 5 | yaml: | 6 | a: 7 | b: 8 | c: d 9 | e: 10 | f: g 11 | h: i 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :a 17 | +MAP 18 | =VAL :b 19 | +MAP 20 | =VAL :c 21 | =VAL :d 22 | -MAP 23 | =VAL :e 24 | +MAP 25 | =VAL :f 26 | =VAL :g 27 | -MAP 28 | -MAP 29 | =VAL :h 30 | =VAL :i 31 | -MAP 32 | -DOC 33 | -STR 34 | json: | 35 | { 36 | "a": { 37 | "b": { 38 | "c": "d" 39 | }, 40 | "e": { 41 | "f": "g" 42 | } 43 | }, 44 | "h": "i" 45 | } 46 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9HCY.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Need document footer before directives 3 | from: '@ingydotnet' 4 | tags: directive error footer tag unknown-tag 5 | fail: true 6 | yaml: | 7 | !foo "bar" 8 | %TAG ! tag:example.com,2000:app/ 9 | --- 10 | !foo "bar" 11 | tree: | 12 | +STR 13 | +DOC 14 | =VAL "bar 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9J7A.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Simple Mapping Indent 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/indent.tml 4 | tags: simple mapping indent 5 | yaml: | 6 | foo: 7 | bar: baz 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :foo 13 | +MAP 14 | =VAL :bar 15 | =VAL :baz 16 | -MAP 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "foo": { 23 | "bar": "baz" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9JBA.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid comment after end of flow sequence 3 | from: '@perlpunk' 4 | tags: comment error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ a, b, c, ]#invalid 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ [] 13 | =VAL :a 14 | =VAL :b 15 | =VAL :c 16 | -SEQ 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9KBC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Mapping starting at --- line 3 | from: https://gist.github.com/anonymous/c728390e92ec93fb371ac77f21435cca via @ingydotnet 4 | tags: error header mapping 5 | fail: true 6 | yaml: | 7 | --- key1: value1 8 | key2: value2 9 | tree: | 10 | +STR 11 | +DOC --- 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9MAG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow sequence with invalid comma at the beginning 3 | from: '@perlpunk' 4 | tags: error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ , a, b, c ] 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ [] 13 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9MMA.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Directive by itself with no document 3 | from: '@ingydotnet' 4 | tags: error directive 5 | fail: true 6 | yaml: | 7 | %YAML 1.2 8 | tree: | 9 | +STR 10 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9MMW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Single Pair Implicit Entries 3 | from: '@perlpunk, Spec Example 7.21' 4 | tags: flow mapping sequence 5 | yaml: | 6 | - [ YAML : separate ] 7 | - [ "JSON like":adjacent ] 8 | - [ {JSON: like}:adjacent ] 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | +SEQ [] 14 | +MAP {} 15 | =VAL :YAML 16 | =VAL :separate 17 | -MAP 18 | -SEQ 19 | +SEQ [] 20 | +MAP {} 21 | =VAL "JSON like 22 | =VAL :adjacent 23 | -MAP 24 | -SEQ 25 | +SEQ [] 26 | +MAP {} 27 | +MAP {} 28 | =VAL :JSON 29 | =VAL :like 30 | -MAP 31 | =VAL :adjacent 32 | -MAP 33 | -SEQ 34 | -SEQ 35 | -DOC 36 | -STR 37 | dump: | 38 | - - YAML: separate 39 | - - "JSON like": adjacent 40 | - - ? JSON: like 41 | : adjacent 42 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9MQT.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Scalar doc with '...' in content 3 | from: '@ingydotnet' 4 | tags: double scalar 5 | yaml: | 6 | --- "a 7 | ...x 8 | b" 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL "a ...x b 13 | -DOC 14 | -STR 15 | json: | 16 | "a ...x b" 17 | dump: | 18 | --- a ...x b 19 | emit: | 20 | --- "a ...x b" 21 | 22 | - fail: true 23 | yaml: | 24 | --- "a 25 | ... x 26 | b" 27 | tree: | 28 | +STR 29 | +DOC --- 30 | dump: null 31 | emit: null 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9SA2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline double quoted flow mapping key 3 | from: '@perlpunk' 4 | tags: double flow mapping 5 | yaml: | 6 | --- 7 | - { "single line": value} 8 | - { "multi 9 | line": value} 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ 14 | +MAP {} 15 | =VAL "single line 16 | =VAL :value 17 | -MAP 18 | +MAP {} 19 | =VAL "multi line 20 | =VAL :value 21 | -MAP 22 | -SEQ 23 | -DOC 24 | -STR 25 | json: | 26 | [ 27 | { 28 | "single line": "value" 29 | }, 30 | { 31 | "multi line": "value" 32 | } 33 | ] 34 | dump: | 35 | --- 36 | - "single line": value 37 | - "multi line": value 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9SHH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.8. Quoted Scalar Indicators 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2773890 4 | tags: spec scalar 5 | yaml: | 6 | single: 'text' 7 | double: "text" 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :single 13 | =VAL 'text 14 | =VAL :double 15 | =VAL "text 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "single": "text", 22 | "double": "text" 23 | } 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9TFX.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.6. Double Quoted Lines [1.3] 3 | from: 7A4E, modified for YAML 1.3 4 | tags: double spec scalar whitespace 1.3-mod 5 | yaml: | 6 | --- 7 | " 1st non-empty 8 | 9 | 2nd non-empty␣ 10 | 3rd non-empty " 11 | tree: | 12 | +STR 13 | +DOC --- 14 | =VAL " 1st non-empty\n2nd non-empty 3rd non-empty␣ 15 | -DOC 16 | -STR 17 | json: | 18 | " 1st non-empty\n2nd non-empty 3rd non-empty " 19 | dump: | 20 | " 1st non-empty\n2nd non-empty 3rd non-empty " 21 | emit: | 22 | --- " 1st non-empty\n2nd non-empty 3rd non-empty " 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9WXW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.18. Primary Tag Handle 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2782728 4 | tags: local-tag spec directive tag unknown-tag 1.3-err 5 | yaml: | 6 | # Private 7 | !foo "bar" 8 | ... 9 | # Global 10 | %TAG ! tag:example.com,2000:app/ 11 | --- 12 | !foo "bar" 13 | tree: | 14 | +STR 15 | +DOC 16 | =VAL "bar 17 | -DOC ... 18 | +DOC --- 19 | =VAL "bar 20 | -DOC 21 | -STR 22 | json: | 23 | "bar" 24 | "bar" 25 | dump: | 26 | !foo "bar" 27 | ... 28 | --- ! "bar" 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/9YRD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline Scalar at Top Level 3 | from: NimYAML tests 4 | tags: scalar whitespace 1.3-err 5 | yaml: | 6 | a 7 | b␣␣ 8 | c 9 | d 10 | 11 | e 12 | tree: | 13 | +STR 14 | +DOC 15 | =VAL :a b c d\ne 16 | -DOC 17 | -STR 18 | json: | 19 | "a b c d\ne" 20 | dump: | 21 | 'a b c d 22 | 23 | e' 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/A2M4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.2. Indentation Indicators 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2778101 4 | tags: explicit-key spec libyaml-err indent whitespace sequence upto-1.2 5 | yaml: | 6 | ? a 7 | : -»b 8 | - -—»c 9 | - d 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :a 15 | +SEQ 16 | =VAL :b 17 | +SEQ 18 | =VAL :c 19 | =VAL :d 20 | -SEQ 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "a": [ 28 | "b", 29 | [ 30 | "c", 31 | "d" 32 | ] 33 | ] 34 | } 35 | dump: | 36 | a: 37 | - b 38 | - - c 39 | - d 40 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/A6F9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.4. Chomping Final Line Break 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2795034 4 | tags: spec literal scalar 5 | yaml: | 6 | strip: |- 7 | text 8 | clip: | 9 | text 10 | keep: |+ 11 | text 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :strip 17 | =VAL |text 18 | =VAL :clip 19 | =VAL |text\n 20 | =VAL :keep 21 | =VAL |text\n 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "strip": "text", 28 | "clip": "text\n", 29 | "keep": "text\n" 30 | } 31 | dump: | 32 | strip: |- 33 | text 34 | clip: | 35 | text 36 | keep: | 37 | text 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/A984.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline Scalar in Mapping 3 | from: NimYAML tests 4 | tags: scalar 5 | yaml: | 6 | a: b 7 | c 8 | d: 9 | e 10 | f 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :a 16 | =VAL :b c 17 | =VAL :d 18 | =VAL :e f 19 | -MAP 20 | -DOC 21 | -STR 22 | json: | 23 | { 24 | "a": "b c", 25 | "d": "e f" 26 | } 27 | dump: | 28 | a: b c 29 | d: e f 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/AB8U.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Sequence entry that looks like two with wrong indentation 3 | from: '@perlpunk' 4 | tags: scalar sequence 5 | yaml: | 6 | - single multiline 7 | - sequence entry 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | =VAL :single multiline - sequence entry 13 | -SEQ 14 | -DOC 15 | -STR 16 | json: | 17 | [ 18 | "single multiline - sequence entry" 19 | ] 20 | dump: | 21 | - single multiline - sequence entry 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/AVM7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Empty Stream 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/misc.tml 4 | tags: edge 5 | yaml: | 6 | ∎ 7 | tree: | 8 | +STR 9 | -STR 10 | json: '' 11 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/AZ63.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Sequence With Same Indentation as Parent Mapping 3 | from: NimYAML tests 4 | tags: indent mapping sequence 5 | yaml: | 6 | one: 7 | - 2 8 | - 3 9 | four: 5 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :one 15 | +SEQ 16 | =VAL :2 17 | =VAL :3 18 | -SEQ 19 | =VAL :four 20 | =VAL :5 21 | -MAP 22 | -DOC 23 | -STR 24 | json: | 25 | { 26 | "one": [ 27 | 2, 28 | 3 29 | ], 30 | "four": 5 31 | } 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/AZW3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Lookahead test cases 3 | from: NimYAML tests 4 | tags: mapping edge 5 | yaml: | 6 | - bla"keks: foo 7 | - bla]keks: foo 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | +MAP 13 | =VAL :bla"keks 14 | =VAL :foo 15 | -MAP 16 | +MAP 17 | =VAL :bla]keks 18 | =VAL :foo 19 | -MAP 20 | -SEQ 21 | -DOC 22 | -STR 23 | json: | 24 | [ 25 | { 26 | "bla\"keks": "foo" 27 | }, 28 | { 29 | "bla]keks": "foo" 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/B3HG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.9. Folded Scalar [1.3] 3 | from: G992, modified for YAML 1.3 4 | tags: spec folded scalar 1.3-mod 5 | yaml: | 6 | --- > 7 | folded 8 | text 9 | ↵ 10 | ↵ 11 | tree: | 12 | +STR 13 | +DOC --- 14 | =VAL >folded text\n 15 | -DOC 16 | -STR 17 | json: | 18 | "folded text\n" 19 | dump: | 20 | > 21 | folded text 22 | emit: | 23 | --- > 24 | folded text 25 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/B63P.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Directive without document 3 | from: AdaYaml tests 4 | tags: error directive document 5 | fail: true 6 | yaml: | 7 | %YAML 1.2 8 | ... 9 | tree: | 10 | +STR 11 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/BD7L.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid mapping after sequence 3 | from: '@perlpunk' 4 | tags: error mapping sequence 5 | fail: true 6 | yaml: | 7 | - item1 8 | - item2 9 | invalid: x 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL :item1 15 | =VAL :item2 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/BEC7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.14. “YAML” directive 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2781929 4 | tags: spec directive 5 | yaml: | 6 | %YAML 1.3 # Attempt parsing 7 | # with a warning 8 | --- 9 | "foo" 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL "foo 14 | -DOC 15 | -STR 16 | json: | 17 | "foo" 18 | dump: | 19 | --- "foo" 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/BF9H.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Trailing comment in multiline plain scalar 3 | from: '@perlpunk' 4 | tags: comment error scalar 5 | fail: true 6 | yaml: | 7 | --- 8 | plain: a 9 | b # end of scalar 10 | c 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :plain 16 | =VAL :a b 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/BS4K.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment between plain scalar lines 3 | from: https://gist.github.com/anonymous/269f16d582fdd30a7dcf8c9249c5da7f via @ingydotnet 4 | tags: error scalar 5 | fail: true 6 | yaml: | 7 | word1 # comment 8 | word2 9 | tree: | 10 | +STR 11 | +DOC 12 | =VAL :word1 13 | -DOC 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/BU8L.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Node Anchor and Tag on Seperate Lines 3 | from: https://gist.github.com/anonymous/f192e7dab6da31831f264dbf1947cb83 via @ingydotnet 4 | tags: anchor indent 1.3-err tag 5 | yaml: | 6 | key: &anchor 7 | !!map 8 | a: b 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :key 14 | +MAP &anchor 15 | =VAL :a 16 | =VAL :b 17 | -MAP 18 | -MAP 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "key": { 24 | "a": "b" 25 | } 26 | } 27 | dump: | 28 | key: &anchor !!map 29 | a: b 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/C2DT.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.18. Flow Mapping Adjacent Values 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2792073 4 | tags: spec flow mapping 5 | yaml: | 6 | { 7 | "adjacent":value, 8 | "readable": value, 9 | "empty": 10 | } 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP {} 15 | =VAL "adjacent 16 | =VAL :value 17 | =VAL "readable 18 | =VAL :value 19 | =VAL "empty 20 | =VAL : 21 | -MAP 22 | -DOC 23 | -STR 24 | json: | 25 | { 26 | "adjacent": "value", 27 | "readable": "value", 28 | "empty": null 29 | } 30 | dump: | 31 | "adjacent": value 32 | "readable": value 33 | "empty": 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/C2SP.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Mapping Key on two lines 3 | from: '@perlpunk' 4 | tags: error flow mapping 5 | fail: true 6 | yaml: | 7 | [23 8 | ]: 42 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ [] 13 | =VAL :23 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CC74.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.20. Tag Handles 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2783195 4 | tags: spec directive tag unknown-tag 5 | yaml: | 6 | %TAG !e! tag:example.com,2000:app/ 7 | --- 8 | !e!foo "bar" 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL "bar 13 | -DOC 14 | -STR 15 | json: | 16 | "bar" 17 | dump: | 18 | --- ! "bar" 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CFD4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Empty implicit key in single pair flow sequences 3 | from: '@perlpunk' 4 | tags: empty-key flow sequence 5 | yaml: | 6 | - [ : empty key ] 7 | - [: another empty key] 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | +SEQ [] 13 | +MAP {} 14 | =VAL : 15 | =VAL :empty key 16 | -MAP 17 | -SEQ 18 | +SEQ [] 19 | +MAP {} 20 | =VAL : 21 | =VAL :another empty key 22 | -MAP 23 | -SEQ 24 | -SEQ 25 | -DOC 26 | -STR 27 | dump: | 28 | - - : empty key 29 | - - : another empty key 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CML9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Missing comma in flow 3 | from: ihttps://gist.github.com/anonymous/4ba3365607cc14b4f656e391b45bf4f4 via @ingydotnet 4 | tags: error flow comment 5 | fail: true 6 | yaml: | 7 | key: [ word1 8 | # xxx 9 | word2 ] 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key 15 | +SEQ [] 16 | =VAL :word1 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CPZ3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Doublequoted scalar starting with a tab 3 | from: '@perlpunk' 4 | tags: double scalar 5 | yaml: | 6 | --- 7 | tab: "\tstring" 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +MAP 12 | =VAL :tab 13 | =VAL "\tstring 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "tab": "\tstring" 20 | } 21 | dump: | 22 | --- 23 | tab: "\tstring" 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CQ3W.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Double quoted string without closing quote 3 | from: '@perlpunk' 4 | tags: error double 5 | fail: true 6 | yaml: | 7 | --- 8 | key: "missing closing quote 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP 13 | =VAL :key 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CT4Q.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.20. Single Pair Explicit Entry 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2792424 4 | tags: explicit-key spec flow mapping 5 | yaml: | 6 | [ 7 | ? foo 8 | bar : baz 9 | ] 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ [] 14 | +MAP {} 15 | =VAL :foo bar 16 | =VAL :baz 17 | -MAP 18 | -SEQ 19 | -DOC 20 | -STR 21 | json: | 22 | [ 23 | { 24 | "foo bar": "baz" 25 | } 26 | ] 27 | dump: | 28 | - foo bar: baz 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CTN5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow sequence with invalid extra comma 3 | from: '@perlpunk' 4 | tags: error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ a, b, c, , ] 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ [] 13 | =VAL :a 14 | =VAL :b 15 | =VAL :c 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CUP7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.6. Node Property Indicators 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2773402 4 | tags: local-tag spec tag alias 5 | yaml: | 6 | anchored: !local &anchor value 7 | alias: *anchor 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :anchored 13 | =VAL &anchor :value 14 | =VAL :alias 15 | =ALI *anchor 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "anchored": "value", 22 | "alias": "value" 23 | } 24 | dump: | 25 | anchored: &anchor !local value 26 | alias: *anchor 27 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CVW2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid comment after comma 3 | from: '@perlpunk' 4 | tags: comment error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ a, b, c,#invalid 9 | ] 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ [] 14 | =VAL :a 15 | =VAL :b 16 | =VAL :c 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/CXX2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Mapping with anchor on document start line 3 | from: '@perlpunk' 4 | tags: anchor error header mapping 5 | fail: true 6 | yaml: | 7 | --- &anchor a: b 8 | tree: | 9 | +STR 10 | +DOC --- 11 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/D49Q.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline single quoted implicit keys 3 | from: '@perlpunk' 4 | tags: error single mapping 5 | fail: true 6 | yaml: | 7 | 'a\nb': 1 8 | 'c 9 | d': 1 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL 'a\\nb 15 | =VAL :1 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/D83L.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block scalar indicator order 3 | from: '@perlpunk' 4 | tags: indent literal 5 | yaml: | 6 | - |2- 7 | explicit indent and chomp 8 | - |-2 9 | chomp and explicit indent 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL |explicit indent and chomp 15 | =VAL |chomp and explicit indent 16 | -SEQ 17 | -DOC 18 | -STR 19 | json: | 20 | [ 21 | "explicit indent and chomp", 22 | "chomp and explicit indent" 23 | ] 24 | dump: | 25 | - |- 26 | explicit indent and chomp 27 | - |- 28 | chomp and explicit indent 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/D88J.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Sequence in Block Mapping 3 | from: NimYAML tests 4 | tags: flow sequence mapping 5 | yaml: | 6 | a: [b, c] 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP 11 | =VAL :a 12 | +SEQ [] 13 | =VAL :b 14 | =VAL :c 15 | -SEQ 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "a": [ 22 | "b", 23 | "c" 24 | ] 25 | } 26 | dump: | 27 | a: 28 | - b 29 | - c 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/D9TU.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Single Pair Block Mapping 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/mapping.tml 4 | tags: simple mapping 5 | yaml: | 6 | foo: bar 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP 11 | =VAL :foo 12 | =VAL :bar 13 | -MAP 14 | -DOC 15 | -STR 16 | json: | 17 | { 18 | "foo": "bar" 19 | } 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DC7X.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Various trailing tabs 3 | from: '@perlpunk' 4 | tags: comment whitespace 5 | yaml: | 6 | a: b———» 7 | seq:———» 8 | - a———» 9 | c: d———»#X 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :a 15 | =VAL :b 16 | =VAL :seq 17 | +SEQ 18 | =VAL :a 19 | -SEQ 20 | =VAL :c 21 | =VAL :d 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "a": "b", 28 | "seq": [ 29 | "a" 30 | ], 31 | "c": "d" 32 | } 33 | dump: | 34 | a: b 35 | seq: 36 | - a 37 | c: d 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DFF7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.16. Flow Mapping Entries 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2791260 4 | tags: explicit-key spec flow mapping 5 | yaml: | 6 | { 7 | ? explicit: entry, 8 | implicit: entry, 9 | ? 10 | } 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP {} 15 | =VAL :explicit 16 | =VAL :entry 17 | =VAL :implicit 18 | =VAL :entry 19 | =VAL : 20 | =VAL : 21 | -MAP 22 | -DOC 23 | -STR 24 | dump: | 25 | explicit: entry 26 | implicit: entry 27 | : 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DHP8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Sequence 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/sequence.tml 4 | tags: flow sequence 5 | yaml: | 6 | [foo, bar, 42] 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ [] 11 | =VAL :foo 12 | =VAL :bar 13 | =VAL :42 14 | -SEQ 15 | -DOC 16 | -STR 17 | json: | 18 | [ 19 | "foo", 20 | "bar", 21 | 42 22 | ] 23 | dump: | 24 | - foo 25 | - bar 26 | - 42 27 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DK3J.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Zero indented block scalar with line that looks like a comment 3 | from: '@perlpunk' 4 | tags: comment folded scalar 5 | yaml: | 6 | --- > 7 | line1 8 | # no comment 9 | line3 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL >line1 # no comment line3\n 14 | -DOC 15 | -STR 16 | json: | 17 | "line1 # no comment line3\n" 18 | dump: | 19 | --- > 20 | line1 # no comment line3 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DK4H.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Implicit key followed by newline 3 | from: '@perlpunk' 4 | tags: error flow mapping sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ key 9 | : value ] 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ [] 14 | =VAL :key 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DMG6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wrong indendation in Map 3 | from: '@perlpunk' 4 | tags: error mapping indent 5 | fail: true 6 | yaml: | 7 | key: 8 | ok: 1 9 | wrong: 2 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key 15 | +MAP 16 | =VAL :ok 17 | =VAL :1 18 | -MAP 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/DWX9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.8. Literal Content 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2796118 4 | tags: spec literal scalar comment whitespace 1.3-err 5 | yaml: | 6 | | 7 | ␣ 8 | ␣␣ 9 | literal 10 | ␣␣␣ 11 | ␣␣ 12 | text 13 | 14 | # Comment 15 | tree: | 16 | +STR 17 | +DOC 18 | =VAL |\n\nliteral\n \n\ntext\n 19 | -DOC 20 | -STR 21 | json: | 22 | "\n\nliteral\n \n\ntext\n" 23 | dump: | 24 | "\n\nliteral\n \n\ntext\n" 25 | emit: | 26 | | 27 | 28 | 29 | literal 30 | ␣␣␣ 31 | 32 | text 33 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/E76Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Aliases in Implicit Block Mapping 3 | from: NimYAML tests 4 | tags: mapping alias 5 | yaml: | 6 | &a a: &b b 7 | *b : *a 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL &a :a 13 | =VAL &b :b 14 | =ALI *b 15 | =ALI *a 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "a": "b", 22 | "b": "a" 23 | } 24 | dump: | 25 | &a a: &b b 26 | *b : *a 27 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/EB22.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Missing document-end marker before directive 3 | from: '@perlpunk' 4 | tags: error directive footer 5 | fail: true 6 | yaml: | 7 | --- 8 | scalar1 # comment 9 | %YAML 1.2 10 | --- 11 | scalar2 12 | tree: | 13 | +STR 14 | +DOC --- 15 | =VAL :scalar1 16 | -DOC 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/EHF6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags for Flow Objects 3 | from: NimYAML tests 4 | tags: tag flow mapping sequence 5 | yaml: | 6 | !!map { 7 | k: !!seq 8 | [ a, !!str b] 9 | } 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP {} 14 | =VAL :k 15 | +SEQ [] 16 | =VAL :a 17 | =VAL :b 18 | -SEQ 19 | -MAP 20 | -DOC 21 | -STR 22 | json: | 23 | { 24 | "k": [ 25 | "a", 26 | "b" 27 | ] 28 | } 29 | dump: | 30 | !!map 31 | k: !!seq 32 | - a 33 | - !!str b 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/EW3V.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wrong indendation in mapping 3 | from: '@perlpunk' 4 | tags: error mapping indent 5 | fail: true 6 | yaml: | 7 | k1: v1 8 | k2: v2 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :k1 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/EX5H.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline Scalar at Top Level [1.3] 3 | from: 9YRD, modified for YAML 1.3 4 | tags: scalar whitespace 1.3-mod 5 | yaml: | 6 | --- 7 | a 8 | b␣␣ 9 | c 10 | d 11 | 12 | e 13 | tree: | 14 | +STR 15 | +DOC --- 16 | =VAL :a b c d\ne 17 | -DOC 18 | -STR 19 | json: | 20 | "a b c d\ne" 21 | dump: | 22 | 'a b c d 23 | 24 | e' 25 | emit: | 26 | --- a b c d 27 | 28 | e 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/EXG3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Three dashes and content without space [1.3] 3 | from: 82AN, modified for YAML 1.3 4 | tags: scalar 1.3-mod 5 | yaml: | 6 | --- 7 | ---word1 8 | word2 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL :---word1 word2 13 | -DOC 14 | -STR 15 | json: | 16 | "---word1 word2" 17 | dump: | 18 | '---word1 word2' 19 | emit: | 20 | --- '---word1 word2' 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/F2C7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchors and Tags 3 | from: NimYAML tests 4 | tags: anchor tag 5 | yaml: |2 6 | - &a !!str a 7 | - !!int 2 8 | - !!int &c 4 9 | - &d d 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL &a :a 15 | =VAL :2 16 | =VAL &c :4 17 | =VAL &d :d 18 | -SEQ 19 | -DOC 20 | -STR 21 | json: | 22 | [ 23 | "a", 24 | 2, 25 | 4, 26 | "d" 27 | ] 28 | dump: | 29 | - &a !!str a 30 | - !!int 2 31 | - &c !!int 4 32 | - &d d 33 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/F3CP.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nested flow collections on one line 3 | from: '@perlpunk' 4 | tags: flow mapping sequence 5 | yaml: | 6 | --- 7 | { a: [b, c, { d: [e, f] } ] } 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +MAP {} 12 | =VAL :a 13 | +SEQ [] 14 | =VAL :b 15 | =VAL :c 16 | +MAP {} 17 | =VAL :d 18 | +SEQ [] 19 | =VAL :e 20 | =VAL :f 21 | -SEQ 22 | -MAP 23 | -SEQ 24 | -MAP 25 | -DOC 26 | -STR 27 | json: | 28 | { 29 | "a": [ 30 | "b", 31 | "c", 32 | { 33 | "d": [ 34 | "e", 35 | "f" 36 | ] 37 | } 38 | ] 39 | } 40 | dump: | 41 | --- 42 | a: 43 | - b 44 | - c 45 | - d: 46 | - e 47 | - f 48 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/F6MC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: More indented lines at the beginning of folded block scalars 3 | from: '@perlpunk' 4 | tags: folded indent 5 | yaml: | 6 | --- 7 | a: >2 8 | more indented 9 | regular 10 | b: >2 11 | 12 | 13 | more indented 14 | regular 15 | tree: | 16 | +STR 17 | +DOC --- 18 | +MAP 19 | =VAL :a 20 | =VAL > more indented\nregular\n 21 | =VAL :b 22 | =VAL >\n\n more indented\nregular\n 23 | -MAP 24 | -DOC 25 | -STR 26 | json: | 27 | { 28 | "a": " more indented\nregular\n", 29 | "b": "\n\n more indented\nregular\n" 30 | } 31 | emit: | 32 | --- 33 | a: >2 34 | more indented 35 | regular 36 | b: >2 37 | 38 | 39 | more indented 40 | regular 41 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/FH7J.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags on Empty Scalars 3 | from: NimYAML tests 4 | tags: tag scalar 5 | yaml: | 6 | - !!str 7 | - 8 | !!null : a 9 | b: !!str 10 | - !!str : !!null 11 | tree: | 12 | +STR 13 | +DOC 14 | +SEQ 15 | =VAL : 16 | +MAP 17 | =VAL : 18 | =VAL :a 19 | =VAL :b 20 | =VAL : 21 | -MAP 22 | +MAP 23 | =VAL : 24 | =VAL : 25 | -MAP 26 | -SEQ 27 | -DOC 28 | -STR 29 | dump: | 30 | - !!str 31 | - !!null : a 32 | b: !!str 33 | - !!str : !!null 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/FP8R.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Zero indented block scalar 3 | from: '@perlpunk' 4 | tags: folded indent scalar 5 | yaml: | 6 | --- > 7 | line1 8 | line2 9 | line3 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL >line1 line2 line3\n 14 | -DOC 15 | -STR 16 | json: | 17 | "line1 line2 line3\n" 18 | dump: | 19 | --- > 20 | line1 line2 line3 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/FQ7F.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.1. Sequence of Scalars 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2759963 4 | tags: spec sequence 5 | yaml: | 6 | - Mark McGwire 7 | - Sammy Sosa 8 | - Ken Griffey 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | =VAL :Mark McGwire 14 | =VAL :Sammy Sosa 15 | =VAL :Ken Griffey 16 | -SEQ 17 | -DOC 18 | -STR 19 | json: | 20 | [ 21 | "Mark McGwire", 22 | "Sammy Sosa", 23 | "Ken Griffey" 24 | ] 25 | toke: | 26 | SEQ-MARK 0 1 1 1 27 | WS-SPACE 1 1 1 2 28 | TEXT-VAL 2 12 1 3 :Mark McGwire 29 | WS-NEWLN 14 1 1 15 30 | SEQ-MARK 15 1 2 1 31 | WS-SPACE 1 1 1 2 32 | TEXT-VAL 2 12 1 3 :Sammy Sosa 33 | WS-NEWLN 14 1 1 15 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/FRK4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.3. Completely Empty Flow Nodes 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2786868 4 | tags: empty-key explicit-key spec flow mapping 5 | yaml: | 6 | { 7 | ? foo :, 8 | : bar, 9 | } 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP {} 14 | =VAL :foo 15 | =VAL : 16 | =VAL : 17 | =VAL :bar 18 | -MAP 19 | -DOC 20 | -STR 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/FTA2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Single block sequence with anchor and explicit document start 3 | from: '@perlpunk' 4 | tags: anchor header sequence 5 | yaml: | 6 | --- &sequence 7 | - a 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +SEQ &sequence 12 | =VAL :a 13 | -SEQ 14 | -DOC 15 | -STR 16 | json: | 17 | [ 18 | "a" 19 | ] 20 | dump: | 21 | --- &sequence 22 | - a 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/FUP4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Sequence in Flow Sequence 3 | from: NimYAML tests 4 | tags: sequence flow 5 | yaml: | 6 | [a, [b, c]] 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ [] 11 | =VAL :a 12 | +SEQ [] 13 | =VAL :b 14 | =VAL :c 15 | -SEQ 16 | -SEQ 17 | -DOC 18 | -STR 19 | json: | 20 | [ 21 | "a", 22 | [ 23 | "b", 24 | "c" 25 | ] 26 | ] 27 | dump: | 28 | - a 29 | - - b 30 | - c 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/G5U8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Plain dashes in flow sequence 3 | from: '@ingydotnet' 4 | tags: flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | - [-, -] 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ 13 | +SEQ [] 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/G7JE.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline implicit keys 3 | from: '@perlpunk' 4 | tags: error mapping 5 | fail: true 6 | yaml: | 7 | a\nb: 1 8 | c 9 | d: 1 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :a\\nb 15 | =VAL :1 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/G992.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.9. Folded Scalar 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2796371 4 | tags: spec folded scalar 1.3-err 5 | yaml: | 6 | > 7 | folded 8 | text 9 | ↵ 10 | ↵ 11 | tree: | 12 | +STR 13 | +DOC 14 | =VAL >folded text\n 15 | -DOC 16 | -STR 17 | json: | 18 | "folded text\n" 19 | dump: | 20 | > 21 | folded text 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/G9HC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid anchor in zero indented sequence 3 | from: '@perlpunk' 4 | tags: anchor error sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | seq: 9 | &anchor 10 | - a 11 | - b 12 | tree: | 13 | +STR 14 | +DOC --- 15 | +MAP 16 | =VAL :seq 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/GDY7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment that looks like a mapping key 3 | from: '@perlpunk' 4 | tags: comment error mapping 5 | fail: true 6 | yaml: | 7 | key: value 8 | this is #not a: key 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :key 14 | =VAL :value 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/GH63.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Mixed Block Mapping (explicit to implicit) 3 | from: NimYAML tests 4 | tags: explicit-key mapping 5 | yaml: | 6 | ? a 7 | : 1.3 8 | fifteen: d 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :a 14 | =VAL :1.3 15 | =VAL :fifteen 16 | =VAL :d 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "a": 1.3, 23 | "fifteen": "d" 24 | } 25 | dump: | 26 | a: 1.3 27 | fifteen: d 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/GT5M.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Node anchor in sequence 3 | from: '@perlpunk' 4 | tags: anchor error sequence 5 | fail: true 6 | yaml: | 7 | - item1 8 | &node 9 | - item2 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL :item1 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/H2RW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Blank lines 3 | from: IRC discussion with leont 4 | tags: comment literal scalar whitespace 5 | yaml: | 6 | foo: 1 7 | 8 | bar: 2 9 | ␣␣␣␣ 10 | text: | 11 | a 12 | ␣␣␣␣ 13 | b 14 | 15 | c 16 | ␣ 17 | d 18 | tree: | 19 | +STR 20 | +DOC 21 | +MAP 22 | =VAL :foo 23 | =VAL :1 24 | =VAL :bar 25 | =VAL :2 26 | =VAL :text 27 | =VAL |a\n \nb\n\nc\n\nd\n 28 | -MAP 29 | -DOC 30 | -STR 31 | json: | 32 | { 33 | "foo": 1, 34 | "bar": 2, 35 | "text": "a\n \nb\n\nc\n\nd\n" 36 | } 37 | dump: | 38 | foo: 1 39 | bar: 2 40 | text: "a\n \nb\n\nc\n\nd\n" 41 | emit: | 42 | foo: 1 43 | bar: 2 44 | text: | 45 | a 46 | ␣␣␣␣ 47 | b 48 | 49 | c 50 | 51 | d 52 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/H3Z8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Literal unicode 3 | from: '@perlpunk' 4 | tags: scalar 5 | yaml: | 6 | --- 7 | wanted: love ♥ and peace ☮ 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +MAP 12 | =VAL :wanted 13 | =VAL :love ♥ and peace ☮ 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "wanted": "love ♥ and peace ☮" 20 | } 21 | dump: | 22 | --- 23 | wanted: "love \u2665 and peace \u262E" 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/H7J7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Node anchor not indented 3 | from: https://gist.github.com/anonymous/f192e7dab6da31831f264dbf1947cb83 via @ingydotnet 4 | tags: anchor error indent tag 5 | fail: true 6 | yaml: | 7 | key: &x 8 | !!map 9 | a: b 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key 15 | =VAL &x : 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/H7TQ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Extra words on %YAML directive 3 | from: '@ingydotnet' 4 | tags: directive 5 | fail: true 6 | yaml: | 7 | %YAML 1.2 foo 8 | --- 9 | tree: | 10 | +STR 11 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/HM87.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Scalars in flow start with syntax char 3 | from: '@ingydotnet' 4 | tags: flow scalar 5 | yaml: | 6 | [:x] 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ [] 11 | =VAL ::x 12 | -SEQ 13 | -DOC 14 | -STR 15 | json: | 16 | [ 17 | ":x" 18 | ] 19 | dump: | 20 | - :x 21 | 22 | - yaml: | 23 | [?x] 24 | tree: | 25 | +STR 26 | +DOC 27 | +SEQ [] 28 | =VAL :?x 29 | -SEQ 30 | -DOC 31 | -STR 32 | json: | 33 | [ 34 | "?x" 35 | ] 36 | dump: | 37 | - ?x 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/HMQ5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.23. Node Properties 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2783940 4 | tags: spec tag alias 5 | yaml: | 6 | !!str &a1 "foo": 7 | !!str bar 8 | &a2 baz : *a1 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL &a1 "foo 14 | =VAL :bar 15 | =VAL &a2 :baz 16 | =ALI *a1 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "foo": "bar", 23 | "baz": "foo" 24 | } 25 | dump: | 26 | &a1 !!str "foo": !!str bar 27 | &a2 baz: *a1 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/HRE5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Double quoted scalar with escaped single quote 3 | from: https://github.com/yaml/libyaml/issues/68 4 | tags: double error single 5 | fail: true 6 | yaml: | 7 | --- 8 | double: "quoted \' scalar" 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP 13 | =VAL :double 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/HS5T.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.12. Plain Lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2789986 4 | tags: spec scalar whitespace upto-1.2 5 | yaml: | 6 | 1st non-empty 7 | 8 | 2nd non-empty␣ 9 | ———»3rd non-empty 10 | tree: | 11 | +STR 12 | +DOC 13 | =VAL :1st non-empty\n2nd non-empty 3rd non-empty 14 | -DOC 15 | -STR 16 | json: | 17 | "1st non-empty\n2nd non-empty 3rd non-empty" 18 | dump: | 19 | '1st non-empty 20 | 21 | 2nd non-empty 3rd non-empty' 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/HU3P.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid Mapping in plain scalar 3 | from: https://gist.github.com/anonymous/d305fd8e54cfe7a484088c91a8a2e533 via @ingydotnet 4 | tags: error mapping scalar 5 | fail: true 6 | yaml: | 7 | key: 8 | word1 word2 9 | no: key 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/HWV9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Document-end marker 3 | from: '@perlpunk' 4 | tags: footer 5 | yaml: | 6 | ... 7 | tree: | 8 | +STR 9 | -STR 10 | json: '' 11 | dump: '' 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/J3BT.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.12. Tabs and Spaces 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2775350 4 | tags: spec whitespace upto-1.2 5 | yaml: | 6 | # Tabs and spaces 7 | quoted: "Quoted ———»" 8 | block:—»| 9 | void main() { 10 | —»printf("Hello, world!\n"); 11 | } 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :quoted 17 | =VAL "Quoted \t 18 | =VAL :block 19 | =VAL |void main() {\n\tprintf("Hello, world!\\n");\n}\n 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "quoted": "Quoted \t", 26 | "block": "void main() {\n\tprintf(\"Hello, world!\\n\");\n}\n" 27 | } 28 | dump: | 29 | quoted: "Quoted \t" 30 | block: | 31 | void main() { 32 | —»printf("Hello, world!\n"); 33 | } 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/J5UC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiple Pair Block Mapping 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/mapping.tml 4 | tags: mapping 5 | yaml: | 6 | foo: blue 7 | bar: arrr 8 | baz: jazz 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :foo 14 | =VAL :blue 15 | =VAL :bar 16 | =VAL :arrr 17 | =VAL :baz 18 | =VAL :jazz 19 | -MAP 20 | -DOC 21 | -STR 22 | json: | 23 | { 24 | "foo": "blue", 25 | "bar": "arrr", 26 | "baz": "jazz" 27 | } 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/J7VC.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Empty Lines Between Mapping Elements 3 | from: NimYAML tests 4 | tags: whitespace mapping 5 | yaml: | 6 | one: 2 7 | 8 | 9 | three: 4 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :one 15 | =VAL :2 16 | =VAL :three 17 | =VAL :4 18 | -MAP 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "one": 2, 24 | "three": 4 25 | } 26 | dump: | 27 | one: 2 28 | three: 4 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/JEF9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Trailing whitespace in streams 3 | from: '@ingydotnet' 4 | tags: literal 5 | yaml: | 6 | - |+ 7 | ↵ 8 | ↵ 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | =VAL |\n\n 14 | -SEQ 15 | -DOC 16 | -STR 17 | json: | 18 | [ 19 | "\n\n" 20 | ] 21 | dump: | 22 | - |+ 23 | ↵ 24 | ↵ 25 | ... 26 | 27 | - yaml: | 28 | - |+ 29 | ␣␣␣ 30 | tree: | 31 | +STR 32 | +DOC 33 | +SEQ 34 | =VAL |\n 35 | -SEQ 36 | -DOC 37 | -STR 38 | json: | 39 | [ 40 | "\n" 41 | ] 42 | dump: | 43 | - |+ 44 | 45 | ... 46 | 47 | - yaml: | 48 | - |+ 49 | ␣␣␣∎ 50 | dump: | 51 | - |+ 52 | 53 | ... 54 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/JKF3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline unidented double quoted block key 3 | from: '@ingydotnet' 4 | tags: indent 5 | fail: true 6 | yaml: | 7 | - - "bar 8 | bar": x 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | +SEQ 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/JQ4R.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.14. Block Sequence 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2797596 4 | tags: mapping spec sequence 5 | yaml: | 6 | block sequence: 7 | - one 8 | - two : three 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :block sequence 14 | +SEQ 15 | =VAL :one 16 | +MAP 17 | =VAL :two 18 | =VAL :three 19 | -MAP 20 | -SEQ 21 | -MAP 22 | -DOC 23 | -STR 24 | json: | 25 | { 26 | "block sequence": [ 27 | "one", 28 | { 29 | "two": "three" 30 | } 31 | ] 32 | } 33 | dump: | 34 | block sequence: 35 | - one 36 | - two: three 37 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/JS2J.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.29. Node Anchors 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2785977 4 | tags: spec alias 5 | yaml: | 6 | First occurrence: &anchor Value 7 | Second occurrence: *anchor 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :First occurrence 13 | =VAL &anchor :Value 14 | =VAL :Second occurrence 15 | =ALI *anchor 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "First occurrence": "Value", 22 | "Second occurrence": "Value" 23 | } 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/JTV5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Mapping with Multiline Scalars 3 | from: NimYAML tests 4 | tags: explicit-key mapping scalar 5 | yaml: | 6 | ? a 7 | true 8 | : null 9 | d 10 | ? e 11 | 42 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :a true 17 | =VAL :null d 18 | =VAL :e 42 19 | =VAL : 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "a true": "null d", 26 | "e 42": null 27 | } 28 | dump: | 29 | a true: null d 30 | e 42: 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/JY7Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Trailing content that looks like a mapping 3 | from: '@perlpunk' 4 | tags: error mapping double 5 | fail: true 6 | yaml: | 7 | key1: "quoted1" 8 | key2: "quoted2" no key: nor value 9 | key3: "quoted3" 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key1 15 | =VAL "quoted1 16 | =VAL :key2 17 | =VAL "quoted2 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/K3WX.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Colon and adjacent value after comment on next line 3 | from: 4 | tags: comment flow mapping 5 | yaml: | 6 | --- 7 | { "foo" # comment 8 | :bar } 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP {} 13 | =VAL "foo 14 | =VAL :bar 15 | -MAP 16 | -DOC 17 | -STR 18 | json: | 19 | { 20 | "foo": "bar" 21 | } 22 | dump: | 23 | --- 24 | "foo": bar 25 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/K4SU.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiple Entry Block Sequence 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/sequence.tml 4 | tags: sequence 5 | yaml: | 6 | - foo 7 | - bar 8 | - 42 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | =VAL :foo 14 | =VAL :bar 15 | =VAL :42 16 | -SEQ 17 | -DOC 18 | -STR 19 | json: | 20 | [ 21 | "foo", 22 | "bar", 23 | 42 24 | ] 25 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/K527.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.6. Line Folding 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2779289 4 | tags: folded spec whitespace scalar 1.3-err 5 | yaml: | 6 | >- 7 | trimmed 8 | ␣␣ 9 | ␣ 10 | 11 | as 12 | space 13 | tree: | 14 | +STR 15 | +DOC 16 | =VAL >trimmed\n\n\nas space 17 | -DOC 18 | -STR 19 | json: | 20 | "trimmed\n\n\nas space" 21 | dump: | 22 | >- 23 | trimmed 24 | 25 | 26 | 27 | as space 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/K54U.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tab after document header 3 | from: '@perlpunk' 4 | tags: header whitespace 5 | yaml: | 6 | ---»scalar 7 | tree: | 8 | +STR 9 | +DOC --- 10 | =VAL :scalar 11 | -DOC 12 | -STR 13 | json: | 14 | "scalar" 15 | dump: | 16 | --- scalar 17 | ... 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/K858.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.6. Empty Scalar Chomping 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2795596 4 | tags: spec folded literal whitespace 5 | yaml: | 6 | strip: >- 7 | 8 | clip: > 9 | 10 | keep: |+ 11 | ↵ 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :strip 17 | =VAL > 18 | =VAL :clip 19 | =VAL > 20 | =VAL :keep 21 | =VAL |\n 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "strip": "", 28 | "clip": "", 29 | "keep": "\n" 30 | } 31 | dump: | 32 | strip: "" 33 | clip: "" 34 | keep: |2+ 35 | 36 | ... 37 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/KH5V.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Inline tabs in double quoted 3 | from: '@ingydotnet' 4 | tags: double whitespace 5 | yaml: | 6 | "1 inline\ttab" 7 | tree: | 8 | +STR 9 | +DOC 10 | =VAL "1 inline\ttab 11 | -DOC 12 | -STR 13 | json: | 14 | "1 inline\ttab" 15 | 16 | - yaml: | 17 | "2 inline\——»tab" 18 | tree: | 19 | +STR 20 | +DOC 21 | =VAL "2 inline\ttab 22 | -DOC 23 | -STR 24 | json: | 25 | "2 inline\ttab" 26 | dump: | 27 | "2 inline\ttab" 28 | 29 | - yaml: | 30 | "3 inline———»tab" 31 | tree: | 32 | +STR 33 | +DOC 34 | =VAL "3 inline\ttab 35 | -DOC 36 | -STR 37 | json: | 38 | "3 inline\ttab" 39 | dump: | 40 | "3 inline\ttab" 41 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/KMK3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Submapping 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/mapping.tml 4 | tags: mapping 5 | yaml: | 6 | foo: 7 | bar: 1 8 | baz: 2 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :foo 14 | +MAP 15 | =VAL :bar 16 | =VAL :1 17 | -MAP 18 | =VAL :baz 19 | =VAL :2 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "foo": { 26 | "bar": 1 27 | }, 28 | "baz": 2 29 | } 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/KS4U.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid item after end of flow sequence 3 | from: '@perlpunk' 4 | tags: error flow sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | [ 9 | sequence item 10 | ] 11 | invalid item 12 | tree: | 13 | +STR 14 | +DOC --- 15 | +SEQ [] 16 | =VAL :sequence item 17 | -SEQ 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/KSS4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Scalars on --- line 3 | from: '@perlpunk' 4 | tags: anchor header scalar 1.3-err 5 | yaml: | 6 | --- "quoted 7 | string" 8 | --- &node foo 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL "quoted string 13 | -DOC 14 | +DOC --- 15 | =VAL &node :foo 16 | -DOC 17 | -STR 18 | json: | 19 | "quoted string" 20 | "foo" 21 | dump: | 22 | --- "quoted string" 23 | --- &node foo 24 | ... 25 | emit: | 26 | --- "quoted string" 27 | --- &node foo 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/L24T.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Trailing line of spaces 3 | from: '@ingydotnet' 4 | tags: whitespace 5 | yaml: | 6 | foo: | 7 | x 8 | ␣␣␣ 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :foo 14 | =VAL |x\n \n 15 | -MAP 16 | -DOC 17 | -STR 18 | json: | 19 | { 20 | "foo" : "x\n \n" 21 | } 22 | emit: | 23 | --- 24 | foo: "x\n \n" 25 | 26 | - yaml: | 27 | foo: | 28 | x 29 | ␣␣␣∎ 30 | tree: | 31 | +STR 32 | +DOC 33 | +MAP 34 | =VAL :foo 35 | =VAL |x\n \n 36 | -MAP 37 | -DOC 38 | -STR 39 | json: | 40 | { 41 | "foo" : "x\n \n" 42 | } 43 | emit: | 44 | --- 45 | foo: "x\n \n" 46 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/L383.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Two scalar docs with trailing comments 3 | from: '@ingydotnet' 4 | tags: comment 5 | yaml: | 6 | --- foo # comment 7 | --- foo # comment 8 | tree: | 9 | +STR 10 | +DOC --- 11 | =VAL :foo 12 | -DOC 13 | +DOC --- 14 | =VAL :foo 15 | -DOC 16 | -STR 17 | json: | 18 | "foo" 19 | "foo" 20 | dump: | 21 | --- foo 22 | --- foo 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/L94M.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tags in Explicit Mapping 3 | from: NimYAML tests 4 | tags: explicit-key tag mapping 5 | yaml: | 6 | ? !!str a 7 | : !!int 47 8 | ? c 9 | : !!str d 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :a 15 | =VAL :47 16 | =VAL :c 17 | =VAL :d 18 | -MAP 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "a": 47, 24 | "c": "d" 25 | } 26 | dump: | 27 | !!str a: !!int 47 28 | c: !!str d 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/L9U5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.11. Plain Implicit Keys 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2789794 4 | tags: spec flow mapping 5 | yaml: | 6 | implicit block key : [ 7 | implicit flow key : value, 8 | ] 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :implicit block key 14 | +SEQ [] 15 | +MAP {} 16 | =VAL :implicit flow key 17 | =VAL :value 18 | -MAP 19 | -SEQ 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "implicit block key": [ 26 | { 27 | "implicit flow key": "value" 28 | } 29 | ] 30 | } 31 | dump: | 32 | implicit block key: 33 | - implicit flow key: value 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/LE5A.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.24. Flow Nodes 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2793490 4 | tags: spec tag alias 5 | yaml: | 6 | - !!str "a" 7 | - 'b' 8 | - &anchor "c" 9 | - *anchor 10 | - !!str 11 | tree: | 12 | +STR 13 | +DOC 14 | +SEQ 15 | =VAL "a 16 | =VAL 'b 17 | =VAL &anchor "c 18 | =ALI *anchor 19 | =VAL : 20 | -SEQ 21 | -DOC 22 | -STR 23 | json: | 24 | [ 25 | "a", 26 | "b", 27 | "c", 28 | "c", 29 | "" 30 | ] 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/LHL4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid tag 3 | from: '@perlpunk' 4 | tags: error tag 5 | fail: true 6 | yaml: | 7 | --- 8 | !invalid{}tag scalar 9 | tree: | 10 | +STR 11 | +DOC --- 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/LP6E.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Whitespace After Scalars in Flow 3 | from: NimYAML tests 4 | tags: flow scalar whitespace 5 | yaml: | 6 | - [a, b , c ] 7 | - { "a" : b 8 | , c : 'd' , 9 | e : "f" 10 | } 11 | - [ ] 12 | tree: | 13 | +STR 14 | +DOC 15 | +SEQ 16 | +SEQ [] 17 | =VAL :a 18 | =VAL :b 19 | =VAL :c 20 | -SEQ 21 | +MAP {} 22 | =VAL "a 23 | =VAL :b 24 | =VAL :c 25 | =VAL 'd 26 | =VAL :e 27 | =VAL "f 28 | -MAP 29 | +SEQ [] 30 | -SEQ 31 | -SEQ 32 | -DOC 33 | -STR 34 | json: | 35 | [ 36 | [ 37 | "a", 38 | "b", 39 | "c" 40 | ], 41 | { 42 | "a": "b", 43 | "c": "d", 44 | "e": "f" 45 | }, 46 | [] 47 | ] 48 | dump: | 49 | - - a 50 | - b 51 | - c 52 | - "a": b 53 | c: 'd' 54 | e: "f" 55 | - [] 56 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/LQZ7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.4. Double Quoted Implicit Keys 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2787420 4 | tags: spec scalar flow 5 | yaml: | 6 | "implicit block key" : [ 7 | "implicit flow key" : value, 8 | ] 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL "implicit block key 14 | +SEQ [] 15 | +MAP {} 16 | =VAL "implicit flow key 17 | =VAL :value 18 | -MAP 19 | -SEQ 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "implicit block key": [ 26 | { 27 | "implicit flow key": "value" 28 | } 29 | ] 30 | } 31 | dump: | 32 | "implicit block key": 33 | - "implicit flow key": value 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/LX3P.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Implicit Flow Mapping Key on one line 3 | from: '@perlpunk' 4 | tags: complex-key mapping flow sequence 1.3-err 5 | yaml: | 6 | [flow]: block 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP 11 | +SEQ [] 12 | =VAL :flow 13 | -SEQ 14 | =VAL :block 15 | -MAP 16 | -DOC 17 | -STR 18 | dump: | 19 | ? - flow 20 | : block 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M29M.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Literal Block Scalar 3 | from: NimYAML tests 4 | tags: literal scalar whitespace 5 | yaml: | 6 | a: | 7 | ab 8 | ␣ 9 | cd 10 | ef 11 | ␣ 12 | 13 | ... 14 | tree: | 15 | +STR 16 | +DOC 17 | +MAP 18 | =VAL :a 19 | =VAL |ab\n\ncd\nef\n 20 | -MAP 21 | -DOC ... 22 | -STR 23 | json: | 24 | { 25 | "a": "ab\n\ncd\nef\n" 26 | } 27 | dump: | 28 | a: | 29 | ab 30 | 31 | cd 32 | ef 33 | ... 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M2N8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Question mark edge cases 3 | from: '@ingydotnet' 4 | tags: edge empty-key 5 | yaml: | 6 | - ? : x 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ 11 | +MAP 12 | +MAP 13 | =VAL : 14 | =VAL :x 15 | -MAP 16 | =VAL : 17 | -MAP 18 | -SEQ 19 | -DOC 20 | -STR 21 | dump: | 22 | - ? : x 23 | : 24 | 25 | - yaml: | 26 | ? []: x 27 | tree: | 28 | +STR 29 | +DOC 30 | +MAP 31 | +MAP 32 | +SEQ [] 33 | -SEQ 34 | =VAL :x 35 | -MAP 36 | =VAL : 37 | -MAP 38 | -DOC 39 | -STR 40 | dump: | 41 | ? []: x 42 | : 43 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M5C3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.21. Block Scalar Nodes 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2799693 4 | tags: indent spec literal folded tag local-tag 1.3-err 5 | yaml: | 6 | literal: |2 7 | value 8 | folded: 9 | !foo 10 | >1 11 | value 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :literal 17 | =VAL |value\n 18 | =VAL :folded 19 | =VAL >value\n 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "literal": "value\n", 26 | "folded": "value\n" 27 | } 28 | dump: | 29 | literal: | 30 | value 31 | folded: !foo > 32 | value 33 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M6YH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block sequence indentation 3 | from: '@ingydotnet' 4 | tags: indent 5 | yaml: | 6 | - | 7 | x 8 | - 9 | foo: bar 10 | - 11 | - 42 12 | tree: | 13 | +STR 14 | +DOC 15 | +SEQ 16 | =VAL |x\n 17 | +MAP 18 | =VAL :foo 19 | =VAL :bar 20 | -MAP 21 | +SEQ 22 | =VAL :42 23 | -SEQ 24 | -SEQ 25 | -DOC 26 | -STR 27 | json: | 28 | [ 29 | "x\n", 30 | { 31 | "foo" : "bar" 32 | }, 33 | [ 34 | 42 35 | ] 36 | ] 37 | dump: | 38 | - | 39 | x 40 | - foo: bar 41 | - - 42 42 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M7A3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 9.3. Bare Documents 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2801226 4 | tags: spec footer 1.3-err 5 | yaml: | 6 | Bare 7 | document 8 | ... 9 | # No document 10 | ... 11 | | 12 | %!PS-Adobe-2.0 # Not the first line 13 | tree: | 14 | +STR 15 | +DOC 16 | =VAL :Bare document 17 | -DOC ... 18 | +DOC 19 | =VAL |%!PS-Adobe-2.0 # Not the first line\n 20 | -DOC 21 | -STR 22 | json: | 23 | "Bare document" 24 | "%!PS-Adobe-2.0 # Not the first line\n" 25 | emit: | 26 | Bare document 27 | ... 28 | | 29 | %!PS-Adobe-2.0 # Not the first line 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M7NX.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nested flow collections 3 | from: '@perlpunk' 4 | tags: flow mapping sequence 5 | yaml: | 6 | --- 7 | { 8 | a: [ 9 | b, c, { 10 | d: [e, f] 11 | } 12 | ] 13 | } 14 | tree: | 15 | +STR 16 | +DOC --- 17 | +MAP {} 18 | =VAL :a 19 | +SEQ [] 20 | =VAL :b 21 | =VAL :c 22 | +MAP {} 23 | =VAL :d 24 | +SEQ [] 25 | =VAL :e 26 | =VAL :f 27 | -SEQ 28 | -MAP 29 | -SEQ 30 | -MAP 31 | -DOC 32 | -STR 33 | json: | 34 | { 35 | "a": [ 36 | "b", 37 | "c", 38 | { 39 | "d": [ 40 | "e", 41 | "f" 42 | ] 43 | } 44 | ] 45 | } 46 | dump: | 47 | --- 48 | a: 49 | - b 50 | - c 51 | - d: 52 | - e 53 | - f 54 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/M9B4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.7. Literal Scalar 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2795789 4 | tags: spec literal scalar whitespace 1.3-err 5 | yaml: | 6 | | 7 | literal 8 | ——»text 9 | ↵ 10 | ↵ 11 | tree: | 12 | +STR 13 | +DOC 14 | =VAL |literal\n\ttext\n 15 | -DOC 16 | -STR 17 | json: | 18 | "literal\n\ttext\n" 19 | dump: | 20 | | 21 | literal 22 | —»text 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/MJS9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.7. Block Folding 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2779603 4 | tags: folded spec scalar whitespace 1.3-err 5 | yaml: | 6 | > 7 | foo␣ 8 | ␣ 9 | —» bar 10 | 11 | baz 12 | tree: | 13 | +STR 14 | +DOC 15 | =VAL >foo \n\n\t bar\n\nbaz\n 16 | -DOC 17 | -STR 18 | json: | 19 | "foo \n\n\t bar\n\nbaz\n" 20 | dump: | 21 | "foo \n\n\t bar\n\nbaz\n" 22 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/MUS6.yaml: -------------------------------------------------------------------------------- 1 | - name: Directive variants 2 | from: '@ingydotnet' 3 | tags: directive 4 | also: ZYU8 5 | fail: true 6 | yaml: | 7 | %YAML 1.1#... 8 | --- 9 | tree: | 10 | +STR 11 | 12 | - fail: true 13 | yaml: | 14 | %YAML 1.2 15 | --- 16 | %YAML 1.2 17 | --- 18 | dump: null 19 | 20 | - yaml: | 21 | %YAML 1.1 22 | --- 23 | tree: | 24 | +STR 25 | +DOC --- 26 | =VAL : 27 | -DOC 28 | -STR 29 | json: | 30 | null 31 | dump: | 32 | --- 33 | 34 | - yaml: | 35 | %YAML ——» 1.1 36 | --- 37 | 38 | - yaml: | 39 | %YAML 1.1 # comment 40 | --- 41 | 42 | - note: These 2 are reserved directives 43 | yaml: | 44 | %YAM 1.1 45 | --- 46 | 47 | - yaml: | 48 | %YAMLL 1.1 49 | --- 50 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/MXS3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Mapping in Block Sequence 3 | from: NimYAML tests 4 | tags: mapping sequence flow 5 | yaml: | 6 | - {a: b} 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ 11 | +MAP {} 12 | =VAL :a 13 | =VAL :b 14 | -MAP 15 | -SEQ 16 | -DOC 17 | -STR 18 | json: | 19 | [ 20 | { 21 | "a": "b" 22 | } 23 | ] 24 | dump: | 25 | - a: b 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/MYW6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block Scalar Strip 3 | from: NimYAML tests 4 | tags: literal scalar whitespace 1.3-err 5 | yaml: | 6 | |- 7 | ab 8 | ␣ 9 | ␣ 10 | ... 11 | tree: | 12 | +STR 13 | +DOC 14 | =VAL |ab 15 | -DOC ... 16 | -STR 17 | json: | 18 | "ab" 19 | dump: | 20 | |- 21 | ab 22 | ... 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/MZX3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Non-Specific Tags on Scalars 3 | from: NimYAML tests 4 | tags: folded scalar 5 | yaml: | 6 | - plain 7 | - "double quoted" 8 | - 'single quoted' 9 | - > 10 | block 11 | - plain again 12 | tree: | 13 | +STR 14 | +DOC 15 | +SEQ 16 | =VAL :plain 17 | =VAL "double quoted 18 | =VAL 'single quoted 19 | =VAL >block\n 20 | =VAL :plain again 21 | -SEQ 22 | -DOC 23 | -STR 24 | json: | 25 | [ 26 | "plain", 27 | "double quoted", 28 | "single quoted", 29 | "block\n", 30 | "plain again" 31 | ] 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/N4JP.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Bad indentation in mapping 3 | from: '@perlpunk' 4 | tags: error mapping indent double 5 | fail: true 6 | yaml: | 7 | map: 8 | key1: "quoted1" 9 | key2: "bad indentation" 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :map 15 | +MAP 16 | =VAL :key1 17 | =VAL "quoted1 18 | -MAP 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/N782.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid document markers in flow style 3 | from: NimYAML tests 4 | tags: flow edge header footer error 5 | fail: true 6 | yaml: | 7 | [ 8 | --- , 9 | ... 10 | ] 11 | tree: | 12 | +STR 13 | +DOC 14 | +SEQ [] 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/NB6Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline plain value with tabs on empty lines 3 | from: '@perlpunk' 4 | tags: scalar whitespace 5 | yaml: | 6 | key: 7 | value 8 | with 9 | —» 10 | tabs 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :key 16 | =VAL :value with\ntabs 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "key": "value with\ntabs" 23 | } 24 | dump: | 25 | key: 'value with 26 | 27 | tabs' 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/NHX8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Empty Lines at End of Document 3 | from: NimYAML tests 4 | tags: empty-key whitespace 5 | yaml: | 6 | : 7 | ↵ 8 | ↵ 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL : 14 | =VAL : 15 | -MAP 16 | -DOC 17 | -STR 18 | emit: | 19 | : 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/NJ66.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline plain flow mapping key 3 | from: '@perlpunk' 4 | tags: flow mapping 5 | yaml: | 6 | --- 7 | - { single line: value} 8 | - { multi 9 | line: value} 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +SEQ 14 | +MAP {} 15 | =VAL :single line 16 | =VAL :value 17 | -MAP 18 | +MAP {} 19 | =VAL :multi line 20 | =VAL :value 21 | -MAP 22 | -SEQ 23 | -DOC 24 | -STR 25 | json: | 26 | [ 27 | { 28 | "single line": "value" 29 | }, 30 | { 31 | "multi line": "value" 32 | } 33 | ] 34 | dump: | 35 | --- 36 | - single line: value 37 | - multi line: value 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/NP9H.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.5. Double Quoted Line Breaks 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2787745 4 | tags: double spec scalar whitespace upto-1.2 5 | yaml: | 6 | "folded␣ 7 | to a space,» 8 | ␣ 9 | to a line feed, or »\ 10 | \ »non-content" 11 | tree: | 12 | +STR 13 | +DOC 14 | =VAL "folded to a space,\nto a line feed, or \t \tnon-content 15 | -DOC 16 | -STR 17 | json: | 18 | "folded to a space,\nto a line feed, or \t \tnon-content" 19 | dump: | 20 | "folded to a space,\nto a line feed, or \t \tnon-content" 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/P2AD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.1. Block Scalar Header 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2793888 4 | tags: spec literal folded comment scalar 5 | yaml: | 6 | - | # Empty header↓ 7 | literal 8 | - >1 # Indentation indicator↓ 9 | folded 10 | - |+ # Chomping indicator↓ 11 | keep 12 | 13 | - >1- # Both indicators↓ 14 | strip 15 | tree: | 16 | +STR 17 | +DOC 18 | +SEQ 19 | =VAL |literal\n 20 | =VAL > folded\n 21 | =VAL |keep\n\n 22 | =VAL > strip 23 | -SEQ 24 | -DOC 25 | -STR 26 | json: | 27 | [ 28 | "literal\n", 29 | " folded\n", 30 | "keep\n\n", 31 | " strip" 32 | ] 33 | dump: | 34 | - | 35 | literal 36 | - >2 37 | folded 38 | - |+ 39 | keep 40 | 41 | - >2- 42 | strip 43 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/P2EQ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid sequene item on same line as previous item 3 | from: '@perlpunk' 4 | tags: error flow mapping sequence 5 | fail: true 6 | yaml: | 7 | --- 8 | - { y: z }- invalid 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ 13 | +MAP {} 14 | =VAL :y 15 | =VAL :z 16 | -MAP 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/P76L.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.19. Secondary Tag Handle 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2782940 4 | tags: spec header tag unknown-tag 5 | yaml: | 6 | %TAG !! tag:example.com,2000:app/ 7 | --- 8 | !!int 1 - 3 # Interval, not integer 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL :1 - 3 13 | -DOC 14 | -STR 15 | json: | 16 | "1 - 3" 17 | dump: | 18 | --- ! 1 - 3 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/P94K.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.11. Multi-Line Comments 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2780696 4 | tags: spec comment 5 | yaml: | 6 | key: # Comment 7 | # lines 8 | value 9 | ↵ 10 | ↵ 11 | tree: | 12 | +STR 13 | +DOC 14 | +MAP 15 | =VAL :key 16 | =VAL :value 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "key": "value" 23 | } 24 | dump: | 25 | key: value 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/PRH3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.9. Single Quoted Lines 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2788756 4 | tags: single spec scalar whitespace upto-1.2 5 | yaml: | 6 | ' 1st non-empty 7 | 8 | 2nd non-empty␣ 9 | ———»3rd non-empty ' 10 | tree: | 11 | +STR 12 | +DOC 13 | =VAL ' 1st non-empty\n2nd non-empty 3rd non-empty␣ 14 | -DOC 15 | -STR 16 | json: | 17 | " 1st non-empty\n2nd non-empty 3rd non-empty " 18 | dump: | 19 | ' 1st non-empty 20 | 21 | 2nd non-empty 3rd non-empty ' 22 | emit: | 23 | ' 1st non-empty 24 | 25 | 2nd non-empty 3rd non-empty ' 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/PUW8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Document start on last line 3 | from: '@perlpunk' 4 | tags: header 5 | yaml: | 6 | --- 7 | a: b 8 | --- 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP 13 | =VAL :a 14 | =VAL :b 15 | -MAP 16 | -DOC 17 | +DOC --- 18 | =VAL : 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "a": "b" 24 | } 25 | null 26 | dump: | 27 | --- 28 | a: b 29 | --- 30 | ... 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/PW8X.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchors on Empty Scalars 3 | from: NimYAML tests 4 | tags: anchor explicit-key 5 | yaml: | 6 | - &a 7 | - a 8 | - 9 | &a : a 10 | b: &b 11 | - 12 | &c : &a 13 | - 14 | ? &d 15 | - 16 | ? &e 17 | : &a 18 | tree: | 19 | +STR 20 | +DOC 21 | +SEQ 22 | =VAL &a : 23 | =VAL :a 24 | +MAP 25 | =VAL &a : 26 | =VAL :a 27 | =VAL :b 28 | =VAL &b : 29 | -MAP 30 | +MAP 31 | =VAL &c : 32 | =VAL &a : 33 | -MAP 34 | +MAP 35 | =VAL &d : 36 | =VAL : 37 | -MAP 38 | +MAP 39 | =VAL &e : 40 | =VAL &a : 41 | -MAP 42 | -SEQ 43 | -DOC 44 | -STR 45 | dump: | 46 | - &a 47 | - a 48 | - &a : a 49 | b: &b 50 | - &c : &a 51 | - &d : 52 | - &e : &a 53 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Q4CL.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Trailing content after quoted value 3 | from: '@perlpunk' 4 | tags: error mapping double 5 | fail: true 6 | yaml: | 7 | key1: "quoted1" 8 | key2: "quoted2" trailing content 9 | key3: "quoted3" 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :key1 15 | =VAL "quoted1 16 | =VAL :key2 17 | =VAL "quoted2 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Q5MG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tab at beginning of line followed by a flow mapping 3 | from: IRC 4 | tags: flow whitespace 5 | yaml: | 6 | ———»{} 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP {} 11 | -MAP 12 | -DOC 13 | -STR 14 | json: | 15 | {} 16 | dump: | 17 | {} 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Q88A.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.23. Flow Content 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2793163 4 | tags: spec flow sequence mapping 5 | yaml: | 6 | - [ a, b ] 7 | - { a: b } 8 | - "a" 9 | - 'b' 10 | - c 11 | tree: | 12 | +STR 13 | +DOC 14 | +SEQ 15 | +SEQ [] 16 | =VAL :a 17 | =VAL :b 18 | -SEQ 19 | +MAP {} 20 | =VAL :a 21 | =VAL :b 22 | -MAP 23 | =VAL "a 24 | =VAL 'b 25 | =VAL :c 26 | -SEQ 27 | -DOC 28 | -STR 29 | json: | 30 | [ 31 | [ 32 | "a", 33 | "b" 34 | ], 35 | { 36 | "a": "b" 37 | }, 38 | "a", 39 | "b", 40 | "c" 41 | ] 42 | dump: | 43 | - - a 44 | - b 45 | - a: b 46 | - "a" 47 | - 'b' 48 | - c 49 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Q8AD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.5. Double Quoted Line Breaks [1.3] 3 | from: NP9H, modified for YAML 1.3 4 | tags: double spec scalar whitespace 1.3-mod 5 | yaml: | 6 | --- 7 | "folded␣ 8 | to a space, 9 | ␣ 10 | to a line feed, or »\ 11 | \ »non-content" 12 | tree: | 13 | +STR 14 | +DOC --- 15 | =VAL "folded to a space,\nto a line feed, or \t \tnon-content 16 | -DOC 17 | -STR 18 | json: | 19 | "folded to a space,\nto a line feed, or \t \tnon-content" 20 | dump: | 21 | "folded to a space,\nto a line feed, or \t \tnon-content" 22 | emit: | 23 | --- "folded to a space,\nto a line feed, or \t \tnon-content" 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Q9WF.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.12. Separation Spaces 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2780989 4 | tags: complex-key flow spec comment whitespace 1.3-err 5 | yaml: | 6 | { first: Sammy, last: Sosa }: 7 | # Statistics: 8 | hr: # Home runs 9 | 65 10 | avg: # Average 11 | 0.278 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | +MAP {} 17 | =VAL :first 18 | =VAL :Sammy 19 | =VAL :last 20 | =VAL :Sosa 21 | -MAP 22 | +MAP 23 | =VAL :hr 24 | =VAL :65 25 | =VAL :avg 26 | =VAL :0.278 27 | -MAP 28 | -MAP 29 | -DOC 30 | -STR 31 | dump: | 32 | ? first: Sammy 33 | last: Sosa 34 | : hr: 65 35 | avg: 0.278 36 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/QB6E.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wrong indented multiline quoted scalar 3 | from: '@perlpunk' 4 | tags: double error indent 5 | fail: true 6 | yaml: | 7 | --- 8 | quoted: "a 9 | b 10 | c" 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :quoted 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/QF4Y.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.19. Single Pair Flow Mappings 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2792291 4 | tags: spec flow mapping 5 | yaml: | 6 | [ 7 | foo: bar 8 | ] 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ [] 13 | +MAP {} 14 | =VAL :foo 15 | =VAL :bar 16 | -MAP 17 | -SEQ 18 | -DOC 19 | -STR 20 | json: | 21 | [ 22 | { 23 | "foo": "bar" 24 | } 25 | ] 26 | dump: | 27 | - foo: bar 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/QLJ7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Tag shorthand used in documents but only defined in the first 3 | from: IRC 4 | tags: error directive tag 5 | fail: true 6 | yaml: | 7 | %TAG !prefix! tag:example.com,2011: 8 | --- !prefix!A 9 | a: b 10 | --- !prefix!B 11 | c: d 12 | --- !prefix!C 13 | e: f 14 | tree: | 15 | +STR 16 | +DOC --- 17 | +MAP 18 | =VAL :a 19 | =VAL :b 20 | -MAP 21 | -DOC 22 | +DOC --- 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/QT73.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment and document-end marker 3 | from: '@perlpunk' 4 | tags: comment footer 5 | yaml: | 6 | # comment 7 | ... 8 | tree: | 9 | +STR 10 | -STR 11 | json: '' 12 | dump: '' 13 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/R4YG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.2. Block Indentation Indicator 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2794311 4 | tags: spec literal folded scalar whitespace libyaml-err upto-1.2 5 | yaml: | 6 | - | 7 | detected 8 | - > 9 | ␣ 10 | ␣␣ 11 | # detected 12 | - |1 13 | explicit 14 | - > 15 | ——» 16 | detected 17 | tree: | 18 | +STR 19 | +DOC 20 | +SEQ 21 | =VAL |detected\n 22 | =VAL >\n\n# detected\n 23 | =VAL | explicit\n 24 | =VAL >\t\ndetected\n 25 | -SEQ 26 | -DOC 27 | -STR 28 | json: | 29 | [ 30 | "detected\n", 31 | "\n\n# detected\n", 32 | " explicit\n", 33 | "\t\ndetected\n" 34 | ] 35 | dump: | 36 | - | 37 | detected 38 | - >2 39 | 40 | 41 | # detected 42 | - |2 43 | explicit 44 | - "\t\ndetected\n" 45 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/R52L.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nested flow mapping sequence and mappings 3 | from: '@perlpunk' 4 | tags: flow mapping sequence 5 | yaml: | 6 | --- 7 | { top1: [item1, {key2: value2}, item3], top2: value2 } 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +MAP {} 12 | =VAL :top1 13 | +SEQ [] 14 | =VAL :item1 15 | +MAP {} 16 | =VAL :key2 17 | =VAL :value2 18 | -MAP 19 | =VAL :item3 20 | -SEQ 21 | =VAL :top2 22 | =VAL :value2 23 | -MAP 24 | -DOC 25 | -STR 26 | json: | 27 | { 28 | "top1": [ 29 | "item1", 30 | { 31 | "key2": "value2" 32 | }, 33 | "item3" 34 | ], 35 | "top2": "value2" 36 | } 37 | dump: | 38 | --- 39 | top1: 40 | - item1 41 | - key2: value2 42 | - item3 43 | top2: value2 44 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/RHX7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: YAML directive without document end marker 3 | from: '@perlpunk' 4 | tags: directive error 5 | fail: true 6 | yaml: | 7 | --- 8 | key: value 9 | %YAML 1.2 10 | --- 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :key 16 | =VAL :value 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/RLU9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Sequence Indent 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/indent.tml 4 | tags: sequence indent 5 | yaml: | 6 | foo: 7 | - 42 8 | bar: 9 | - 44 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :foo 15 | +SEQ 16 | =VAL :42 17 | -SEQ 18 | =VAL :bar 19 | +SEQ 20 | =VAL :44 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "foo": [ 28 | 42 29 | ], 30 | "bar": [ 31 | 44 32 | ] 33 | } 34 | dump: | 35 | foo: 36 | - 42 37 | bar: 38 | - 44 39 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/RR7F.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Mixed Block Mapping (implicit to explicit) 3 | from: NimYAML tests 4 | tags: explicit-key mapping 5 | yaml: | 6 | a: 4.2 7 | ? d 8 | : 23 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :a 14 | =VAL :4.2 15 | =VAL :d 16 | =VAL :23 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "d": 23, 23 | "a": 4.2 24 | } 25 | dump: | 26 | a: 4.2 27 | d: 23 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/RTP8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 9.2. Document Markers 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2800866 4 | tags: spec header footer 5 | yaml: | 6 | %YAML 1.2 7 | --- 8 | Document 9 | ... # Suffix 10 | tree: | 11 | +STR 12 | +DOC --- 13 | =VAL :Document 14 | -DOC ... 15 | -STR 16 | json: | 17 | "Document" 18 | dump: | 19 | --- Document 20 | ... 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/RXY3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid document-end marker in single quoted string 3 | from: '@perlpunk' 4 | tags: footer single error 5 | fail: true 6 | yaml: | 7 | --- 8 | ' 9 | ... 10 | ' 11 | tree: | 12 | +STR 13 | +DOC --- 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/S3PD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.18. Implicit Block Mapping Entries 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2798896 4 | tags: empty-key spec mapping 5 | yaml: | 6 | plain key: in-line value 7 | : # Both empty 8 | "quoted key": 9 | - entry 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :plain key 15 | =VAL :in-line value 16 | =VAL : 17 | =VAL : 18 | =VAL "quoted key 19 | +SEQ 20 | =VAL :entry 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | emit: | 26 | plain key: in-line value 27 | : 28 | "quoted key": 29 | - entry 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/S4GJ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid text after block scalar indicator 3 | from: '@perlpunk' 4 | tags: error folded 5 | fail: true 6 | yaml: | 7 | --- 8 | folded: > first line 9 | second line 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +MAP 14 | =VAL :folded 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/S4JQ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.28. Non-Specific Tags 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2785512 4 | tags: spec tag 5 | yaml: | 6 | # Assuming conventional resolution: 7 | - "12" 8 | - 12 9 | - ! 12 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL "12 15 | =VAL :12 16 | =VAL :12 17 | -SEQ 18 | -DOC 19 | -STR 20 | json: | 21 | [ 22 | "12", 23 | 12, 24 | "12" 25 | ] 26 | dump: | 27 | - "12" 28 | - 12 29 | - ! 12 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/S4T7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Document with footer 3 | from: https://github.com/ingydotnet/yaml-pegex-pm/blob/master/test/footer.tml 4 | tags: mapping footer 5 | yaml: | 6 | aaa: bbb 7 | ... 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :aaa 13 | =VAL :bbb 14 | -MAP 15 | -DOC ... 16 | -STR 17 | json: | 18 | { 19 | "aaa": "bbb" 20 | } 21 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/S7BG.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Colon followed by comma 3 | from: '@perlpunk' 4 | tags: scalar 5 | yaml: | 6 | --- 7 | - :, 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +SEQ 12 | =VAL ::, 13 | -SEQ 14 | -DOC 15 | -STR 16 | json: | 17 | [ 18 | ":," 19 | ] 20 | dump: | 21 | --- 22 | - :, 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/S98Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Block scalar with more spaces than first content line 3 | from: '@perlpunk' 4 | tags: error folded comment scalar whitespace 5 | fail: true 6 | yaml: | 7 | empty block scalar: > 8 | ␣ 9 | ␣␣ 10 | ␣␣␣ 11 | # comment 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :empty block scalar 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SBG9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow Sequence in Flow Mapping 3 | from: NimYAML tests 4 | tags: complex-key sequence mapping flow 5 | yaml: | 6 | {a: [b, c], [d, e]: f} 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP {} 11 | =VAL :a 12 | +SEQ [] 13 | =VAL :b 14 | =VAL :c 15 | -SEQ 16 | +SEQ [] 17 | =VAL :d 18 | =VAL :e 19 | -SEQ 20 | =VAL :f 21 | -MAP 22 | -DOC 23 | -STR 24 | dump: | 25 | a: 26 | - b 27 | - c 28 | ? - d 29 | - e 30 | : f 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SF5V.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Duplicate YAML directive 3 | from: '@perlpunk' 4 | tags: directive error 5 | fail: true 6 | yaml: | 7 | %YAML 1.2 8 | %YAML 1.2 9 | --- 10 | tree: | 11 | +STR 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SKE5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor before zero indented sequence 3 | from: '@perlpunk' 4 | tags: anchor indent sequence 5 | yaml: | 6 | --- 7 | seq: 8 | &anchor 9 | - a 10 | - b 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :seq 16 | +SEQ &anchor 17 | =VAL :a 18 | =VAL :b 19 | -SEQ 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "seq": [ 26 | "a", 27 | "b" 28 | ] 29 | } 30 | dump: | 31 | --- 32 | seq: &anchor 33 | - a 34 | - b 35 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SM9W.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Single character streams 3 | from: '@ingydotnet' 4 | tags: sequence 5 | yaml: | 6 | -∎ 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ 11 | =VAL : 12 | -SEQ 13 | -DOC 14 | -STR 15 | json: | 16 | [null] 17 | dump: | 18 | - 19 | 20 | - tags: mapping 21 | yaml: | 22 | :∎ 23 | tree: | 24 | +STR 25 | +DOC 26 | +MAP 27 | =VAL : 28 | =VAL : 29 | -MAP 30 | -DOC 31 | -STR 32 | json: null 33 | dump: | 34 | : 35 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SR86.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor plus Alias 3 | from: '@perlpunk' 4 | tags: alias error 5 | fail: true 6 | yaml: | 7 | key1: &a value 8 | key2: &b *a 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :key1 14 | =VAL &a :value 15 | =VAL :key2 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SSW6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.7. Single Quoted Characters [1.3] 3 | from: 4GC6, modified for YAML 1.3 4 | tags: spec scalar single 1.3-mod 5 | yaml: | 6 | --- 7 | 'here''s to "quotes"' 8 | tree: | 9 | +STR 10 | +DOC --- 11 | =VAL 'here's to "quotes" 12 | -DOC 13 | -STR 14 | json: | 15 | "here's to \"quotes\"" 16 | dump: | 17 | --- 'here''s to "quotes"' 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SU5Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment without whitespace after doublequoted scalar 3 | from: '@perlpunk' 4 | tags: comment error double whitespace 5 | fail: true 6 | yaml: | 7 | key: "value"# invalid comment 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :key 13 | =VAL "value 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SU74.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor and alias as mapping key 3 | from: '@perlpunk' 4 | tags: error anchor alias mapping 5 | fail: true 6 | yaml: | 7 | key1: &alias value1 8 | &b *alias : value2 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :key1 14 | =VAL &alias :value1 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SY6V.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor before sequence entry on same line 3 | from: '@perlpunk' 4 | tags: anchor error sequence 5 | fail: true 6 | yaml: | 7 | &anchor - sequence entry 8 | tree: | 9 | +STR 10 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/SYW4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 2.2. Mapping Scalars to Scalars 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2759963 4 | tags: spec scalar comment 5 | yaml: | 6 | hr: 65 # Home runs 7 | avg: 0.278 # Batting average 8 | rbi: 147 # Runs Batted In 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :hr 14 | =VAL :65 15 | =VAL :avg 16 | =VAL :0.278 17 | =VAL :rbi 18 | =VAL :147 19 | -MAP 20 | -DOC 21 | -STR 22 | json: | 23 | { 24 | "hr": 65, 25 | "avg": 0.278, 26 | "rbi": 147 27 | } 28 | dump: | 29 | hr: 65 30 | avg: 0.278 31 | rbi: 147 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/T26H.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.8. Literal Content [1.3] 3 | from: DWX9, modified for YAML 1.3 4 | tags: spec literal scalar comment whitespace 1.3-mod 5 | yaml: | 6 | --- | 7 | ␣ 8 | ␣␣ 9 | literal 10 | ␣␣␣ 11 | ␣␣ 12 | text 13 | 14 | # Comment 15 | tree: | 16 | +STR 17 | +DOC --- 18 | =VAL |\n\nliteral\n \n\ntext\n 19 | -DOC 20 | -STR 21 | json: | 22 | "\n\nliteral\n \n\ntext\n" 23 | dump: | 24 | "\n\nliteral\n \n\ntext\n" 25 | emit: | 26 | --- | 27 | 28 | 29 | literal 30 | ␣␣␣ 31 | 32 | text 33 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/T4YY.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.9. Single Quoted Lines [1.3] 3 | from: PRH3, modified for YAML 1.3 4 | tags: single spec scalar whitespace 1.3-mod 5 | yaml: | 6 | --- 7 | ' 1st non-empty 8 | 9 | 2nd non-empty␣ 10 | 3rd non-empty ' 11 | tree: | 12 | +STR 13 | +DOC --- 14 | =VAL ' 1st non-empty\n2nd non-empty 3rd non-empty␣ 15 | -DOC 16 | -STR 17 | json: | 18 | " 1st non-empty\n2nd non-empty 3rd non-empty " 19 | dump: | 20 | ' 1st non-empty 21 | 22 | 2nd non-empty 3rd non-empty ' 23 | emit: | 24 | --- ' 1st non-empty 25 | 26 | 2nd non-empty 3rd non-empty ' 27 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/T5N4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.7. Literal Scalar [1.3] 3 | from: M9B4, modified for YAML 1.3 4 | tags: spec literal scalar whitespace 1.3-mod 5 | yaml: | 6 | --- | 7 | literal 8 | ——»text 9 | ↵ 10 | ↵ 11 | tree: | 12 | +STR 13 | +DOC --- 14 | =VAL |literal\n\ttext\n 15 | -DOC 16 | -STR 17 | json: | 18 | "literal\n\ttext\n" 19 | dump: | 20 | "literal\n\ttext\n" 21 | emit: | 22 | --- | 23 | literal 24 | —»text 25 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/T833.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow mapping missing a separating comma 3 | from: '@perlpunk' 4 | tags: error flow mapping 5 | fail: true 6 | yaml: | 7 | --- 8 | { 9 | foo: 1 10 | bar: 2 } 11 | tree: | 12 | +STR 13 | +DOC --- 14 | +MAP 15 | =VAL :foo 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/TD5N.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid scalar after sequence 3 | from: '@perlpunk' 4 | tags: error sequence scalar 5 | fail: true 6 | yaml: | 7 | - item1 8 | - item2 9 | invalid 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL :item1 15 | =VAL :item2 16 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/TE2A.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.16. Block Mappings 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2798147 4 | tags: spec mapping 5 | yaml: | 6 | block mapping: 7 | key: value 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :block mapping 13 | +MAP 14 | =VAL :key 15 | =VAL :value 16 | -MAP 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "block mapping": { 23 | "key": "value" 24 | } 25 | } 26 | dump: | 27 | block mapping: 28 | key: value 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/TL85.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.8. Flow Folding 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2779950 4 | tags: double spec whitespace scalar upto-1.2 5 | yaml: | 6 | " 7 | foo␣ 8 | ␣ 9 | —» bar 10 | 11 | baz 12 | " 13 | tree: | 14 | +STR 15 | +DOC 16 | =VAL " foo\nbar\nbaz␣ 17 | -DOC 18 | -STR 19 | json: | 20 | " foo\nbar\nbaz " 21 | dump: | 22 | " foo\nbar\nbaz " 23 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/TS54.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Folded Block Scalar 3 | from: NimYAML tests 4 | tags: folded scalar 1.3-err 5 | yaml: | 6 | > 7 | ab 8 | cd 9 | ␣ 10 | ef 11 | 12 | 13 | gh 14 | tree: | 15 | +STR 16 | +DOC 17 | =VAL >ab cd\nef\n\ngh\n 18 | -DOC 19 | -STR 20 | json: | 21 | "ab cd\nef\n\ngh\n" 22 | dump: | 23 | > 24 | ab cd 25 | 26 | ef 27 | 28 | 29 | gh 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/U3C3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.16. “TAG” directive 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2782252 4 | tags: spec header tag 5 | yaml: | 6 | %TAG !yaml! tag:yaml.org,2002: 7 | --- 8 | !yaml!str "foo" 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL "foo 13 | -DOC 14 | -STR 15 | json: | 16 | "foo" 17 | dump: | 18 | --- !!str "foo" 19 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/U44R.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Bad indentation in mapping (2) 3 | from: '@perlpunk' 4 | tags: error mapping indent double 5 | fail: true 6 | yaml: | 7 | map: 8 | key1: "quoted1" 9 | key2: "bad indentation" 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :map 15 | +MAP 16 | =VAL :key1 17 | =VAL "quoted1 18 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/U99R.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid comma in tag 3 | from: '@perlpunk' 4 | tags: error tag 5 | fail: true 6 | yaml: | 7 | - !!str, xxx 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/UDM2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Plain URL in flow mapping 3 | from: https://github.com/yaml/libyaml/pull/28 4 | tags: flow scalar 5 | yaml: | 6 | - { url: http://example.org } 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ 11 | +MAP {} 12 | =VAL :url 13 | =VAL :http://example.org 14 | -MAP 15 | -SEQ 16 | -DOC 17 | -STR 18 | json: | 19 | [ 20 | { 21 | "url": "http://example.org" 22 | } 23 | ] 24 | dump: | 25 | - url: http://example.org 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/UDR7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 5.4. Flow Collection Indicators 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2772813 4 | tags: spec flow sequence mapping 5 | yaml: | 6 | sequence: [ one, two, ] 7 | mapping: { sky: blue, sea: green } 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :sequence 13 | +SEQ [] 14 | =VAL :one 15 | =VAL :two 16 | -SEQ 17 | =VAL :mapping 18 | +MAP {} 19 | =VAL :sky 20 | =VAL :blue 21 | =VAL :sea 22 | =VAL :green 23 | -MAP 24 | -MAP 25 | -DOC 26 | -STR 27 | json: | 28 | { 29 | "sequence": [ 30 | "one", 31 | "two" 32 | ], 33 | "mapping": { 34 | "sky": "blue", 35 | "sea": "green" 36 | } 37 | } 38 | dump: | 39 | sequence: 40 | - one 41 | - two 42 | mapping: 43 | sky: blue 44 | sea: green 45 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/UKK6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Syntax character edge cases 3 | from: '@ingydotnet' 4 | tags: edge empty-key 5 | yaml: | 6 | - : 7 | tree: | 8 | +STR 9 | +DOC 10 | +SEQ 11 | +MAP 12 | =VAL : 13 | =VAL : 14 | -MAP 15 | -SEQ 16 | -DOC 17 | -STR 18 | 19 | - yaml: | 20 | :: 21 | tree: | 22 | +STR 23 | +DOC 24 | +MAP 25 | =VAL :: 26 | =VAL : 27 | -MAP 28 | -DOC 29 | -STR 30 | json: | 31 | { 32 | ":": null 33 | } 34 | 35 | - yaml: | 36 | ! 37 | tree: | 38 | +STR 39 | +DOC 40 | =VAL : 41 | -DOC 42 | -STR 43 | json: null 44 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/UT92.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 9.4. Explicit Documents 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2801448 4 | tags: flow spec header footer comment 5 | yaml: | 6 | --- 7 | { matches 8 | % : 20 } 9 | ... 10 | --- 11 | # Empty 12 | ... 13 | tree: | 14 | +STR 15 | +DOC --- 16 | +MAP {} 17 | =VAL :matches % 18 | =VAL :20 19 | -MAP 20 | -DOC ... 21 | +DOC --- 22 | =VAL : 23 | -DOC ... 24 | -STR 25 | json: | 26 | { 27 | "matches %": 20 28 | } 29 | null 30 | dump: | 31 | --- 32 | matches %: 20 33 | ... 34 | --- 35 | ... 36 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/UV7Q.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Legal tab after indentation 3 | from: '@ingydotnet' 4 | tags: indent whitespace 5 | yaml: | 6 | x: 7 | - x 8 | ——»x 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :x 14 | +SEQ 15 | =VAL :x x 16 | -SEQ 17 | -MAP 18 | -DOC 19 | -STR 20 | json: | 21 | { 22 | "x": [ 23 | "x x" 24 | ] 25 | } 26 | dump: | 27 | x: 28 | - x x 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/V55R.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Aliases in Block Sequence 3 | from: NimYAML tests 4 | tags: alias sequence 5 | yaml: | 6 | - &a a 7 | - &b b 8 | - *a 9 | - *b 10 | tree: | 11 | +STR 12 | +DOC 13 | +SEQ 14 | =VAL &a :a 15 | =VAL &b :b 16 | =ALI *a 17 | =ALI *b 18 | -SEQ 19 | -DOC 20 | -STR 21 | json: | 22 | [ 23 | "a", 24 | "b", 25 | "a", 26 | "b" 27 | ] 28 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/V9D5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.19. Compact Block Mappings 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2799091 4 | tags: complex-key explicit-key spec mapping 5 | yaml: | 6 | - sun: yellow 7 | - ? earth: blue 8 | : moon: white 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | +MAP 14 | =VAL :sun 15 | =VAL :yellow 16 | -MAP 17 | +MAP 18 | +MAP 19 | =VAL :earth 20 | =VAL :blue 21 | -MAP 22 | +MAP 23 | =VAL :moon 24 | =VAL :white 25 | -MAP 26 | -MAP 27 | -SEQ 28 | -DOC 29 | -STR 30 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/VJP3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Flow collections over many lines 3 | from: '@ingydotnet' 4 | tags: flow indent 5 | fail: true 6 | yaml: | 7 | k: { 8 | k 9 | : 10 | v 11 | } 12 | tree: | 13 | +STR 14 | +DOC 15 | +MAP 16 | =VAL :k 17 | +MAP {} 18 | 19 | - yaml: | 20 | k: { 21 | k 22 | : 23 | v 24 | } 25 | tree: | 26 | +STR 27 | +DOC 28 | +MAP 29 | =VAL :k 30 | +MAP {} 31 | =VAL :k 32 | =VAL :v 33 | -MAP 34 | -MAP 35 | -DOC 36 | -STR 37 | json: | 38 | { 39 | "k" : { 40 | "k" : "v" 41 | } 42 | } 43 | dump: | 44 | --- 45 | k: 46 | k: v 47 | emit: | 48 | k: 49 | k: v 50 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/W42U.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.15. Block Sequence Entry Types 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2797944 4 | tags: comment spec literal sequence 5 | yaml: | 6 | - # Empty 7 | - | 8 | block node 9 | - - one # Compact 10 | - two # sequence 11 | - one: two # Compact mapping 12 | tree: | 13 | +STR 14 | +DOC 15 | +SEQ 16 | =VAL : 17 | =VAL |block node\n 18 | +SEQ 19 | =VAL :one 20 | =VAL :two 21 | -SEQ 22 | +MAP 23 | =VAL :one 24 | =VAL :two 25 | -MAP 26 | -SEQ 27 | -DOC 28 | -STR 29 | json: | 30 | [ 31 | null, 32 | "block node\n", 33 | [ 34 | "one", 35 | "two" 36 | ], 37 | { 38 | "one": "two" 39 | } 40 | ] 41 | dump: | 42 | - 43 | - | 44 | block node 45 | - - one 46 | - two 47 | - one: two 48 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/W4TN.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 9.5. Directives Documents 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2801606 4 | tags: spec header footer 1.3-err 5 | yaml: | 6 | %YAML 1.2 7 | --- | 8 | %!PS-Adobe-2.0 9 | ... 10 | %YAML 1.2 11 | --- 12 | # Empty 13 | ... 14 | tree: | 15 | +STR 16 | +DOC --- 17 | =VAL |%!PS-Adobe-2.0\n 18 | -DOC ... 19 | +DOC --- 20 | =VAL : 21 | -DOC ... 22 | -STR 23 | json: | 24 | "%!PS-Adobe-2.0\n" 25 | null 26 | dump: | 27 | --- | 28 | %!PS-Adobe-2.0 29 | ... 30 | --- 31 | ... 32 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/W5VH.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Allowed characters in alias 3 | from: '@perlpunk' 4 | tags: alias 1.3-err 5 | yaml: | 6 | a: &:@*!$": scalar a 7 | b: *:@*!$": 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :a 13 | =VAL &:@*!$": :scalar a 14 | =VAL :b 15 | =ALI *:@*!$": 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "a": "scalar a", 22 | "b": "scalar a" 23 | } 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/W9L4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Literal block scalar with more spaces in first line 3 | from: '@perlpunk' 4 | tags: error literal whitespace 5 | fail: true 6 | yaml: | 7 | --- 8 | block scalar: | 9 | ␣␣␣␣␣ 10 | more spaces at the beginning 11 | are invalid 12 | tree: | 13 | +STR 14 | +DOC --- 15 | +MAP 16 | =VAL :block scalar 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/WZ62.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 7.2. Empty Content 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2786720 4 | tags: spec flow scalar tag 5 | yaml: | 6 | { 7 | foo : !!str, 8 | !!str : bar, 9 | } 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP {} 14 | =VAL :foo 15 | =VAL : 16 | =VAL : 17 | =VAL :bar 18 | -MAP 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "foo": "", 24 | "": "bar" 25 | } 26 | dump: | 27 | foo: !!str 28 | !!str : bar 29 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/X38W.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Aliases in Flow Objects 3 | from: NimYAML tests 4 | tags: alias complex-key flow 5 | yaml: | 6 | { &a [a, &b b]: *b, *a : [c, *b, d]} 7 | tree: | 8 | +STR 9 | +DOC 10 | +MAP {} 11 | +SEQ [] &a 12 | =VAL :a 13 | =VAL &b :b 14 | -SEQ 15 | =ALI *b 16 | =ALI *a 17 | +SEQ [] 18 | =VAL :c 19 | =ALI *b 20 | =VAL :d 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | dump: | 26 | ? &a 27 | - a 28 | - &b b 29 | : *b 30 | *a : 31 | - c 32 | - *b 33 | - d 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/X4QW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Comment without whitespace after block scalar indicator 3 | from: '@perlpunk' 4 | tags: folded comment error whitespace 5 | fail: true 6 | yaml: | 7 | block: ># comment 8 | scalar 9 | tree: | 10 | +STR 11 | +DOC 12 | +MAP 13 | =VAL :block 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/X8DW.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Explicit key and value seperated by comment 3 | from: '@perlpunk' 4 | tags: comment explicit-key mapping 5 | yaml: | 6 | --- 7 | ? key 8 | # comment 9 | : value 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +MAP 14 | =VAL :key 15 | =VAL :value 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "key": "value" 22 | } 23 | dump: | 24 | --- 25 | key: value 26 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/XLQ9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Multiline scalar that looks like a YAML directive 3 | from: '@perlpunk' 4 | tags: directive scalar 5 | yaml: | 6 | --- 7 | scalar 8 | %YAML 1.2 9 | tree: | 10 | +STR 11 | +DOC --- 12 | =VAL :scalar %YAML 1.2 13 | -DOC 14 | -STR 15 | json: | 16 | "scalar %YAML 1.2" 17 | dump: | 18 | --- scalar %YAML 1.2 19 | ... 20 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/XV9V.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.5. Empty Lines [1.3] 3 | from: 5GBF, modified for YAML 1.3 4 | tags: literal spec scalar 1.3-mod 5 | yaml: | 6 | Folding: 7 | "Empty line 8 | 9 | as a line feed" 10 | Chomping: | 11 | Clipped empty lines 12 | ␣ 13 | ↵ 14 | tree: | 15 | +STR 16 | +DOC 17 | +MAP 18 | =VAL :Folding 19 | =VAL "Empty line\nas a line feed 20 | =VAL :Chomping 21 | =VAL |Clipped empty lines\n 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "Folding": "Empty line\nas a line feed", 28 | "Chomping": "Clipped empty lines\n" 29 | } 30 | dump: | 31 | Folding: "Empty line\nas a line feed" 32 | Chomping: | 33 | Clipped empty lines 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Y2GN.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchor with colon in the middle 3 | from: '@perlpunk' 4 | tags: anchor 5 | yaml: | 6 | --- 7 | key: &an:chor value 8 | tree: | 9 | +STR 10 | +DOC --- 11 | +MAP 12 | =VAL :key 13 | =VAL &an:chor :value 14 | -MAP 15 | -DOC 16 | -STR 17 | json: | 18 | { 19 | "key": "value" 20 | } 21 | dump: | 22 | --- 23 | key: &an:chor value 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/YJV2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Dash in flow sequence 3 | from: '@ingydotnet' 4 | tags: flow sequence 5 | fail: true 6 | yaml: | 7 | [-] 8 | tree: | 9 | +STR 10 | +DOC 11 | +SEQ [] 12 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Z67P.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 8.21. Block Scalar Nodes [1.3] 3 | from: M5C3, modified for YAML 1.3 4 | tags: indent spec literal folded tag local-tag 1.3-mod 5 | yaml: | 6 | literal: |2 7 | value 8 | folded: !foo >1 9 | value 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP 14 | =VAL :literal 15 | =VAL |value\n 16 | =VAL :folded 17 | =VAL >value\n 18 | -MAP 19 | -DOC 20 | -STR 21 | json: | 22 | { 23 | "literal": "value\n", 24 | "folded": "value\n" 25 | } 26 | dump: | 27 | literal: | 28 | value 29 | folded: !foo > 30 | value 31 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/Z9M4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Spec Example 6.22. Global Tag Prefix 3 | from: http://www.yaml.org/spec/1.2/spec.html#id2783726 4 | tags: spec header tag unknown-tag 5 | yaml: | 6 | %TAG !e! tag:example.com,2000:app/ 7 | --- 8 | - !e!foo "bar" 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +SEQ 13 | =VAL "bar 14 | -SEQ 15 | -DOC 16 | -STR 17 | json: | 18 | [ 19 | "bar" 20 | ] 21 | dump: | 22 | --- 23 | - ! "bar" 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZCZ6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid mapping in plain single line value 3 | from: https://gist.github.com/anonymous/0c8db51d151baf8113205ba3ce71d1b4 via @ingydotnet 4 | tags: error mapping scalar 5 | fail: true 6 | yaml: | 7 | a: b: c: d 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL :a 13 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZH7C.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Anchors in Mapping 3 | from: NimYAML tests 4 | tags: anchor mapping 5 | yaml: | 6 | &a a: b 7 | c: &d d 8 | tree: | 9 | +STR 10 | +DOC 11 | +MAP 12 | =VAL &a :a 13 | =VAL :b 14 | =VAL :c 15 | =VAL &d :d 16 | -MAP 17 | -DOC 18 | -STR 19 | json: | 20 | { 21 | "a": "b", 22 | "c": "d" 23 | } 24 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZK9H.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nested top level flow mapping 3 | from: '@perlpunk' 4 | tags: flow indent mapping sequence 5 | yaml: | 6 | { key: [[[ 7 | value 8 | ]]] 9 | } 10 | tree: | 11 | +STR 12 | +DOC 13 | +MAP {} 14 | =VAL :key 15 | +SEQ [] 16 | +SEQ [] 17 | +SEQ [] 18 | =VAL :value 19 | -SEQ 20 | -SEQ 21 | -SEQ 22 | -MAP 23 | -DOC 24 | -STR 25 | json: | 26 | { 27 | "key": [ 28 | [ 29 | [ 30 | "value" 31 | ] 32 | ] 33 | ] 34 | } 35 | dump: | 36 | key: 37 | - - - value 38 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZL4Z.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Invalid nested mapping 3 | from: '@perlpunk' 4 | tags: error mapping 5 | fail: true 6 | yaml: | 7 | --- 8 | a: 'b': c 9 | tree: | 10 | +STR 11 | +DOC --- 12 | +MAP 13 | =VAL :a 14 | =VAL 'b 15 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZVH3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wrong indented sequence item 3 | from: '@perlpunk' 4 | tags: error sequence indent 5 | fail: true 6 | yaml: | 7 | - key: value 8 | - item1 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ 13 | +MAP 14 | =VAL :key 15 | =VAL :value 16 | -MAP 17 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZWK4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Key with anchor after missing explicit mapping value 3 | from: '@perlpunk' 4 | tags: anchor explicit-key mapping 5 | yaml: | 6 | --- 7 | a: 1 8 | ? b 9 | &anchor c: 3 10 | tree: | 11 | +STR 12 | +DOC --- 13 | +MAP 14 | =VAL :a 15 | =VAL :1 16 | =VAL :b 17 | =VAL : 18 | =VAL &anchor :c 19 | =VAL :3 20 | -MAP 21 | -DOC 22 | -STR 23 | json: | 24 | { 25 | "a": 1, 26 | "b": null, 27 | "c": 3 28 | } 29 | dump: | 30 | --- 31 | a: 1 32 | b: 33 | &anchor c: 3 34 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZXT5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Implicit key followed by newline and adjacent value 3 | from: '@perlpunk' 4 | tags: error flow mapping sequence 5 | fail: true 6 | yaml: | 7 | [ "key" 8 | :value ] 9 | tree: | 10 | +STR 11 | +DOC 12 | +SEQ [] 13 | =VAL "key 14 | -------------------------------------------------------------------------------- /parser/tests/yaml-test-suite/src/ZYU8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - skip: true 3 | note: The following cases are valid YAML according to the 1.2 productions but 4 | not at all usefully valid. We don't want to encourage parsers to support 5 | them when we'll likely make them invalid later. 6 | also: MU58 7 | name: Directive variants 8 | from: '@ingydotnet' 9 | tags: directive 10 | yaml: | 11 | %YAML1.1 12 | --- 13 | tree: | 14 | +STR 15 | +DOC --- 16 | =VAL : 17 | -DOC 18 | -STR 19 | json: | 20 | null 21 | 22 | - yaml: | 23 | %*** 24 | --- 25 | 26 | - yaml: | 27 | %YAML 1.1 1.2 28 | --- 29 | 30 | - yaml: | 31 | %YAML 1.12345 32 | --- 33 | -------------------------------------------------------------------------------- /parser/tools/walk/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "walk" 3 | readme = "README.md" 4 | authors = { workspace = true } 5 | categories = { workspace = true } 6 | description = { workspace = true } 7 | documentation = { workspace = true } 8 | edition = { workspace = true } 9 | keywords = { workspace = true } 10 | license = { workspace = true } 11 | repository = { workspace = true } 12 | rust-version = { workspace = true } 13 | version = { workspace = true } 14 | 15 | [features] 16 | debug_prints = [] 17 | 18 | [dependencies] 19 | hashlink = { workspace = true } 20 | miette = { workspace = true } 21 | rustyline = { workspace = true } 22 | saphyr = { workspace = true } 23 | thiserror = { workspace = true } 24 | -------------------------------------------------------------------------------- /saphyr/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | gen_large_yaml = "run --profile=release-lto --package gen_large_yaml --bin gen_large_yaml --manifest-path tools/gen_large_yaml/Cargo.toml --" 3 | bench_compare = "run --package bench_compare --bin bench_compare --manifest-path tools/bench_compare/Cargo.toml --" 4 | -------------------------------------------------------------------------------- /saphyr/.gitattributes: -------------------------------------------------------------------------------- 1 | tests/*.rs.inc linguist-language=Rust linguist-generated 2 | -------------------------------------------------------------------------------- /saphyr/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "saphyr" 3 | authors = { workspace = true } 4 | categories = { workspace = true } 5 | description = { workspace = true } 6 | documentation = { workspace = true } 7 | edition = { workspace = true } 8 | keywords = { workspace = true } 9 | license = { workspace = true } 10 | version = { workspace = true } 11 | readme = { workspace = true } 12 | repository = { workspace = true } 13 | rust-version = { workspace = true } 14 | 15 | [features] 16 | default = [ "encoding" ] 17 | encoding = [ "dep:encoding_rs" ] 18 | 19 | [dependencies] 20 | arraydeque = { workspace = true } 21 | encoding_rs = { workspace = true, optional = true } 22 | hashlink = { workspace = true } 23 | ordered-float = { workspace = true } 24 | saphyr-parser = { workspace = true } 25 | 26 | [dev-dependencies] 27 | quickcheck = { workspace = true } 28 | 29 | [lints] 30 | workspace = true 31 | -------------------------------------------------------------------------------- /saphyr/LICENSE: -------------------------------------------------------------------------------- 1 | Code up to and including commit `da52a68615f2ecdd6b7e4567019f280c433c1521` is licensed by Chen Yuheng under either of: 2 | - [Apache License, Version 2.0](.licenses/ChenYuheng-Apache) (http://www.apache.org/licenses/LICENSE-2.0) 3 | - [MIT License](./licenses/ChenYuheng-MIT) (http://opensource.org/licenses/MIT) 4 | 5 | Code modifications starting with commit `1d71a23b151dcc12b289d0f06d8207dd9c764216` (included) are licenced by Ethiraric under either of: 6 | - [Apache License, Version 2.0](.licenses/Ethiraric-Apache) (http://www.apache.org/licenses/LICENSE-2.0) 7 | - [MIT License](./licenses/Ethiraric-MIT) (http://opensource.org/licenses/MIT) 8 | 9 | Redistributions of this Work must include licenses of both Chen Yuheng and Ethiraric. 10 | -------------------------------------------------------------------------------- /saphyr/documents/img/2024-03-15-benchmarks.csv: -------------------------------------------------------------------------------- 1 | ,yaml-rust2,yaml-rust,libfyaml 2 | big.yaml,1644933464,2097747837,1642761913 3 | nested.yaml,1186706803,1461738560,1104480120 4 | small_objects.yaml,5459915062,5686715239,4402878726 5 | strings_array.yaml,1698194153,2044921291,924246153 6 | -------------------------------------------------------------------------------- /saphyr/justfile: -------------------------------------------------------------------------------- 1 | before_commit: 2 | cargo fmt --check 3 | cargo clippy --release --all-targets -- -D warnings 4 | cargo clippy --all-targets -- -D warnings 5 | cargo build --release --all-targets 6 | cargo build --all-targets 7 | cargo test 8 | cargo test --release 9 | cargo test --doc 10 | RUSTDOCFLAGS="-D warnings" cargo doc --all-features 11 | -------------------------------------------------------------------------------- /saphyr/src/char_traits.rs: -------------------------------------------------------------------------------- 1 | //! Holds functions to determine if a character belongs to a specific character set. 2 | 3 | /// Check if the string can be expressed a valid literal block scalar. 4 | /// The YAML spec supports all of the following in block literals except `#xFEFF`: 5 | /// ```no_compile 6 | /// #x9 | #xA | [#x20-#x7E] /* 8 bit */ 7 | /// | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] /* 16 bit */ 8 | /// | [#x10000-#x10FFFF] /* 32 bit */ 9 | /// ``` 10 | #[inline] 11 | pub(crate) fn is_valid_literal_block_scalar(string: &str) -> bool { 12 | string.chars().all(|character: char| 13 | matches!(character, '\t' | '\n' | '\x20'..='\x7e' | '\u{0085}' | '\u{00a0}'..='\u{d7fff}')) 14 | } 15 | -------------------------------------------------------------------------------- /saphyr/tests/quickcheck.rs: -------------------------------------------------------------------------------- 1 | #[macro_use] 2 | extern crate quickcheck; 3 | 4 | use quickcheck::TestResult; 5 | 6 | use saphyr::{LoadableYamlNode, Scalar, Yaml, YamlEmitter}; 7 | 8 | quickcheck! { 9 | fn test_check_weird_keys(xs: Vec) -> TestResult { 10 | let mut out_str = String::new(); 11 | let input = Yaml::Sequence(xs.into_iter().map(|x|Yaml::Value(Scalar::String(x.into()))).collect()); 12 | { 13 | let mut emitter = YamlEmitter::new(&mut out_str); 14 | emitter.dump(&input).unwrap(); 15 | } 16 | match Yaml::load_from_str(&out_str) { 17 | Ok(output) => TestResult::from_bool(output.len() == 1 && input == output[0]), 18 | Err(err) => TestResult::error(err.to_string()), 19 | } 20 | } 21 | } 22 | --------------------------------------------------------------------------------