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

Henri Biestro commented on JEXL-265:
------------------------------------

HOW (0):
It's not possible to check at parsing time wether a namespace is actually valid 
or not; solution must be syntax/grammar only.
HOW (1):
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.
With this solution, {{x?y:z()}} will generate an error... 

> 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.



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

Reply via email to