Skip to content

Conversation

@clrudolphi
Copy link
Contributor

🤔 What's changed?

Add a .NET implementation.
This uses a hand-written parser/evaluator.
Passes tests equivalent to those in the Java implementation using the same testdata.

⚡️ What's your motivation?

Eventual incorporation into Reqnroll.

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

Open to any feedback.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

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

Fixed a problem when the input tag text is null.
Copy link
Member

@gasparnagy gasparnagy left a comment

Choose a reason for hiding this comment

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

Super. Looks good, I have made a few smaller comments.

/// <exception cref="Exception">Always thrown to indicate a syntax error.</exception>
private void ThrowSyntaxError(string message)
{
throw new Exception($"Tag expression \"{_text}\" could not be parsed because of syntax error: {message}.");
Copy link
Member

Choose a reason for hiding this comment

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

Could we make a specific exception type for tag expression errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I had meant to and forgotten.

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

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

Got to 15/27 items. Mainly non-poly stuff. Will get to others alter

Changed Namespaces.
Added custom exception type.
Include position information in Token.
Corrected namespaces in Test project.
Nullable by default.
Readme.md now includes a nuget badge.
@clrudolphi clrudolphi requested a review from Copilot November 4, 2025 20:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a .NET implementation of tag expressions for Cucumber, enabling parsing and evaluation of logical tag expressions in .NET projects. The implementation follows the existing tag-expressions specification and includes comprehensive test coverage using YAML-based test data.

  • Implements a complete tag expression parser with lexer, parser, and AST nodes
  • Adds NuGet package configuration for distribution
  • Includes extensive test suite with unit tests and YAML-based acceptance tests

Reviewed Changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
dotnet/TagExpressions/TagExpressionParser.cs Core parser implementing recursive descent parsing for tag expressions
dotnet/TagExpressions/TagLexer.cs Lexer for tokenizing tag expression strings
dotnet/TagExpressions/TagExpression.cs AST node classes representing parsed expressions
dotnet/TagExpressions/TagToken.cs Token types and token class for lexical analysis
dotnet/TagExpressions/ITagExpression.cs Interface defining the tag expression contract
dotnet/TagExpressionsTest/ParsingTest.cs YAML-based tests for parsing behavior
dotnet/TagExpressionsTest/EvaluationsTest.cs YAML-based tests for expression evaluation
dotnet/TagExpressionsTest/ErrorsTest.cs YAML-based tests for error handling
dotnet/TagExpressionsTest/TagLexerTests.cs Unit tests for the lexer
dotnet/TagExpressionsTest/TestFolderHelper.cs Helper utility to locate test data files
dotnet/TagExpressions/Cucumber.TagExpressions.csproj NuGet package configuration
.github/workflows/test-dotnet.yml CI workflow for .NET testing
.github/workflows/release-nuget.yaml Release workflow for NuGet publishing
Comments suppressed due to low confidence (1)

dotnet/TagExpressionsTest/TagLexerTests.cs:94

  • Generic catch clause.
        catch (Exception ex)
        {
            StringAssert.Contains(ex.Message, "Illegal escape");
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mpkorstanje
Copy link
Contributor

@clrudolphi please do take these into account: #222, #221.

@clrudolphi
Copy link
Contributor Author

@clrudolphi please do take these into account: #222, #221.

@mpkorstanje This PR now matches the changes made in #221 and #222.

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

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

At a glance it looks like you've made some implementation parts public. To make it easier to evolve the implementation - not that I expect much of it- it is generally nicer if the internal are kept internal. But I'm not a .Net expert so not 100% sure if that is actually the case.

Nitpicks aside, LGTM.

Feel free to merge. When you're happy.

Co-authored-by: M.P. Korstanje <[email protected]>
@clrudolphi
Copy link
Contributor Author

Nitpicks aside, LGTM.

Feel free to merge. When you're happy.

Thanks for looking it over.
I'll ping Gaspar to take another look (likely next week) and then we'll merge. Let me know if that timing works for you.

@mpkorstanje
Copy link
Contributor

Let me know if that timing works for you.

On short time frames anything works.

Ideally I'd get you onboarded with https://github.com/cucumber/polyglot-release then you can release it yourself.

Copy link
Member

@gasparnagy gasparnagy left a comment

Choose a reason for hiding this comment

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

Sorry for being late. It is fine.

@mpkorstanje mpkorstanje merged commit 3938cb7 into main Nov 26, 2025
43 checks passed
@mpkorstanje mpkorstanje deleted the dotnet branch November 26, 2025 12:48
@mpkorstanje
Copy link
Contributor

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

Successfully merging this pull request may close these issues.

4 participants