Skip to content

Commit

Permalink
v8.0.0 (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal authored Jan 26, 2025
1 parent 7afe3a8 commit 2cec1b3
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: cargo codspeed build -p benchmarks

- name: Run the benchmarks
uses: CodSpeedHQ/action@v2
uses: CodSpeedHQ/action@v3
with:
run: cargo codspeed run -p benchmarks
token: ${{ secrets.CODSPEED_TOKEN }}
67 changes: 65 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,75 @@
# Change Log

## [Unreleased][unreleased]
## 8.0.0 2025-01-25

This versions represents a significant refactoring of nom to reduce the amount of code generated by prsers, and reduce the API surface. As such, it comes with some breaking changes, mostly around the move from closure based combinators to trait based ones. In practice, it means that instead of writing `combinator(arg)(input)`, we now write `combinator(arg).parse(input)`.

This release also marks th introduction of the [nom-language](https://crates.io/crates/nom-language) crate, which will hold tools more focused on language parsing than the rest of nom, like the `VerboseError` type and the newly added precedence parsing combinators.

### Thanks

- @cky
- @5c077m4n
- @epage
- @Fumon
- @jtracey
- @OliveIsAWord
- @Xiretza
- @flier
- @cenodis
- @Shadow53
- @@jmmaa
- @terror
- @zanedp
- @atouchet
- @CMDJojo
- @ackxolotl
- @xmakro
- @tfpk
- @WhyNotHugo
- @brollb
- @smheidrich
- @glittershark
- @GuillaumeGomez
- @LeoDog896
- @fmiras
- @ttsugriy
- @McDostone
- @superboum
- @rruppy
- @thssuck
- @Chasing1020
- @thatmarkenglishguy
- @ambiso
- @boxdot
- @krtab
- @code10129
- @manunio
- @stuarth
- @mindeng
- @JonathanPlasse
- @nabilwadih
- @phoenixr-codes
- @gdennie
- @art049
- @kstrohbeck

### Added

- `Parser::map_res`
- `Parser::map_opt`
- `many` and `fold` combinators using ranges
- `many` can collect into other types than `Vec`
- `Error` and `VerboseError` can be converted to owned versions

### Removed

- `nom::bits::*` is no longer re-exported at the crate root. This export caused frequent confusion, since e.g. `nom::complete::tag` referred to `nom::bits::complete::tag` instead of the much more commonly used `nom::bytes::complete::tag`. To migrate, change any imports of `nom::{complete::*, streaming::*, bits, bytes}` to `nom::bits::[...]`.
- `parse` combinator
- `InputIter`, `InputTakeAtPosition`, `InputLength`, `InputTake` and `Slice` are now merged in the `Input` trait

### Changed
- `Parser::map` and `Parser::flat_map` now take a `FnMut` as argument

## 7.1.2 - 2023-01-01

Expand Down Expand Up @@ -1479,7 +1540,9 @@ Considering the number of changes since the last release, this version can conta

## Compare code

* [unreleased](https://github.com/rust-bakery/nom/compare/7.1.2...HEAD)
* [unreleased](https://github.com/rust-bakery/nom/compare/8.0.0...HEAD)
* [8.0.0](https://github.com/rust-bakery/nom/compare/7.1.3...8.0.0)
* [7.1.3](https://github.com/rust-bakery/nom/compare/7.1.2...7.1.3)
* [7.1.2](https://github.com/rust-bakery/nom/compare/7.1.1...7.1.2)
* [7.1.1](https://github.com/rust-bakery/nom/compare/7.1.0...7.1.1)
* [7.1.0](https://github.com/rust-bakery/nom/compare/7.0.0...7.1.0)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "nom"
version = "8.0.0-beta.1"
version = "8.0.0"
authors = ["[email protected]"]
description = "A byte-oriented, zero-copy, parser combinators library"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions nom-language/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "nom-language"
version = "0.1.0-alpha.1"
version = "0.1.0"
authors = ["[email protected]"]
description = "Language parsing focused combinators for the nom parser library"
edition = "2021"
license = "MIT"
repository = "https://github.com/rust-bakery/nom"

[dependencies]
nom = { path = "..", version = "8.0.0-beta.1" }
nom = { path = "..", version = "8.0.0" }
10 changes: 5 additions & 5 deletions nom-language/src/precedence/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,13 @@ where

/// Applies a parser multiple times separated by another parser.
///
/// It is similar to [`separated_list1`][crate::multi::separated_list1] but instead of collecting
/// It is similar to [`separated_list1`][nom::multi::separated_list1] but instead of collecting
/// into a vector, you have a callback to build the output.
///
/// In a LALR grammar a left recursive operator is usually built with a rule syntax such as:
/// * A := A op B | B
///
/// If you try to parse that wth [`alt`][crate::branch::alt] it will fail with a stack overflow
/// If you try to parse that wth [`alt`][nom::branch::alt] it will fail with a stack overflow
/// because the recusion is unlimited. This function solves this problem by converting the recusion
/// into an iteration.
///
Expand All @@ -387,8 +387,8 @@ where
///
/// That can be written in `nom` trivially.
///
/// This stops when either parser returns [`err::error`] and returns the last built value. to instead chain an error up, see
/// [`cut`][crate::combinator::cut].
/// This stops when either parser returns an error and returns the last built value. to instead chain an error up, see
/// [`cut`][nom::combinator::cut].
///
/// # Arguments
/// * `child` The parser to apply.
Expand Down Expand Up @@ -442,7 +442,7 @@ where
}
}

/// Parser implementation for the [separated_list1] combinator
/// Parser implementation for the [`separated_list1`][nom::multi::separated_list1] combinator
pub struct LeftAssoc<F, G, B> {
child: F,
operator: G,
Expand Down

0 comments on commit 2cec1b3

Please sign in to comment.