Java Apache JEXL boolean expressions issue
<p>I'm developing in Java a system to check the occurrence of a combination of keywords in a text. 
For example, I have the following expression to check: <code>( yellow || red ) &amp;&amp; sofa</code> .
 I divided the job into two steps. The first one is to detect individual words in the text.
 The second one is to use the result for checking the boolean expression. 
 After a short web search I choose Apache JEXL. </p>

<pre><code>// My web app contains a set of preconfigured keywords inserted by administrator: 
List&lt;String&gt; system_occurence =new ArrayList&lt;String&gt;() {{
    add("yellow");
    add("brown");
    add("red");
    add("kitchen");
    add("sofa");        
}}; 


// The method below check if some of system keywords are in the text
List&lt;String&gt; occurence = getOccurenceKeywordsInTheText();
for ( String word :occurrence){
    jexlContext.set(word,true);
}

// Set to false system keywords not in the text
system_occurence.removeAll(occurence);
for ( String word :system_occurence){
    jexlContext.set(word,false);
}


// Value the boolean expression
String jexlExp ="( yellow || red ) &amp;&amp; sofa"; 
JexlExpression e = jexl.createExpression( jexlExp_ws_keyword_matching );

Boolean o = (Boolean) e.evaluate(jexlContext);
</code></pre>

<p>In the above example, I use simple words in the boolean expression. With ASCII and non-composite words I've no problems.
I've problems with non-ASCII and composite keywords inside the boolean expression because I can't use those as variables names.</p>

<pre><code>// The below example fails, JEXL launch Exception
String jexlExp ="( Lebron James || red ) &amp;&amp; sofa"; 

// The below example fails, JEXL launch Exception
String jexlExp ="( òsdà || red ) &amp;&amp; sofa";
</code></pre>

<p>How can I solve? Is it right my way?    </p>

<p>Sorry for my bad English :) </p>