On 07/01/2010, [email protected] <[email protected]> wrote:
> Author: henrib
> Date: Thu Jan 7 18:00:07 2010
> New Revision: 896944
>
> URL: http://svn.apache.org/viewvc?rev=896944&view=rev
> Log:
> JEXL-46; adding Perl-like regular-expression operators (=~ and !~)
[...]
> /** {...@inheritdoc} */
> + public Object visit(ASTERNode node, Object data) {
> + Object left = node.jjtGetChild(0).jjtAccept(this, data);
> + Object right = node.jjtGetChild(1).jjtAccept(this, data);
> + try {
> + return arithmetic.matches(left, right) ? Boolean.TRUE :
> Boolean.FALSE;
or could use
Boolean.valueOf(arithmetic.matches(left, right));
> + } catch (RuntimeException xrt) {
> + throw new JexlException(node, ">= error", xrt);
s/>=/=~/
> + }
> + }
> +
> + /** {...@inheritdoc} */
> public Object visit(ASTIdentifier node, Object data) {
> String name = node.image;
> if (data == null) {
> @@ -972,6 +985,17 @@
> }
>
> /** {...@inheritdoc} */
> + public Object visit(ASTNRNode node, Object data) {
> + Object left = node.jjtGetChild(0).jjtAccept(this, data);
> + Object right = node.jjtGetChild(1).jjtAccept(this, data);
> + try {
> + return arithmetic.matches(left, right) ? Boolean.FALSE :
> Boolean.TRUE;
> + } catch (RuntimeException xrt) {
> + throw new JexlException(node, ">= error", xrt);
s/>=/!~/
> + }
> + }
> +
> + /** {...@inheritdoc} */
> public Object visit(ASTNotNode node, Object data) {
> Object val = node.jjtGetChild(0).jjtAccept(this, data);
> return arithmetic.toBoolean(val) ? Boolean.FALSE : Boolean.TRUE;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]