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

feat: add support for camunda variable escaping extension #37

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

makepanic
Copy link
Contributor

Which issue does this PR address?

Closes #36

@makepanic
Copy link
Contributor Author

I'm not sure if it's really a good idea to let the whole back tick content be a VariableName token or if it's better to use a separate token.

@nikku
Copy link
Owner

nikku commented Aug 21, 2024

Cf. #36 (comment) and previous comments. I think you want to declare it as a token extension. I'd be fine to accept a PR that implements this as a "camunda" dialect.

@nikku
Copy link
Owner

nikku commented Aug 21, 2024

I'm not sure if it's really a good idea to let the whole back tick content be a VariableName

I think the backtick content should be an Identifier, so grammar wise VariableName is composed in the same way.

Edit: If it was a BacktickIdentifier then we're fine, too. Downstream we just have to ensure users will able to parse it respectively if they want to support the @camunda grammar flavor, specifically they have to strip the ticks to retrieve the actual "raw" value.

@nikku
Copy link
Owner

nikku commented Aug 21, 2024

The lezer/javascript grammar has some good pointers how to work with lezer dialects:

https://github.com/lezer-parser/javascript/blob/main/src/javascript.grammar

@makepanic
Copy link
Contributor Author

makepanic commented Aug 21, 2024

Thanks for the feedback.
I've updated the grammar with the camunda dialect and adjusted the test to set the dialect where needed.

I'll change the identifier next

@makepanic
Copy link
Contributor Author

I'm not sure if that's what you meant but I've updated the grammar to extract a new BacktickIdentifier which is used in the VariableName

* Adds `camunda` dialect
* Adds support for backtick escaped variables, i.e. foo.`boo ba`
* Must be explicitly enabled via `camunda` dialect

Closes nikku#36
@nikku
Copy link
Owner

nikku commented Aug 21, 2024

Thanks, great contribution. Merged with minor adjustments (cf. 2e8da37).

@nikku nikku merged commit ee59237 into nikku:main Aug 21, 2024
1 check passed
@nikku
Copy link
Owner

nikku commented Aug 21, 2024

Released as https://github.com/nikku/lezer-feel/releases/tag/v1.3.0.

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.

Support for camunda extension "Escape variable names"?
2 participants