You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitri Blinov (Jira)" <ji...@apache.org> on 2019/09/30 10:16:00 UTC

[jira] [Created] (JEXL-316) Operator ?? has very low priority

Dmitri Blinov created JEXL-316:
----------------------------------

             Summary: Operator ?? has very low priority
                 Key: JEXL-316
                 URL: https://issues.apache.org/jira/browse/JEXL-316
             Project: Commons JEXL
          Issue Type: Bug
    Affects Versions: 3.2
            Reporter: Dmitri Blinov


In current version of JEXL the script
{code:java}
10??0 + 200 {code}
evaluates to 10, which is counterintuitive. It requires to always use parantheses after {{\\??}}. The operator {{??}} should have higer priority. It is the same problem as with current version of freemarker, but they promise to fix it in the next major release.

The suggestion is to set priority of operator {{??}} to be between {{UnaryExpression()}} and {{ValueExpression()}}

{code}
void ConditionalExpression() #void : {}
{
  ConditionalOrExpression()
  (
    <QMARK> Expression() <COLON> Expression() #TernaryNode(3)
  |
    <ELVIS> Expression() #TernaryNode(2)
  )?
}
...
void UnaryExpression() #void : {}
{
    <minus> UnaryExpression() #UnaryMinusNode(1)
  |
    <plus> UnaryExpression() #UnaryPlusNode(1)
  |
    <tilda> UnaryExpression() #BitwiseComplNode(1)
  |
    (<not>|<NOT>) UnaryExpression() #NotNode(1)
  |
    <EMPTY> UnaryExpression() #EmptyFunction(1)
  |
    <SIZE> UnaryExpression() #SizeFunction(1)
  |
    NullpExpression()
}

void NullpExpression() #void : {}
{
    ValueExpression()
    (
       <NULLP> ValueExpression() #NullpNode(2)
    )*
}
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)