Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #212

Merged
merged 5 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
813 changes: 454 additions & 359 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion crates/bevy_plugin/src/commands/command_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ mod tests {
fn can_call_fn_with_no_args() {
let mut methods = YarnCommands::default();

methods.add_command("test", |_: In<()>| panic!("It works!"));
#[allow(clippy::unused_unit)] // Needed for 2024 edition
methods.add_command("test", |_: In<()>| -> () { panic!("It works!") });
let method = methods.get_mut("test").unwrap();
let mut app = App::new();
method.call(vec![], app.world_mut());
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_plugin/src/commands/command_wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) fn command_wrapping_plugin(_app: &mut App) {}
/// A method that can be registered as a command for Yarn files via [`YarnCommands::add_command`].
///
/// The signature of the method must adhere to the following rules:
/// - The first parameter must be of the type `In<T>`, where `T` can be converted into a [`YarnFnParam`]. This stands for the parameters passed to the command from Yarn.
/// The first parameter must be of the type `In<T>`, where `T` can be converted into a [`YarnFnParam`]. This stands for the parameters passed to the command from Yarn.
/// Multiple parameters are supported as values wrapped in a tuple.
/// For example, to register a command that is called from Yarn like `<<add_player "John" 42>>`, the first parameter must be of the type `In<(String, i32)>` and a call to `register_command` might look like this:
/// ```rust
Expand All @@ -27,6 +27,7 @@ pub(crate) fn command_wrapping_plugin(_app: &mut App) {}
/// println!("Adding player {name} with age {age}");
/// }
/// ```
///
/// The parameters following the `In` parameter are taken from the Bevy ECS as any other system would. For example, the following command would print the elapsed time since the game started:
/// ```rust
/// # use bevy_yarnspinner::prelude::*;
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_plugin/src/dialogue_runner/localized_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ impl LocalizedLine {
/// and updates the other attributes in this markup as follows:
///
/// - Attributes that start and end before the deleted attribute are
/// unmodified.
/// unmodified.
/// - Attributes that start before the deleted attribute and end inside it
/// are truncated to remove the part overlapping the deleted attribute.
/// are truncated to remove the part overlapping the deleted attribute.
/// - Attributes that have the same position and length as the deleted
/// attribute are deleted, if they apply to any text.
/// attribute are deleted, if they apply to any text.
/// - Attributes that start and end within the deleted attribute are deleted.
/// - Attributes that start within the deleted attribute, and end outside
/// it, have their start truncated to remove the part overlapping the
/// deleted attribute.
/// it, have their start truncated to remove the part overlapping the
/// deleted attribute.
/// - Attributes that start after the deleted attribute have their start
/// point adjusted to account for the deleted text.
/// point adjusted to account for the deleted text.
///
/// This method does not modify the current object. A new [`LocalizedLine`] is returned.
///
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! - [`YarnSpinnerPlugin`]: The plugin registering all systems and types.
//! - [`YarnProject`]: A [`Resource`](bevy::prelude::Resource) for the compiled Yarn project, which is created for you when [`YarnSpinnerPlugin`] is added.
//! - [`DialogueRunner`]: The [`Component`](bevy::prelude::Component) running through the Yarn files and sending events for things you should draw on the screen.
//! Can be created from a [`YarnProject`].
//! Can be created from a [`YarnProject`].
//!
//! ## Dialogue Views
//!
Expand Down Expand Up @@ -39,7 +39,7 @@
//! The main workflow is as follows:
//! - Register the [`YarnSpinnerPlugin`]
//! - When the [`YarnProject`] [`Resource`](bevy::prelude::Resource) is added, spawn a [`DialogueRunner`] from it.
//! The latter can nicely be done with `my_system.run_if(resource_added::<YarnProject>)`.
//! The latter can nicely be done with `my_system.run_if(resource_added::<YarnProject>)`.
//!
//! The following example is adapted from the [hello world example](https://github.com/YarnSpinnerTool/YarnSpinner-Rust/blob/main/examples/bevy_yarnspinner/src/bin/hello_world.rs).
//!
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! You probably don't want to use this crate directly, except if you're coming from another language than Rust and want to call Yarn Spinner via FFI.
//! Otherwise:
//! - If you're a game developer, you'll want to use a crate that is already designed for your game engine of choice,
//! such as [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) for the [Bevy engine](https://bevyengine.org/).
//! such as [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) for the [Bevy engine](https://bevyengine.org/).
//! - If you wish to write an adapter crate for an engine yourself, use the [`yarnspinner`](https://crates.io/crates/yarnspinner) crate.
//!
#![warn(missing_docs, missing_debug_implementations)]
Expand Down
4 changes: 2 additions & 2 deletions crates/compiler/src/output/debug_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ impl DebugInfo {
///
/// # Arguments
///
/// * `instruction_number` - The index of the instruction to retrieve
/// information for.
/// * `instruction_number`: The index of the instruction to retrieve
/// information for.
///
/// # Returns
///
Expand Down
3 changes: 2 additions & 1 deletion crates/compiler/src/visitors/constant_value_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ impl<'input> YarnSpinnerParserVisitorCompat<'input> for ConstantValueVisitor<'in
///
/// This seems weird, I know. The original implementation writes a `Diagnostic` whenever the default value is constructed.
/// The thing is, the original code says the following:
///
/// > Default result is an exception - only specific parse nodes can
/// be visited by this visitor
/// > be visited by this visitor
///
/// We cannot write a diagnostic in the default implementation because we lack access to the diagnostics vector at that point.
/// But, judging by the original wording, this case should not happen anyways and should be treated as an internal error / a bug.
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! You probably don't want to use this crate directly.
//! - If you're a game developer, you'll want to use a crate that is already designed for your game engine of choice,
//! such as [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) for the [Bevy engine](https://bevyengine.org/).
//! such as [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) for the [Bevy engine](https://bevyengine.org/).
//! - If you wish to write an adapter crate for an engine yourself, use the [`yarnspinner`](https://crates.io/crates/yarnspinner) crate.

#![warn(missing_docs, missing_debug_implementations)]
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/yarn_fn/function_wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use yarnspinner_macros::all_tuples;
/// - [`bool`]
/// - A numeric type, i.e. one of [`f32`], [`f64`], [`i8`], [`i16`], [`i32`], [`i64`], [`i128`], [`u8`], [`u16`], [`u32`], [`u64`], [`u128`], [`usize`], [`isize`]
/// - [`String`]
///
/// Note that in particular, no references can be returned.
/// ## Examples
/// ```rust
Expand Down
4 changes: 2 additions & 2 deletions crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ yarnspinner_core = { path = "../core", version = "0.3.0" }
unicode-normalization = "0.1"
unicode-segmentation = "1"
log = "0.4"
icu_plurals = { version = "1", features = ["std"] }
icu_locid = { version = "1", features = ["std"] }
icu_plurals = { version = "1.5", features = ["std"] }
icu_locid = { version = "1.5", features = ["std"] }
fixed_decimal = { version = "0.5", features = ["ryu", "std"] }
once_cell = "1"
regex = "1"
Expand Down
8 changes: 4 additions & 4 deletions crates/runtime/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ impl Command {
///
/// - Text that appears inside a pair of double-quote characters will not be split.
/// - Text that appears after a double-quote character and
/// before the end of the input will not be split (that is, an
/// unterminated double-quoted string will be treated as though it
/// had been terminated at the end of the input.)
/// before the end of the input will not be split (that is, an
/// unterminated double-quoted string will be treated as though it
/// had been terminated at the end of the input.)
/// - When inside a pair of double-quote characters, the string
/// `\\` will be converted to `\`, and the string `\"` will be converted to `"`.
/// `\\` will be converted to `\`, and the string `\"` will be converted to `"`.
fn split_command_text(input: &str) -> Vec<String> {
let input = normalize(input);
let mut chars = input.chars().peekable();
Expand Down
4 changes: 2 additions & 2 deletions crates/runtime/src/dialogue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ impl Dialogue {
/// Calling this method returns a batch of [`DialogueEvent`]s that should be handled by the caller before calling [`Dialogue::continue_`] again.
/// Some events can be ignored, however this method will error if the following events are not properly handled:
/// - [`DialogueEvent::Options`] indicates that the program is waiting for the user to select an option.
/// The user's selection must be passed to [`Dialogue::set_selected_option`] before calling [`Dialogue::continue_`] again.
/// The user's selection must be passed to [`Dialogue::set_selected_option`] before calling [`Dialogue::continue_`] again.
/// - [`DialogueEvent::DialogueComplete`] means that the program reached its end.
/// When this occurs, [`Dialogue::set_node`] must be called before [`Dialogue::continue_`] is called again.
/// When this occurs, [`Dialogue::set_node`] must be called before [`Dialogue::continue_`] is called again.
///
/// See the documentation of [`DialogueEvent`] for more information on how to handle each event.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! You probably don't want to use this crate directly.
//! - If you're a game developer, you'll want to use a crate that is already designed for your game engine of choice,
//! such as [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) for the [Bevy engine](https://bevyengine.org/).
//! such as [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) for the [Bevy engine](https://bevyengine.org/).
//! - If you wish to write an adapter crate for an engine yourself, use the [`yarnspinner`](https://crates.io/crates/yarnspinner) crate.

#![warn(missing_docs, missing_debug_implementations)]
Expand Down
13 changes: 7 additions & 6 deletions crates/runtime/src/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::prelude::*;
/// - A localized text was fetched through the [`TextProvider`] registered in the [`Dialogue`].
/// - Any expressions found in the text are evaluated
/// - The text is parsed for markup
///
/// You do not create instances of this struct yourself. They are created by the [`Dialogue`] during program execution.
///
/// ## See also
Expand Down Expand Up @@ -161,17 +162,17 @@ impl Line {
/// and updates the other attributes in this markup as follows:
///
/// - Attributes that start and end before the deleted attribute are
/// unmodified.
/// unmodified.
/// - Attributes that start before the deleted attribute and end inside it
/// are truncated to remove the part overlapping the deleted attribute.
/// are truncated to remove the part overlapping the deleted attribute.
/// - Attributes that have the same position and length as the deleted
/// attribute are deleted, if they apply to any text.
/// attribute are deleted, if they apply to any text.
/// - Attributes that start and end within the deleted attribute are deleted.
/// - Attributes that start within the deleted attribute, and end outside
/// it, have their start truncated to remove the part overlapping the
/// deleted attribute.
/// it, have their start truncated to remove the part overlapping the
/// deleted attribute.
/// - Attributes that start after the deleted attribute have their start
/// point adjusted to account for the deleted text.
/// point adjusted to account for the deleted text.
///
/// This method does not modify the current object. A new [`Line`] is returned.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/src/markup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ mod tests {
line_parser.set_language_code(Language::from(locale));
let markup = line_parser.parse_markup(&line).unwrap();

assert_eq!(expected, markup.text);
assert_eq!(expected, markup.text, "locale: {locale}");
}
}

Expand Down
8 changes: 4 additions & 4 deletions crates/runtime/src/markup/line_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,13 @@ impl LineParser {
/// - Integers
/// - Floating-point numbers
/// - Strings (delimited by double quotes). (Strings may contain
/// escaped quotes with a backslash.)
/// escaped quotes with a backslash.)
/// - The words `true` or `false`
/// - Runs of alphanumeric characters, up to but not including a
/// whitespace or the end of a tag; these are interpreted as a string
/// (e.g. `[mood=happy]` is interpreted the same as `[mood="happy"]`
/// whitespace or the end of a tag; these are interpreted as a string
/// (e.g. `[mood=happy]` is interpreted the same as `[mood="happy"]`
/// - Expressions (delimited by curly braces), which are processed
/// as inline expressions.
/// as inline expressions.
fn parse_value(&mut self) -> Result<MarkupValue> {
// parse integers or floats:
if self.peek_numeric()? {
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/src/virtual_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ fn assert_up_to_date_compiler(predicate: bool) {
/// Replaces all substitution markers in a text with the given substitution list.
///
/// This method replaces substitution markers
/// - for example, `{0}` - with the corresponding entry in `substitutions`.
/// (for example, `{0}`) with the corresponding entry in `substitutions`.
/// If `test` contains a substitution marker whose
/// index is not present in `substitutions`, it is
/// ignored.
Expand Down
3 changes: 1 addition & 2 deletions demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ license = "MIT OR Apache-2.0"
bevy = { version = "0.14.0" }
bevy_yarnspinner = { path = "../crates/bevy_plugin", version = "0.3.0" }
bevy_yarnspinner_example_dialogue_view = { path = "../crates/example_dialogue_view", version = "0.3.0" }
# waiting for https://github.com/FraserLee/bevy_sprite3d/pull/22 to be merged
bevy_sprite3d = { git = "https://github.com/janhohenheim/bevy_sprite3d", branch = "bevy-0.14" }
bevy_sprite3d = "3"