[ 
https://issues.apache.org/jira/browse/JEXL-429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884502#comment-17884502
 ] 

Henri Biestro commented on JEXL-429:
------------------------------------

Ternary and namespace syntax is a grammar ambiguity pothole.
To fix this, a new hint will consider if the function name (the fun in ns : 
fun()) is a variable which solves this precise case.

A new feature flag is introduced, 'namespace identifier' which considers a 
namespace identifier as one token that is only when 'ns:fun' is written with no 
space in between. Default remains false but, as per recommendation, one should 
be explicit about which feature, option, security and arithmetic is used.

> Ternary expression regression
> -----------------------------
>
>                 Key: JEXL-429
>                 URL: https://issues.apache.org/jira/browse/JEXL-429
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>            Reporter: Shuo Geng
>            Assignee: Henri Biestro
>            Priority: Major
>
> {*}Regression{*}:
> {code:java}
> const f = function(a) {return a;}; 
> b ? b : f(2);{code}
> When the script is executed, there is a variable *b* in the jexl context with 
> value as {*}1{*}. 
> The script returns 1 as expected in 3.3, but throws a parsing exception in 
> 3.4.0.
> {code:java}
> parsing error in ';'
>     at org.apache.commons.jexl3.JexlEngine.createScript(JexlEngine.java:411) 
> {code}
> If the ternary statement is changed to {{b ? f(2) : b;}} , there is no issue 
> and 2 is returned as expected. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to