Skip to content

[java] provide a public method to convert a cucumber expression into parsed segments #51

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

Open
laeubi opened this issue Dec 2, 2021 · 6 comments · May be fixed by #340
Open

[java] provide a public method to convert a cucumber expression into parsed segments #51

laeubi opened this issue Dec 2, 2021 · 6 comments · May be fixed by #340

Comments

@laeubi
Copy link

laeubi commented Dec 2, 2021

For regularExpressions it is already possible to parse them into groups with a public method, a similar approach should be possible for the CucumberExpressionsParser as well (maybe the Groups Aproach could be reused here...)

@aslakhellesoy
Copy link
Contributor

Have you tried converting the Cucumber Expression to a Pattern then call the static Group.parse method?

@mpkorstanje
Copy link
Contributor

I believe he is interested in the AST for the purpose of syntax highlighting in Eclipse.

@aslakhellesoy
Copy link
Contributor

Aha I see. We'd have to add a getter to get the AST to achieve that. The AST API is currently internal, and I think we should keep it internal until we have implemented the proposed changes in #41 because that will change the AST quite a bit.

@laeubi
Copy link
Author

laeubi commented May 15, 2025

I cam again across this issue and wonder if it would be possible to make the AST simply a public type?

it could even live in an own package and mark it experimental!

I have the same issue now with GroupBuilder and TreeRegexp that are package private as well.

@mpkorstanje
Copy link
Contributor

For this I can understand how it would help with syntax highlighting:

CucumberExpressionParser parser = new CucumberExpressionParser();
Node ast = parser.parse(expression);

For GroupBuilder and TreeRegexp not so much.

@mpkorstanje
Copy link
Contributor

Btw, instead of GroupBuilder and TreeRegexp could you use Group instead?

mpkorstanje added a commit that referenced this issue May 15, 2025
Fixes: #51

By doing this we're exposing the public API surface. If #41 ever gets
implemented, it may require a change to the AST. We can live with that.
@mpkorstanje mpkorstanje linked a pull request May 15, 2025 that will close this issue
7 tasks
mpkorstanje added a commit that referenced this issue May 15, 2025
Fixes: #51

By doing this we're exposing the public API surface. If #41 ever gets
implemented, it may require a change to the AST. We can live with that.
mpkorstanje added a commit that referenced this issue May 15, 2025
Fixes: #51

By doing this we're exposing the public API surface. If #41 ever gets
implemented, it may require a change to the AST. We can live with that.
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 a pull request may close this issue.

3 participants