[ 
https://issues.apache.org/jira/browse/JEXL-265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Biestro updated JEXL-265:
-------------------------------
    Description: 
A common expression like {{(true) ? x : abs(1)}} throws a parsing exception.
The workaround is to add parentheses around the right hand side {{(true) ? x : 
(abs(1))}} .

The actual cause is that the grammar can not disambiguate between a correct 
ternary expression that uses a function call as right choice and one that uses 
a namespace function call as left choice {{x : abs(1)}} and misses the right 
hand choice, that latter case raising an exception.

To remove the ambiguity and actually stick to identifier form, a namespace 
identifier like 'x:y' will no longer allow spaces between the inner ':' and the 
namespace 'x' and identifier 'y'. This way, the intention of using a namespace 
is clear and the previous ambiguity removed.



  was:
A common expression like {{(true) ? x : abs(1)}} throws a parsing exception.
The workaround is to add parentheses around the right hand side {{(true) ? x : 
(abs(1))}} .

The actual cause though is that the grammar can not disambiguate between a 
correct ternary expression that uses a function call as right choice and one 
that uses a namespace function call as left choice {{x : abs(1)}} and misses 
the right hand choice, that latter case raising an exception.

To remove the ambiguity and actually stick closer to identifier form, a 
namespace identifier like x:y will no longer allow spaces between the inner ':' 
and the namespace (x) and identifier (y). This way, the intention of using a 
namespace is made clear 




> Ternary expression and namespace identifier grammar ambiguity leads to 
> parsing error
> ------------------------------------------------------------------------------------
>
>                 Key: JEXL-265
>                 URL: https://issues.apache.org/jira/browse/JEXL-265
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.1
>            Reporter: Henri Biestro
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.2
>
>
> A common expression like {{(true) ? x : abs(1)}} throws a parsing exception.
> The workaround is to add parentheses around the right hand side {{(true) ? x 
> : (abs(1))}} .
> The actual cause is that the grammar can not disambiguate between a correct 
> ternary expression that uses a function call as right choice and one that 
> uses a namespace function call as left choice {{x : abs(1)}} and misses the 
> right hand choice, that latter case raising an exception.
> To remove the ambiguity and actually stick to identifier form, a namespace 
> identifier like 'x:y' will no longer allow spaces between the inner ':' and 
> the namespace 'x' and identifier 'y'. This way, the intention of using a 
> namespace is clear and the previous ambiguity removed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to