Skip to content

Commit

Permalink
Prep to release 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdw committed Nov 18, 2023
1 parent 1221933 commit 238c96f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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::<u16,String>` 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<Item=char>`.
- Generalise `yap::one_of!` and `Tokens::optional`; the output from expressions passed to
either of these can now be `Option<T>` or `bool`, or more specifically anything implementing
`yap::one_of::IsMatch`.

## 0.11.0

Thankyou @Easyoakland for both of these contributions!
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yap"
version = "0.11.0"
version = "0.12.0"
edition = "2021"
authors = ["James Wilson <james@jsdw.me>"]
description = "Yet Another Parser library. A lightweight, dependency free, parser combinator inspired set of utility methods to help with parsing strings and slices."
Expand Down

0 comments on commit 238c96f

Please sign in to comment.