Skip to content

TableCell with unescaped backslash is escaped in the AST value #2115

@jdeniau

Description

@jdeniau

👓 What did you see?

While creating a prettier plugin for gherkin file, I found out that the TableCell with unescaped backslash is escaped in the AST.

Example from escaped_pipes.feature :

| \o\no\ |

is reprensented in the AST like this:

{
  "location": { "column": 22, "line": 10 },
  "value": "\\o\no\\"
}

So it's impossible to reconstitute the original string.

✅ What did you expect to see?

An unescaped backslash in the node value for unescaped backslash

📦 Which tool/library version are you using?

Javascript librairies :

  • @cucumber/gherkin: 24.1.0"
  • @cucumber/messages: 19.1.4

🔬 How could we reproduce it?

Probably run the cucumber test stack.

📚 Any additional context?

If this is intended, then how can we regenerate the original node value ?
According to https://cucumber.io/docs/gherkin/reference/#table-cell-escaping a backslash can not be alone (while not really explicitly said).

If the cucumber test data allow parsing this un-escaped backslash, is it a bug or a feature ? Some tool allow this comportment, like PHP library behat.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions