Skip to content

Releases: saphyr-rs/saphyr

v0.0.6

11 Jun 15:55

Choose a tag to compare

Important note

This release contains an important fix for the YamlEmitter in saphyr for a bug that was introduced in v0.0.5 (#51).
If you use tags and have updated to v0.0.5, please update to v0.0.6 asap (no breaking change).

saphyr-parser

Fixes:

  • Fix emitting of tags with empty handles. !tag no longer emits as !!tag.

saphyr

Fixes:

  • #51: Fix indent when emitting tagged collections.

v0.0.5

09 Jun 18:38

Choose a tag to compare

saphyr

Breaking Changes:

  • 234c69c..374d892: Use Cows for Tags
  • Perform parsing of scalars with unknown tags according to the core schema. Previously, !foo 42 would yield a Scalar::String("42") because the tag wasn't known. It will now yield a Scalar::Integer(42). !!str 42 will still yield a Scalar::String.
  • Parsing a scalar with an unknown Core Schema tag (e.g.: !!unknown) now results in a BadValue rather than a String.
  • Expose custom YAML tags as a variant of Yaml/YamlData objects. The biggest pain point for existing users is probably the inclusion of Yaml::Tagged, which will break existing matches on Yaml. Details about how saphyr handles YAML tags can be found on the library documentation.
  • Add into_tagged as a LoadableYamlNode requirement.

Features:

  • c0e8b8c and f4ab733: Add From implementations to convert between owned and borrowed versions of Yaml and Scalar.
  • parse_core_schema_fp for parsing floating point values according to the YAML core schema.
  • Support for custom tags.

Fixes:

  • 3bbe423: No longer parse any capitalization of inf, or infinity as f64::INFINITY
  • e88eeae: Parse .NaN as float instead of NaN.
  • Lower Cargo.toml's rust-version to 1.65.0, as stated in the documentation.

saphyr-parser

Breaking Changes:

  • Emit Cow<'input, Tag> instead of Tag to avoid copies.

Fixes:

  • 8ef76dc: Fix Markers for null and empty values.
  • Fix Spans for collections to correctly mark the end of the collection.

Changes

  • Exclude yaml-test-suite from the Cargo package.
  • Bump libtest-mimic to 0.8.1.

v0.0.4

10 Apr 14:08

Choose a tag to compare

saphyr

Breaking Changes:

  • Allow Yaml to borrow from the input.
  • All indexing traits now panic if the key is not found or the YAML variant is incorrect. This helps in making the behavior of [] more consistent across all operations.
  • Use Mapping instead of Hash to refer to YAML mappings.
  • Use Sequence instead of Array to refer to YAML sequences.
    Methods to access sequences using vec instead of array still exist.
    Another method using sequence has been added.
  • as_f64 -> as_floating_point, as_i64 -> as_integer
  • Reworked Yaml and YamlData
    • They now have a Value and a Representation variants for scalars.
      Representation holds the raw characters from the input (pre-parsing) while Value holds the parsed value. In foo: 3, Representation would hold "foo" and "3" (both as strings) while Value would hold "foo" and 3.
    • The idea behind this is to allow lazy-parsing of scalar nodes and to give more control about key duplication detection in mappings (e.g.: is { 0xB: ~, 11: ~ } considered a duplicate because 0xB == 11?).
  • Rename from_str to value_from_str to better highlight it:
    • Doesn't load a YAML document
    • Doesn't always load into a YAML string
  • load_from_* functions now belong to the LoadableYamlNode trait to avoid implementing them in each YAML node type. It is now required to import LoadableYamlNode to use these functions (LSPs should have a fixit for it).

Features:

  • Add the following convenience methods to the YAML objects:
    • contains_mapping_key
    • as_mapping_get
    • as_mapping_get_mut
  • Add many more conversion methods (as_*, as_*_mut, into_*, ...).
  • Use ordered-float to store floating point values in scalars. This allows using floating point values in mappings, with the caveats listed in the crate description (#18).
    The OrderedFloats are kept within the Scalar object and conversion methods do not expose them.
  • Add YamlDataOwned, an owned version of YamlData for when lifetimes are not required.
  • Add MarkedYamlOwned, an owned version of MarkedYaml for when lifetimes are not required.
  • Add YamlOwned, an owned version of Yaml which corresponds to what Yaml was prior to this version.

saphyr-parser

Breaking Changes:

  • Allow events to borrow from the input.
  • Rename TScalarStyle to ScalarStyle.