Author: sebb
Date: Sun Aug  2 02:17:09 2009
New Revision: 799969

URL: http://svn.apache.org/viewvc?rev=799969&view=rev
Log:
JEXL-43
Documentation clarifications and new 2.0 features

Modified:
    commons/proper/jexl/branches/2.0/xdocs/reference/syntax.xml

Modified: commons/proper/jexl/branches/2.0/xdocs/reference/syntax.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/xdocs/reference/syntax.xml?rev=799969&r1=799968&r2=799969&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/xdocs/reference/syntax.xml (original)
+++ commons/proper/jexl/branches/2.0/xdocs/reference/syntax.xml Sun Aug  2 
02:17:09 2009
@@ -6,9 +6,9 @@
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
-  
+
         http://www.apache.org/licenses/LICENSE-2.0
-  
+
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,8 +45,13 @@
         <tr>
           <td>Comments</td>
           <td>
-            Specified using <code>##</code> and extend to the end of line, e.g.
+            Specified using <code>##</code> or <code>//</code>and extend to 
the end of line, e.g.
             <source>## This is a comment</source>
+            Also specified using <code>//</code>, e.g.
+            <source>// This is a comment</source>
+            Multiple lines comments are specified using <code>/*...*/</code>, 
e.g.
+            <source>/* This is a
+            multi-line comment */</source>
           </td>
         </tr>
         <tr>
@@ -60,7 +65,7 @@
               <li>Invalid: 
<code>9v</code>,<code>!a99</code>,<code>1$</code></li>
             </ul>
             <p>
-            Variable names are case-sensitive, e.g. <code>var1</code> and 
<code>Var1</code> are different variables. 
+            Variable names are case-sensitive, e.g. <code>var1</code> and 
<code>Var1</code> are different variables.
             </p>
             <p>
               JEXL also supports <code>ant-style</code> variables, e.g. 
<source>my.dotted.var</source>
@@ -68,7 +73,7 @@
               <br/>
               N.B. the following keywords are reserved, and cannot be used as 
a variable name or property when using the dot operator:
               <code>or and eq ne lt gt le ge div mod not null true false 
new</code>
-              For example, 
+              For example,
               <code>my.new.dotted.var</code>
               is invalid.
               In such cases, the [ ] operator can be used, for example:
@@ -100,6 +105,24 @@
             A block is simply multiple statements inside curly braces 
(<code>{, }</code>).
           </td>
         </tr>
+        <tr>
+          <td>Assignment</td>
+          <td>
+            Assigns the value of a variable  (<code>my.var = 'a value'</code>) 
using a
+            <code>JexlContext</code> as initial resolver. Both <em>beans</em> 
and <em>ant-ish</em>
+            variables assignment are supported.
+          </td>
+        </tr>
+        <tr>
+          <td>Method calls</td>
+          <td>
+            Calls a method of an object, e.g.
+            <source>"hello world".hashCode()</source> will call the 
<code>hashCode</code> method
+            of the <code>"hello world"</code> String.
+            <p>In case of multiple arguments and overloading, Jexl will make 
the best effort to find
+            the most appropriate non ambiguous method to call.</p>
+          </td>
+        </tr>
       </table>
     </section>
     <section name="Literals">
@@ -114,15 +137,16 @@
           <td>
             1 or more digits from <code>0</code> to <code>9</code>, followed
             by a decimal point and then one or more digits from
-            <code>0</code> to <code>9</code>. 
+            <code>0</code> to <code>9</code>.
           </td>
         </tr>
         <tr>
           <td>String literals</td>
           <td>
-            Can start and end with either <code>'</code> or <code>"</code>, 
e.g.
+            Can start and end with either <code>'</code> or <code>"</code> 
delimiters, e.g.
             <source>"Hello world"</source> and
             <source>'Hello world'</source> are equivalent.
+            <p>The escape character is <code>\</code>; it only escapes the 
string delimiter</p>
           </td>
         </tr>
         <tr>
@@ -172,6 +196,26 @@
             <source>size("Hello")</source> returns 5.
           </td>
         </tr>
+        <tr>
+          <td>new</td>
+          <td>
+            Creates a new instance using a fully-qualified class name or Class:
+            <source>new("java.lang.Double", 10)</source> returns 10.0.
+            <p>Note that the first argument of <code>new</code> can be a 
variable or any
+            expression evaluating as a String or Class; the rest of the 
arguments are used
+            as arguments to the constructor for the class considered.</p>
+            <p>In case of multiple constructors, Jexl will make the best 
effort to find
+            the most appropriate non ambiguous constructor to call.</p>
+          </td>
+        </tr>
+        <tr>
+          <td>ns:function</td>
+          <td>
+            A <code>JexlEngine</code> can register objects or classes used as 
function namespaces.
+            This can allow expressions like:
+            <source>math:cosinus(23.0)</source>
+          </td>
+        </tr>
       </table>
     </section>
     <section name="Operators">
@@ -204,7 +248,7 @@
         <tr>
           <td>Bitwise <code>and</code></td>
           <td>
-            The usual <code>&amp;</code> operator is used, e.g. 
+            The usual <code>&amp;</code> operator is used, e.g.
             <source>33 &amp; 4</source>, 0010 0001 &amp; 0000 0100 = 0.
           </td>
         </tr>
@@ -230,10 +274,20 @@
           </td>
         </tr>
         <tr>
+          <td>Ternary conditional <code>?:</code> </td>
+          <td>
+            The usual ternary conditional operator <code>condition? if_true : 
if_null_or_false;</code> operator can be used as well as
+            the abbreviation <code>value ?: if_null_or_false</code> which 
returns the <code>value</code> if
+            it is non-null and non-false, e.g.
+            <source>val1 ? val1 : val2</source> and
+            <source>val1 ?: val2 </source> are equivalent.
+          </td>
+        </tr>
+        <tr>
           <td>Equality</td>
           <td>
             The usual <code>==</code> operator can be used as well as the 
abbreviation <code>eq</code>.
-            For example 
+            For example
             <source>val1 == val2</source> and
             <source>val1 eq val2</source> are equivalent.
             <ol>
@@ -380,4 +434,4 @@
 
   </body>
 </document>
-    
+


Reply via email to