You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2010/01/07 19:57:38 UTC
Re: svn commit: r896944 - in /commons/proper/jexl/trunk/src:
main/java/org/apache/commons/jexl2/ main/java/org/apache/commons/jexl2/parser/
test/java/org/apache/commons/jexl2/
On 07/01/2010, henrib@apache.org <he...@apache.org> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org