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 52fa949
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
12 changes: 11 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 @@ -322,8 +324,12 @@ Identifier {
identifier | nameIdentifier
}

BacktickIdentifier {
escapedVariable
}

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

AdditionalIdentifier[@name=Identifier] {
Expand Down Expand Up @@ -453,6 +459,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 52fa949

Please sign in to comment.