Skip to content

Commit

Permalink
Merge pull request #912 from camunda/backport-909-to-1.16
Browse files Browse the repository at this point in the history
[Backport 1.16] fix: Variable name starting with "in"
  • Loading branch information
saig0 authored Aug 28, 2024
2 parents 3d75a46 + 1148697 commit cd83d25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/main/scala/org/camunda/feel/impl/parser/FeelParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,17 @@ object FeelParser {
// an identifier which is not a reserved word. but, it can contain a reserved word.
private def identifier[_: P]: P[String] =
P(
reservedWord.? ~~ javaLikeIdentifier
(reservedWord ~~ namePart) | (reservedWord.? ~~ nameStart ~~ namePart.?)
).!

private def javaLikeIdentifier[_: P]: P[String] =
private def nameStart[_: P]: P[String] =
P(
CharPred(Character.isJavaIdentifierStart) ~~ CharsWhile(Character.isJavaIdentifierPart, 0)
CharPred(Character.isJavaIdentifierStart)
).!

private def namePart[_: P]: P[String] =
P(
CharsWhile(Character.isJavaIdentifierPart, 1)
).!

// an identifier wrapped in backticks. it can contain any char (e.g. `a b`, `a+b`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ class InterpreterExpressionTest
"inside",
"durationX",
"dateX",
"timeX"
"timeX",
"inX",
"in1"
).foreach { variableName =>
it should s"contain a key-word ($variableName)" in {

Expand Down

0 comments on commit cd83d25

Please sign in to comment.