Skip to content

Commit

Permalink
fix: Parse variable name starting with "in"
Browse files Browse the repository at this point in the history
Adjust the parsing of a variable name. If the name starts with a key word, like "in", it can continue with a number.

Previously, the key word must be followed by a letter.
  • Loading branch information
saig0 committed Aug 27, 2024
1 parent 91fc30d commit 61cd326
Showing 1 changed file with 8 additions and 3 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

0 comments on commit 61cd326

Please sign in to comment.