| Crates.io | saphyr-parser-bw |
| lib.rs | saphyr-parser-bw |
| version | 0.0.605 |
| created_at | 2026-01-11 15:38:16.211024+00 |
| updated_at | 2026-01-19 18:43:26.160875+00 |
| description | Saphyr-parser with changes from Bourumir Wyngs to be used in serde-saphyr |
| homepage | |
| repository | https://github.com/bourumir-wyngs/saphyr |
| max_upload_size | |
| id | 2035977 |
| size | 395,302 |
This crate is a fork of saphyr-parser, for work with serde-saphyr.
It includes a small set of targeted changes required for full YAML compliance, resolving all yaml-test-suite failures. These changes have been proposed upstream. If they are incorporated, this fork may be deprecated in the future.
saphyr-parser-bw has the same public API as saphyr-parser.
It differs only in the following, narrowly scoped behaviors, all motivated by YAML compliance and interoperability.
A sequence such as:
[ a, b, c ] ]
is invalid YAML. This case is now correctly reported as an error.
A comment that intercepts multiline content is invalid YAML:
word1 # comment
word2
while this is valid, even if can only occur at the top level and not in the map:
word1
word2
saphyr-parser version 0.0.6 accepted input with comment as valid and silently discarded the part of the text following the comment. This behavior has been corrected.
Reserved directives must be ignored when they appear in a document.
While saphyr-parser does not make use of such directives, version 0.0.6 raised an error instead of ignoring them.
This has been fixed to match the YAML specification.
This is the most controversial change, and we fully understand the argument that such documents should be rejected:
key: [ 1, 2, 3,
4, 5, 6
] # <-- this closing bracket is not sufficiently indented
However, we received multiple bug reports and user complaints about rejecting this input, likely because many other YAML parsers accept it.
After careful consideration, the serde-saphyr team decided to support this case for compatibility reasons.
That said, we still strongly recommend placing the closing bracket further to the right to remain fully YAML-compliant.
The pull request #87 fixes parsing of the followign YAML:
hello:
world: this is a string
--- still a string
The expected string value is this is a string --- still a string.
When bracket ([,{) or quote lacks the matching closing bracket, unpatched 0.0.6 version currently reports then end of file as the location of the error. This may be very far from the actual cause of the error, and reporting the opening bracket is more helpful. Our version in such cases reports row and column of the opening bracket as the error location.
saphyr-parser is a fully compliant YAML 1.2 parser implementation written in pure Rust.
If you want to load to a YAML Rust structure or manipulate YAML objects, use
saphyr instead of saphyr-parser. This crate contains only the parser.
This work is based on yaml-rust with
fixes towards being compliant to the YAML test
suite. yaml-rust's parser is
heavily influenced by libyaml and yaml-cpp.
saphyr-parser is a pure Rust YAML 1.2 implementation that benefits from the
memory safety and other benefits from the Rust language.
This library does not try to interpret any type specifiers in a YAML document, so there is no risk of, say, instantiating a socket with fields and communicating with the outside world just by parsing a YAML document.
This implementation is fully compatible with the YAML 1.2 specification. In
order to help with compliance, yaml-rust2 tests against (and passes) the YAML
test suite.
Licensed under either of
at your option.
Since this repository was originally maintained by chyh1990, there are 2 sets of licenses. A license of each set must be included in redistributions. See the LICENSE file for more details.
You can find licences in the .licenses subfolder.
Fork this repository and Create a Pull Request on Github. You may need to click on "compare across forks" and select your fork's branch.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.