commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JEXL-296) Real literal in scientific format is not parsed without suffix
Date Mon, 01 Apr 2019 08:45:04 GMT

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

Dmitri Blinov updated JEXL-296:
-------------------------------
    Description: 
I have found that in current implementation the {{testRealLiteralScript()}} fails with ambigous
statement error 
{code:java}
    @Test
    public void testRealLiteralScript() throws Exception {
        JexlContext jc = new MapContext();
        Object o;
        o = JEXL.createScript("1e10").execute(jc);
        Assert.assertEquals(1e10, o);
    }

{code}
 

  was:
I have found that in current implementation the {{testRealLiteralScript()}} fails with ambigous
expression error whereas {{testRealLiteralExpr()}} passes as expected.

{code}
    @Test
    public void testRealLiteralScript() throws Exception {
        JexlContext jc = new MapContext();
        Object o;
        o = JEXL.createScript("1e10d").execute(jc);
        Assert.assertEquals(1e10d, o);
    }

    @Test
    public void testRealLiteralExpr() throws Exception {
        JexlContext jc = new MapContext();
        Object o;
        o = JEXL.createExpression("1e10d").evaluate(jc);
        Assert.assertEquals(1e10d, o);
    }
{code}

Changing the grammar from 
{code}
void Literal() #void :
{
   Token t;
}
{
  IntegerLiteral()
|
  FloatLiteral()
...
{code}
to 
{code}
void Literal() #void :
{
   Token t;
}
{
  FloatLiteral()
|
  IntegerLiteral()
...
{code}
fixes the problem but I'm not sure if there is more robust solution to this


> Real literal in scientific format is not parsed without suffix
> --------------------------------------------------------------
>
>                 Key: JEXL-296
>                 URL: https://issues.apache.org/jira/browse/JEXL-296
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Priority: Major
>
> I have found that in current implementation the {{testRealLiteralScript()}} fails with
ambigous statement error 
> {code:java}
>     @Test
>     public void testRealLiteralScript() throws Exception {
>         JexlContext jc = new MapContext();
>         Object o;
>         o = JEXL.createScript("1e10").execute(jc);
>         Assert.assertEquals(1e10, o);
>     }
> {code}
>  



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

Mime
View raw message