feat: support templating language in camunda dialect#58
Draft
mathieu-stennier wants to merge 1 commit intonikku:mainfrom
Draft
feat: support templating language in camunda dialect#58mathieu-stennier wants to merge 1 commit intonikku:mainfrom
mathieu-stennier wants to merge 1 commit intonikku:mainfrom
Conversation
Owner
|
Thanks for the contribution. I'll move this to backlog until Camunda decides to make this an official part of their dialect. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: support templating language in Camunda dialect
Summary
Add a new multi‑line template string literal to the FEEL grammar (Camunda dialect), fenced by triple backticks
```and tokenized into small body pieces for robust incremental parsing. The outer FEEL grammar recognizes this asTemplateLiteral(a kind of literal value). The template’s body text is intentionally structured so it can be parsed by a nested Lezer grammar (e.g., our templating/“feelers” language) viaparseMixed.This enables expressions like:
and usage inside objects/contexts:
What changed (diff highlights)
File:
src/feel.grammarExtend
simpleLiteralto includeTemplateLiteral:Add a local tokenization block (local
@skip {}so newlines aren’t skipped inside the template) and the nonterminal:Define template fence & body tokens (scoped to the Camunda dialect) and precedence so the closing fence wins over partial backtick matches:
Note: existing
backtickIdentifierremains; triple‑backtick fences and the precedence rule avoid conflicts.File:
test/camunda.txtAdd parsing tests demonstrating:
```Hello```;`` ```; ````{{ … }}markersThe expected parse tree shows
TemplateLiteral(TemplateFence, TemplateText(…), TemplateFence)and breaks body text intoTemplateChunk,TemplateNewLine,TemplateSimpleBacktick, andTemplateDoubleBacktickas appropriate.Rationale
TemplateChunk,TemplateNL,TemplateBT1/2) enable incremental parsing: edits reparse only the affected pieces, not the entire block.parseMixedwith anoverlaytargetingTemplateText.Behavior
TemplateLiteralis accepted anywhere asimpleLiteralis allowed (e.g., as values in contexts or as stand‑alone expressions).TemplateBT1/2).How to test
test/camunda.txtpasses.Follow‑ups (separate PRs welcome)
parseMixedso thatTemplateTextis parsed/highlighted by the inner grammar while fences remain FEEL.styleTagsforTemplateFence/TemplateNewLineand inner‑language tokens once mounted.\r?\nif needed (todayTemplateNLmatches\n).Backward compatibility
TemplateLiteral.Checklist
TemplateLiteral, tokens, precedence).@skip {}for template body (preserve newlines).