Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to parse nested for-loop expression #940

Open
saig0 opened this issue Oct 7, 2024 · 0 comments
Open

Fail to parse nested for-loop expression #940

saig0 opened this issue Oct 7, 2024 · 0 comments
Labels
scope: Camunda 8 Required in the context of Camunda 8 type: bug

Comments

@saig0
Copy link
Member

saig0 commented Oct 7, 2024

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]
@saig0 saig0 added type: bug scope: Camunda 8 Required in the context of Camunda 8 labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: Camunda 8 Required in the context of Camunda 8 type: bug
Projects
None yet
Development

No branches or pull requests

1 participant