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

Cucumber Expressions AST into Regex expansion #2

Merged
merged 25 commits into from
Nov 22, 2021
Merged

Conversation

ilslv
Copy link
Member

@ilslv ilslv commented Nov 10, 2021

Moved from cucumber-rs/cucumber#154
Part of cucumber-rs/cucumber#124

Synopsis

This PR implements Cucumber expressions AST into Regex expansion.

Solution

This is done with IntoRegexCharIter trait to avoid unnecessary overhead.

Checklist

  • Created PR:
    • In draft mode
    • Name contains Draft: prefix
    • Name contains issue reference
    • Has assignee
  • Documentation is updated (if required)
  • Tests are updated (if required)
  • Changes conform code style
  • CHANGELOG entry is added (if required)
  • FCM (final commit message) is posted
    • and approved
  • Review is completed and changes are approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • Draft: prefix is removed
    • All temporary labels are removed

@ilslv ilslv added the enhancement New feature or request label Nov 10, 2021
@ilslv ilslv self-assigned this Nov 10, 2021
@ilslv
Copy link
Member Author

ilslv commented Nov 10, 2021

derive_more crate is dependent on syn = 1. That why after running cargo +nightly update -Z minimal-versions syn gets downgraded to 1.0, where there is no Path::get_ident() method.

UPD: Waiting for JelteF/derive_more#175

@ilslv ilslv mentioned this pull request Nov 17, 2021
15 tasks
@tyranron tyranron added this to the 0.1 milestone Nov 18, 2021
@ilslv
Copy link
Member Author

ilslv commented Nov 19, 2021

FCM

Cucumber Expressions AST into `Regex` expansion (#2)

@ilslv ilslv marked this pull request as ready for review November 19, 2021 06:06
@ilslv ilslv requested a review from tyranron November 19, 2021 06:10
Copy link
Member

@tyranron tyranron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilslv mostly OK, just bikeshedding is required.

///
/// [0]: Expression#parameter-types
/// [`Error`]: ExpansionError
pub fn regex_with_parameters<Input, Parameters>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to grasp the whole idea here. Can we provide a meaningful example?

-> <SingleExpression<Input> as IntoRegexCharIter<Input>>::Iter,
>,
>,
iter::Once<Result<char, UnknownParameterError<Input>>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we have TAIT we won't need this aliases anymore. It's worth mentioning with TODO comment for future.

// except according to those terms.

//! [Cucumber Expressions][0] [AST] into [`Regex`] transformation
//! definitions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to mention somewhere upstream production rules.

If we align with them 1-to-1, then they should be referred in transformation functions docs directly.

src/lib.rs Outdated
#[cfg(feature = "expand-into-regex")]
#[doc(inline)]
pub use self::expand::{
ExpansionError as Error, IntoRegexCharIter, ParametersProvider,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can omit re-exporting feature in root. They're quite specific to live in their on module.

SingleAlternation, SingleExpression, Spanned,
};

pub use with_parameters::{ParametersProvider, WithParameters};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be?

pub mod parameters;

pub use parameters::{Provider as ParametersProvider, WithCustom as WithCustomParameters};

@ilslv ilslv requested a review from tyranron November 22, 2021 07:37
@tyranron tyranron changed the title Draft: Cucumber Expressions AST to Regex expansion Cucumber Expressions AST into Regex expansion Nov 22, 2021
@tyranron tyranron merged commit 9cb8206 into cucumber-rs:main Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants