flow-development-collection
flow-development-collection copied to clipboard
FEATURE: EEL extend parenthesis handling syntax according to es standard
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
Currently eel syntax that concern in-lining a directly using such function/ object are not parsed as such:
object to map properties
({"my": "map", "foo": "bar"})["my"]
// Expression [...] could not be parsed. Error starting at character 29: "["my"]".
// Expected output (tested in js): "map"
(object) function invocation.
Like in php, if a property of an object is a closure one needs to invoke it like ($this->foo)()
imagine a php object with a closure as property. Or expressed in fusion: someFunction = ${(foo) => "hi"}
if i want to invoke it id need to write the following: (given that this.someFunction points to a closure, not a method!)
(this.someFunction)()
// Expression [...] could not be parsed. Error starting at character 10: "()".
// Expected output (tested in js) result of this.someFunction call, eg: "hi"
reproduceable fusion example: https://fusionpen.punkt.de/fusionpen/fa649ba17bcd6cee70d258a42f84cb81c1f2c3c9.html
prototype(Example:EelFunctionInvokation) < prototype(Neos.Fusion:Component) {
closureInProps = ${() => "bar"}
@context.closureInContext = ${() => "bing"}
// Working
renderer = ${closureInContext()}
// Not working due to inlining is not supported, and eel treats parens () not correctly.
// renderer = ${(closureInContext)()}
// renderer = ${(props.closureInProps)()}
// Is okay to be not working (considering php), as it would try to invoke method $props->closureInProps()
// renderer = ${props.closureInProps()}
}
simple processing
ieff (immediately Invoked Function Expression)
(value => value == "a" ? "b" : value)("onceRetrievedValue")
// Expression [...] could not be parsed. Error starting at character 37: "("onceRetrievedValue")".
// Expected output (tested in js): "onceRetrievedValue"
Possible Solution
Extend the EEL parser.
Or since eel is quite behind the es standart (eg spreads), we may find another working solution out there to replace eel?