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

Dmitri Blinov commented on JEXL-304:
------------------------------------

If I am allowed to make a suggestion, the change to the {{DOT_ID}} token is 
unnessesary, the code
{code:java}
<DOT_ID> TOKEN : /* IDENTIFIERS */
{
  < DOT_IDENTIFIER: ( [ "0"-"9", "a"-"z", "A"-"Z", "_", "$", "@" ])+ | "var" > 
{ popDot(); } /* Revert state to default. */
}
{code}
does not add anything new to the initial definition of token
{code:java}
<DOT_ID> TOKEN : /* IDENTIFIERS */
{
  < DOT_IDENTIFIER: ( [ "0"-"9", "a"-"z", "A"-"Z", "_", "$", "@" ])+ > { 
popDot(); } /* Revert state to default. */
}
{code}
But we need to change token {{VAR}} from
{code:java}
<*> TOKEN : /* KEYWORDS */
{
...
    | < VAR : "var" >
...
}
{code}
to
{code:java}
<*> TOKEN : /* KEYWORDS */
{
...
    | < VAR : "var" > { popDot(); } /* Revert state to default if was DOT_ID. */
...
}
{code}
If we going to allow 'var' to go after the dot

> Error parsing overview.limit.var
> --------------------------------
>
>                 Key: JEXL-304
>                 URL: https://issues.apache.org/jira/browse/JEXL-304
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.1
>            Reporter: Marcus Warm
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.2
>
>
> I'm a user and committer of the JXLS framework. It uses JEXL to evaluate 
> expressions. Since JEXL 3 it's not possible to evaluate "overview.limit.var". 
> It was possible in V2. In our context "var" means "Value At Risk". I know 
> "var" is a reserved word in JEXL. But in this "dotted-variables" context I 
> think JEXL should try to use it as a variable, because it makes no sense as a 
> var (=define variable) command.
>  
> {code:java}
> public void testVar() {
>   JexlEngine jexlEngine = new JexlBuilder().strict(false).create();
>   JexlExpression jexlExpresssion =
>       jexlEngine.createExpression("overview.limit.var");
>   HashMap map3 = new HashMap();
>   map3.put("var", "4711");
>   HashMap map2 = new HashMap();
>   map2.put("limit", map3);
>   HashMap map = new HashMap();
>   map.put("overview", map2);
>   MapContext context = new MapContext(map);
>   Object value = jexlExpresssion.evaluate(context);
>   assertEquals("4711", value); // fails
> }
> {code}
> Error message:
> {code:java}
> org.apache.commons.jexl3.JexlException$Parsing: 
> de.xmap.tools.jexl.JEXL3VariableTest.testVar@1:15 parsing error in '.'
>   at org.apache.commons.jexl3.JexlEngine.createExpression(JexlEngine.java:304)
>   at de.xmap.tools.jexl.JEXL3VariableTest.testVar(JEXL3VariableTest.java:107)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method){code}



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

Reply via email to