Behat / Gherkin

Gherkin parser, written in PHP for Behat project
MIT License
1.05k stars 89 forks source link

Tag parsing #215

Closed ciaranmcnulty closed 3 years ago

ciaranmcnulty commented 3 years ago

Closes #210 and #213

Not too happy with the implementation yet

For the tag whitespace we could optionally show a warning rather than an exception for backwards compatibility

stof commented 3 years ago

I would vote for adding such API to consume the line only partially instead of the hack about #

ciaranmcnulty commented 3 years ago

@stof Yeah I will add something like consumeLineUntil($char) or similar

stof commented 3 years ago

@ciaranmcnulty I suggest confirming upstream whether comments are meant to be allowed at the end of any line. If the answer is yes, it might be a matter of changing consumeLine instead.

ciaranmcnulty commented 3 years ago

It looks like they're only allowed at the end of tags lines, added in https://github.com/cucumber/cucumber/pull/880

ciaranmcnulty commented 3 years ago

TagFilter is quite happy to be constructed with, and filter by tags with whitespace so there's a chance there are people depending on this functionality.

trigger_error with a deprecation warning?

stof commented 3 years ago

@ciaranmcnulty then a deprecation is indeed better (and probably also in TagFilter if the filter uses a tag with whitespace)

ciaranmcnulty commented 3 years ago

I think #220 is necessary to test the deprecations properly

ciaranmcnulty commented 3 years ago

@stof would appreciate feedback on how the deprecation is implemented

funkyproject commented 2 years ago

Hello ,

That trigger a deprecation notice when we use a filter likes "@tag1 && @tag2". Even if the tags haven't spaces.

stof commented 2 years ago

When using that where ?

funkyproject commented 2 years ago

On suite configuration like here: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Behat/Resources/config/suites/ui/account/address_book.yml

funkyproject commented 2 years ago

It's about src/Behat/Gherkin/Filter/TagFilter.php on construct. Maybe the trigger error can be moved into isTagsMatchCondition.

stof commented 2 years ago

I agree. The deprecation warning should allow for spaces around the operators.

However, I would not do that in isTagsMatchCondition. We don't want to trigger the deprecation on each scenario