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

Migrate parser to cucumber/common? #245

Closed
ciaranmcnulty opened this issue Oct 18, 2021 · 8 comments
Closed

Migrate parser to cucumber/common? #245

ciaranmcnulty opened this issue Oct 18, 2021 · 8 comments

Comments

@ciaranmcnulty
Copy link
Contributor

ciaranmcnulty commented Oct 18, 2021

I'm going to do a spike at porting the cucumber parser over to PHP within the cucumber repository. This would contain a complete AST of value objects we could use.

For BC it should be possible to write a thin translation layer to map that to the existing Gherkin objects in this repo via a Loader, but a future version of Behat could rely on its AST directly, or even at some point rely on its 'pickles'.

Pros:

  • Help from Cucumber team in maintenance, as internal structure would closely mirror the Java etc implementations
  • Faster support for Cucumber language features
  • Would use cucumber versioning so users could pin specific translations (see BC in keywords #193)

Cons:

  • Relies on Cucumber team caring about PHP
  • Introduces a layer of complexity in mapping

Any thoughts/feedback?

@stof
Copy link
Member

stof commented Oct 18, 2021

This will probably require a major version bump in Behat (the PyStringNode and the TableNode are accessed directly in steps, and other nodes can be accessed in hooks).

However, if the quality of the PHP code maintained by the Cucumber team can be good, I'm in favor of it.

@stof
Copy link
Member

stof commented Oct 18, 2021

and we could indeed have an intermediate step where behat/gherkin uses cucumber/gherkin-php (or whatever its name) internally and convert the AST.

@ciaranmcnulty
Copy link
Contributor Author

Yeah it would basically be the same mapping as NdJsoNLoader does in the tests, except from cucumber objects instead of JSON

@unkind
Copy link
Contributor

unkind commented Feb 8, 2022

It requires to implement parser generator for gasparnagy/berp first (template file).

@ciaranmcnulty
Copy link
Contributor Author

ciaranmcnulty commented Feb 8, 2022

@unkind Just to update, I've started work on this and have a cucumber/messages implementation published on packagist

I've implemented the gherkin berp stuff, just need to make the various other objects that the parser uses (mostly copying the Java implementation)

@unkind
Copy link
Contributor

unkind commented Sep 23, 2022

How it's going? Need some help?

@unkind
Copy link
Contributor

unkind commented Sep 23, 2022

Not sure about English language, but "Scenario" instead of "Example" in Russian sounds literally like "Script" for a movie or even a theatrical play. It's harder to represent to a newbies.

@ciaranmcnulty
Copy link
Contributor Author

See #253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants