Skip to content

Commit

Permalink
Merge branch 'main' into clippy-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed May 5, 2024
2 parents 2150dd4 + 466e100 commit fde63cb
Show file tree
Hide file tree
Showing 23 changed files with 219 additions and 135 deletions.
30 changes: 14 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
[workspace]
resolver = "2"
members = [
"fluent-syntax",
"fluent-bundle",
"fluent-fallback",
"fluent-resmgr",
"fluent-pseudo",
"fluent-testing",
"fluent",
"intl-memoizer"
"fluent-syntax",
"fluent-bundle",
"fluent-fallback",
"fluent-resmgr",
"fluent-pseudo",
"fluent-testing",
"fluent",
"intl-memoizer",
]

exclude = [
"fluent-cli",
]
exclude = ["fluent-cli"]

[workspace.dependencies]
criterion = "0.3"
criterion = "0.5"
fluent-langneg = "0.13"
futures = "0.3"
iai = "0.1"
Expand All @@ -28,7 +26,7 @@ thiserror = "1.0"
tokio = "1.0"
unic-langid = "0.9"

fluent-bundle = { path = "fluent-bundle" }
fluent-fallback = { path = "fluent-fallback" }
fluent-pseudo = { path = "fluent-pseudo" }
fluent-syntax = { path = "fluent-syntax" }
fluent-bundle = { version = "0.15.3", path = "fluent-bundle" }
fluent-fallback = { version = "0.7.1", path = "fluent-fallback" }
fluent-pseudo = { version = "0.3.2", path = "fluent-pseudo" }
fluent-syntax = { version = "0.11.1", path = "fluent-syntax" }
20 changes: 17 additions & 3 deletions fluent-bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Changelog

## Unreleased

-

- Bump `self_cell` to 1.x
- Bump `serde_yaml` to 0.9

## fluent-bundle 0.15.3 (March 16, 2024)
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
- Implement `From<&String>` for `FluentValue`
- Add `FluentValue.into_string` to prevent String clone
- Fix `FluentValue::try_number` accepting numbers
- Allow optional arguments on `FluentValue`
- Fix behavior of `FluentArgs::set`
- Resolve function instead in `impl ResolveValue`
- Add type alias for concurrent `FluentBundle`
- Fix `FluentBundle::format_pattern` lifetimes
- Workspace: Update to Rust 2021
- Workspace: Add various missing documentation and fix typos and links
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
- Workspace: Apply rustfmt and clippy lint fixes
## fluent-bundle 0.15.2 (October 25, 2021)
- Bump `self_cell` to 0.10.

Expand Down
26 changes: 13 additions & 13 deletions fluent-bundle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description = """
A localization system designed to unleash the entire expressive power of
natural language translations.
"""
version = "0.15.2"
version = "0.15.3"
edition = "2021"
authors = [
"Zibi Braniecki <[email protected]>",
"Staś Małolepszy <[email protected]>"
"Zibi Braniecki <[email protected]>",
"Staś Małolepszy <[email protected]>",
]
homepage = "http://www.projectfluent.org"
license = "Apache-2.0 OR MIT"
Expand All @@ -17,12 +17,12 @@ readme = "README.md"
keywords = ["localization", "l10n", "i18n", "intl", "internationalization"]
categories = ["localization", "internationalization"]
include = [
"src/**/*",
"benches/*.rs",
"Cargo.toml",
"README.md",
"LICENSE-APACHE",
"LICENSE-MIT"
"src/**/*",
"benches/*.rs",
"Cargo.toml",
"README.md",
"LICENSE-APACHE",
"LICENSE-MIT",
]

[dependencies]
Expand All @@ -31,17 +31,17 @@ fluent-syntax.workspace = true
intl_pluralrules.workspace = true
rustc-hash.workspace = true
unic-langid.workspace = true
intl-memoizer = { path = "../intl-memoizer" }
self_cell = "0.10"
intl-memoizer = { version = "0.5.2", path = "../intl-memoizer" }
self_cell = "1.0"
smallvec = "1"

[dev-dependencies]
criterion.workspace = true
iai.workspace = true
serde = { workspace = true, features = ["derive"]}
serde = { workspace = true, features = ["derive"] }
unic-langid = { workspace = true, features = ["macros"] }
rand = "0.8"
serde_yaml = "0.8"
serde_yaml = "0.9"

[features]
default = []
Expand Down
8 changes: 8 additions & 0 deletions fluent-fallback/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

-

## fluent-fallback 0.7.1 (March 16, 2024)
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
- Migrate to `pin_cell` crate
- Workspace: Update to Rust 2021
- Workspace: Add various missing documentation and fix typos and links
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
- Workspace: Apply rustfmt and clippy lint fixes

## fluent-fallback 0.7.0 (Nov 9, 2022)
- The `ResourceId`s are now stored as a `HashSet` rather than as a Vec. Adding a
duplicate `ResourceId` is now a noop.
Expand Down
2 changes: 1 addition & 1 deletion fluent-fallback/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = """
High-level abstraction model for managing localization resources
and runtime localization lifecycle.
"""
version = "0.7.0"
version = "0.7.1"
edition = "2021"
authors = [
"Zibi Braniecki <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion fluent-fallback/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
//! Resource identifiers can refer to resources that are either required or optional.
//! In the above example, `"test.ftl"` is a required resource (the default using `.into()`),
//! and `"test2.ftl"` is an optional resource, which you can create via the
//! [`ToResourceId`](fluent_fallback::types::ToResourceId) trait.
//! [`ToResourceId`](types::ToResourceId) trait.
//!
//! A required resource must be present in order for the a bundle to be considered valid.
//! If a required resource is missing for a given locale, a bundle will not be generated for that locale.
Expand Down
8 changes: 8 additions & 0 deletions fluent-pseudo/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

-

## fluent-pseudo 0.3.2 (March 16, 2024)
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
- Allow optional resources, adds `ResourceId` struct
- Workspace: Update to Rust 2021
- Workspace: Add various missing documentation and fix typos and links
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
- Workspace: Apply rustfmt and clippy lint fixes

## fluent-pseudo 0.3.1 (July 21, 2021)
- Update README to document the API changes in 0.3.0.

Expand Down
2 changes: 1 addition & 1 deletion fluent-pseudo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "fluent-pseudo"
description = """
Pseudolocalization transformation API for use with Project Fluent API.
"""
version = "0.3.1"
version = "0.3.2"
edition = "2021"
authors = [
"Zibi Braniecki <[email protected]>",
Expand Down
8 changes: 8 additions & 0 deletions fluent-resmgr/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

-

## fluent-resmgr 0.0.7 (March 16, 2024)
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
- Return a result for `ResourceManager::get_resource`
- Workspace: Update to Rust 2021
- Workspace: Add various missing documentation and fix typos and links
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
- Workspace: Apply rustfmt and clippy lint fixes

## fluent-resmgr 0.0.6 (Nov 9, 2022)
- Update `fluent-fallback` to 0.7.0.

Expand Down
2 changes: 1 addition & 1 deletion fluent-resmgr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "fluent-resmgr"
description = """
Resource manager for Fluent localization resources.
"""
version = "0.0.6"
version = "0.0.7"
authors = [
"Zibi Braniecki <[email protected]>",
"Staś Małolepszy <[email protected]>"
Expand Down
10 changes: 10 additions & 0 deletions fluent-syntax/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
- Add module `serializer`.
-

## fluent-syntax 0.11.1 (March 16, 2024)
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
- Create generic ftl serializer `fluent_syntax::serializer`
- Fix crash when parsing multiline CRLF comment
- Treat tab as text, not whitespace, adds `parser::matches_fluent_ws` function
- Workspace: Update to Rust 2021
- Workspace: Add various missing documentation and fix typos and links
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
- Workspace: Apply rustfmt and clippy lint fixes

## fluent-syntax 0.11.0 (February 9, 2021)
- Document the crate.
- Switch to use `thiserror` for Error annotations.
Expand Down
3 changes: 2 additions & 1 deletion fluent-syntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "fluent-syntax"
description = """
Parser/Serializer tools for Fluent Syntax.
"""
version = "0.11.0"
version = "0.11.1"
edition = "2021"
authors = [
"Zibi Braniecki <[email protected]>",
Expand All @@ -25,6 +25,7 @@ include = [
]

[dependencies]
memchr = "2.0"
serde = { workspace = true, optional = true, features = ["derive"] }
serde_json = { workspace = true, optional = true }
thiserror.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions fluent-syntax/src/parser/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ macro_rules! get_current_byte {
$s.source.as_ref().as_bytes().get($s.ptr)
};
}

macro_rules! get_remaining_bytes {
($s:expr) => {
$s.source.as_ref().as_bytes().get($s.ptr..)
};
}
101 changes: 57 additions & 44 deletions fluent-syntax/src/parser/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,51 +157,64 @@ where
&mut self,
) -> Result<(usize, usize, TextElementType, TextElementTermination)> {
let start_pos = self.ptr;
let mut text_element_type = TextElementType::Blank;

while let Some(b) = get_current_byte!(self) {
match b {
b' ' => self.ptr += 1,
b'\n' => {
self.ptr += 1;
return Ok((
start_pos,
self.ptr,
text_element_type,
TextElementTermination::LineFeed,
));
}
b'\r' if self.is_byte_at(b'\n', self.ptr + 1) => {
self.ptr += 1;
return Ok((
start_pos,
self.ptr - 1,
text_element_type,
TextElementTermination::Crlf,
));
}
b'{' => {
return Ok((
start_pos,
self.ptr,
text_element_type,
TextElementTermination::PlaceableStart,
));
}
b'}' => {
return error!(ErrorKind::UnbalancedClosingBrace, self.ptr);
}
_ => {
text_element_type = TextElementType::NonBlank;
self.ptr += 1;
}
let Some(rest) = get_remaining_bytes!(self) else {
return Ok((
start_pos,
self.ptr,
TextElementType::Blank,
TextElementTermination::Eof,
));
};
let end = memchr::memchr3(b'\n', b'{', b'}', rest);
let element_type = |text: &[u8]| {
if text.iter().any(|&c| c != b' ') {
TextElementType::NonBlank
} else {
TextElementType::Blank
}
};
match end.map(|p| &rest[..=p]) {
Some([text @ .., b'}']) => {
self.ptr += text.len();
error!(ErrorKind::UnbalancedClosingBrace, self.ptr)
}
Some([text @ .., b'\r', b'\n']) => {
self.ptr += text.len() + 1;
Ok((
start_pos,
self.ptr - 1,
element_type(text),
TextElementTermination::Crlf,
))
}
Some([text @ .., b'\n']) => {
self.ptr += text.len() + 1;
Ok((
start_pos,
self.ptr,
element_type(text),
TextElementTermination::LineFeed,
))
}
Some([text @ .., b'{']) => {
self.ptr += text.len();
Ok((
start_pos,
self.ptr,
element_type(text),
TextElementTermination::PlaceableStart,
))
}
None => {
self.ptr += rest.len();
Ok((
start_pos,
self.ptr,
element_type(rest),
TextElementTermination::Eof,
))
}
_ => unreachable!(),
}
Ok((
start_pos,
self.ptr,
text_element_type,
TextElementTermination::Eof,
))
}
}
Loading

0 comments on commit fde63cb

Please sign in to comment.