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 supported characters in Tags #30

Merged
merged 6 commits into from
Dec 8, 2021
Merged

Fix supported characters in Tags #30

merged 6 commits into from
Dec 8, 2021

Conversation

ilslv
Copy link
Member

@ilslv ilslv commented Dec 7, 2021

Resolves cucumber-rs/cucumber#174, cucumber-rs/cucumber#175

Synopsis

Despite nowhere to be documented, it looks like . can be present in Tags.

Solution

Support any non-whitespace character, excluding @ and ), as seen here.

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 bug Something isn't working label Dec 7, 2021
@ilslv ilslv self-assigned this Dec 7, 2021
@ilslv ilslv changed the title Draft: Support more characters in Tags Draft: Fix characters in Tags Dec 7, 2021
@ilslv ilslv changed the title Draft: Fix characters in Tags Draft: Fix supported characters in Tags Dec 7, 2021
@ilslv
Copy link
Member Author

ilslv commented Dec 7, 2021

FCM

Fix supported characters in `Tag`s (#30)

- fix allowed keywords in `Feature`s `Description`
- allow comments on the same line with `Tag`s
- allow `Tag`s not having whitespace between them
- support escapes in `TagOperation` with `\`

@tyranron tyranron added the enhancement Improvement of existing features or bugfix label Dec 7, 2021
@ilslv ilslv added this to the 0.11.1 milestone Dec 8, 2021
@ilslv ilslv changed the title Draft: Fix supported characters in Tags Fix supported characters in Tags Dec 8, 2021
@ilslv ilslv marked this pull request as ready for review December 8, 2021 04:52
@ilslv ilslv requested a review from tyranron December 8, 2021 05:34
src/parser.rs Outdated
@@ -415,7 +420,8 @@ rule scenario() -> Scenario
rule tag_char() -> &'input str
= s:$([_]) {?
let x = s.chars().next().unwrap();
if x.is_alphanumeric() || x == '_' || x == '-' {
// `)` isn't allowed, as it would collide with TagExpression.
if !x.is_whitespace() && !"\r\n@)".contains(x) {
Copy link
Member

Choose a reason for hiding this comment

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

\r, \n and even \t are covered by .is_whitespace() already.

src/parser.rs Outdated
@@ -415,7 +420,8 @@ rule scenario() -> Scenario
rule tag_char() -> &'input str
= s:$([_]) {?
let x = s.chars().next().unwrap();
if x.is_alphanumeric() || x == '_' || x == '-' {
// `)` isn't allowed, as it would collide with TagExpression.
Copy link
Member

Choose a reason for hiding this comment

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

As far as I see in reference implemetation, we should support it.

Maybe this should be resolved by escaping in TagExpression?

Copy link
Member Author

Choose a reason for hiding this comment

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

@tyranron somewhere buried in separate github repo, there is mentioning of escaping https://github.com/cucumber/tag-expressions#escaping

@ilslv ilslv requested a review from tyranron December 8, 2021 11:59
@tyranron tyranron merged commit 54b7394 into main Dec 8, 2021
@tyranron tyranron deleted the 174-more-chars-in-tags branch December 8, 2021 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't parse @foo.bar
2 participants