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/04/01 08:33:00 UTC
[jira] [Created] (JEXL-296) Real literal in scientific format is
not parsed as a statement
Dmitri Blinov created JEXL-296:
----------------------------------
Summary: Real literal in scientific format is not parsed as a statement
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
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
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)