Skip to content

Fail to parse nested for-loop expression #940

Open
@saig0

Description

@saig0

Describe the bug
The FEEL engine fails to parse a nested for-loop expression:

context merge(
  for entry in
    for kvPair in (for kvPair in split(rawContent, "\n") return kvPair) return split(kvPair, "=")
  return
    context put({}, entry[1], entry[2])
)

If I wrap the nested for-loop inside parenthesis, the FEEL engine can parse the expression:

context merge(
  for entry in
    (for kvPair in (for kvPair in split(rawContent, "\n") return kvPair) return split(kvPair, "="))
  return
    context put({}, entry[1], entry[2])
)

To Reproduce
Steps to reproduce the behavior:

  1. Parse the expression above (Playground)
  2. Verify that the expression can't be parsed
failed to parse expression 'context merge(
  for entry in
    for kvPair in (for kvPair in split(rawContent, "\n") return kvPair) return split(kvPair, "=")
  return
    context put({}, entry[1], entry[2])
)': Expected (binaryComparison | between | instanceOf | in | "and" | "or" | end-of-input):1:9, found "merge(\n  f"

Expected behavior
I can parse a nested for-loop without adding parenthesis.

Environment

  • FEEL engine version: 1.18.1
  • Affects:
    • Camunda Automation Platform 7: [7.x]
    • Zeebe broker: [0.x]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions