flow-development-collection icon indicating copy to clipboard operation
flow-development-collection copied to clipboard

FEATURE: Spaces before EEL melthod call or real multiline support

Open mhsdesign opened this issue 3 years ago • 4 comments

Description

The current state about multiline EEL:

  • it is not possible by the public api to eel / the actual parser may allow it

  • Fusion will "hack" it by doing a simple str_replace("\n", "", $eel) (Which works quite well, as its been this way since basically ever)

  • In Yaml it can be with archived via the operator: >- like

key: >-
  ${
    foo.bar
  }

But Fusions approach has some downsides:

if one starts a string like

foo = ${"
   hello
   world
"}

the newlines will be removed also in the string, so it ends up like this:

"   hello   world"

if one wants to write a flowquery in multiline (like in js or php) it fails...

foo = ${q(node)
    .bla()
    .bung()
    .buz()
}

Error:

Expression "q(node)        .bla()        .bung()        .buz()" could not be parsed. Error starting at character 7: "        .bla()        .bung()        .buz()".

Note that the parser only sees a single line due to the stripped newlines, so writing the above by hand seems wierd but even that would be valid syntax in php or js.

Possible Solution

A: Allow spaces before EEL method calls (make fooo . bar () valid)

B: Implement real multiline support in the parser

mhsdesign avatar Jul 20 '22 07:07 mhsdesign

thought:

key = eel`
  my
  multiline
  eel
  expression
`

kitsunet avatar Jul 20 '22 07:07 kitsunet

sure, but this more of the implementation - question on how to enable multiline in eel, as the eel parser only tolerates single line. Is there a reson that its not a feature of eel?

mhsdesign avatar Jul 20 '22 08:07 mhsdesign

AFAIK we did implement multi line in the parser AGES ago probably broken or not working in all circumstances...

kitsunet avatar Jul 20 '22 08:07 kitsunet

Okay my previous statement was wrong: The parser may take in multiline strings, but the public api to eel will not allow it and check for it ... it tries to match against a regex

mhsdesign avatar Jul 20 '22 09:07 mhsdesign