Skip to content

Commit

Permalink
feat: add support for camunda variable escaping extension
Browse files Browse the repository at this point in the history
fixes #36
  • Loading branch information
makepanic committed Aug 21, 2024
1 parent 4f9b608 commit d404f51
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/feel.grammar
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@dialects { camunda }

@precedence {
name,
type,
Expand Down Expand Up @@ -323,7 +325,7 @@ Identifier {
}

VariableName {
(!name Identifier ~ident)+
(!name Identifier ~ident)+ | escapedVariable
}

AdditionalIdentifier[@name=Identifier] {
Expand Down Expand Up @@ -453,6 +455,10 @@ commaSep<Expr> {
(digits ("." digits)? | "." digits)
}

escapedVariable[@dialect=camunda] {
"`" (![\\\n`] | "\\" _)* "`"
}

@precedence { BlockComment, LineComment, divide }

@precedence {
Expand Down
15 changes: 15 additions & 0 deletions test/expressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2619,4 +2619,19 @@ foo[[[[[[[(1..10).start included]]]]]]]

Expression(
FilterExpression(VariableName(...), List(...))
)


# Camunda escape character { "top": "Expressions", "dialect": "camunda" }

`foo`;
foo.`bar`;
foo.`bar-baz`;

==>

Expressions(
VariableName(...),
PathExpression(VariableName(...), VariableName(...)),
PathExpression(VariableName(...), VariableName(...))
)

0 comments on commit d404f51

Please sign in to comment.