From 238c96f95dce79def726fed70f7b74579689ec32 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Sat, 18 Nov 2023 01:03:57 +0000 Subject: [PATCH] Prep to release 0.12 --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ Cargo.toml | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f4028..92c04f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ +## 0.12.0 + +From [#13](https://github.com/jsdw/yap/pull/13): + +- Add `Tokens::parse` method, which attempt to parse the remaining tokens into some type via + `FromStr` (and `str::parse`). This requires a buffer type (often `String`) to be provided as + the second generic arg, and may use this to buffer tokens prior to parsing if necessary. +- Add some helper functions which allow `Tokens::parse` to be optimised in cases like `StrToken`, + so that eg calling `toks.slice(from, to).parse::` for `StrTokens` and similar won't + allocate. +- Add `Tokens::take` for taking `n` tokens (can be useful in conjunction with `parse`, above). +- Add `Tokens::eof`, `Tokens::collect` and `Tokens::consume` for finding an EOF (`None`), collecting + tokens and consuming all tokens. +- Add `Tokens::into_iter`, for when you need to work around lifetime issues with `Tokens::as_iter`. +- Rename `Tokens::tokens_while` to `Tokens::take_while`, and `Tokens::skip_tokens_while` to + `Tokens::skip_while`; we no longer have to worry about conflicts with `Iterator` methods. +- `Tokens::{surrounded, optional, optional_err}` now accept an `FnOnce` instead of an `FnMut`, + allowing a little more flexibility in what is given. +- Anything which returned something implementing `Iterator` now returns something implementing + `Tokens` instead (you can still call `.as_iter()` to then get a standard `Iterator` from this). + +A shoutout to @EasyOakland for their contributions in this! + +From [#13](https://github.com/jsdw/yap/pull/14): + +- Add `yap::chars` module which contains some helper functions (like `parse_f64`) + specific to `impl Tokens`. +- Generalise `yap::one_of!` and `Tokens::optional`; the output from expressions passed to + either of these can now be `Option` or `bool`, or more specifically anything implementing + `yap::one_of::IsMatch`. + ## 0.11.0 Thankyou @Easyoakland for both of these contributions! diff --git a/Cargo.toml b/Cargo.toml index 2406c0e..34d2da4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "yap" -version = "0.11.0" +version = "0.12.0" edition = "2021" authors = ["James Wilson "] description = "Yet Another Parser library. A lightweight, dependency free, parser combinator inspired set of utility methods to help with parsing strings and slices."