cucumber / cucumber-expressions

Human friendly alternative to Regular Expressions
MIT License
148 stars 51 forks source link

Feature/enable transformer capture #234

Closed luke-hill closed 11 months ago

luke-hill commented 11 months ago

🤔 What's changed?

Expose transformer arg on ParameterType.

⚡️ What's your motivation?

Needed for CCK conformancy (v12/v13) for cucumber-ruby. We need to store the SourceLocation proc for the ParameterType, this is currently not possible.

🏷️ What kind of change is this?

♻️ Anything particular you want feedback on?

📋 Checklist:


This text was originally generated from a template, then edited by hand. You can modify the template here.

mpkorstanje commented 11 months ago

Needed for CCK conformancy (v12/v13) for cucumber-ruby

@luke-hill could you elaborate on this? For the CCK I would expect transform would be sufficient.

luke-hill commented 11 months ago

Sure. Basically we don't have this reader. So this reader will enable us to grab the transformer proc. Specifically it's SourceLocation

This is what the other languages do I believe, but it wasn't present in ruby. This will now enable us to use v12/v13 cck and fix up the final hard-coded bit of logic in the CCK conformancy PR.

mpkorstanje commented 11 months ago

Check, looks like Java is the exception here (no easy way to get a source location). So that makes sense. See it's public in JS too.

luke-hill commented 11 months ago

Out of curiousity. How do you conform to the CCK that stipulates you need a SourceLocation for the ParameterType in java then? Requested here: https://github.com/cucumber/cucumber-jvm/pull/2739/files

mpkorstanje commented 10 months ago

Cucumber-JVM doesn't expose the API from Cucumber Expressions to the end user. So instead of having the user register a parameter type, they annotate a method and Cucumber JVM maps that annotated method to a parameter type and registers it. The messages are then created based on the parameter type registered and the source location of the annotated method.