Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46A3147D2 for ; Mon, 11 Jul 2011 21:12:26 +0000 (UTC) Received: (qmail 41944 invoked by uid 500); 11 Jul 2011 21:12:26 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 41849 invoked by uid 500); 11 Jul 2011 21:12:25 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 41841 invoked by uid 99); 11 Jul 2011 21:12:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jul 2011 21:12:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jul 2011 21:12:22 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 8D6234A05F for ; Mon, 11 Jul 2011 21:12:00 +0000 (UTC) Date: Mon, 11 Jul 2011 21:12:00 +0000 (UTC) From: "Henri Biestro (JIRA)" To: issues@commons.apache.org Message-ID: <1172332278.4048.1310418720576.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <419731765.4010.1310417820650.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (JEXL-114) Allow scripts to create local variables // Add return keyword MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JEXL-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Biestro updated JEXL-114: ------------------------------- Description: WHY: Not having local variables nor return in scripts is inconvenient, especially when dealing with loops. This also precludes using read-only contexts easily which are really convenient when letting end-users enter their own expressions. HOW: This could (will) be implemented by extending the parameters feature (script accept parameters during parsing and thus arguments during evaluation) which is itself based on the notion of 'registers' - an array of objects that the interpreter allocates and uses based on script information. It only requires adding one keyword ("var" seems the obvious choice) in the .jjt. The "return" keyword is also an easy .jjt addition; obvious implementation is to use an internal exception to force traversing the stack up. WHAT: Add the "var" and "return" keyword. Also add methods to extract the variables (global - see JEXL-113), the parameters (used during parsing) and the local variables (declared within) a script to help pinpoint problems or prepare the evaluation of scripts. was: Not having local variables in scripts is inconvenient, especially when dealing with loops. This also precludes using read-only contexts easily which are really convenient when letting end-users enter their own expressions. This could (will) be implemented by extending the parameters feature (script accept parameters during parsing and thus arguments during evaluation) which is itself based on the notion of 'registers' - an array of objects that the interpreter allocates and uses based on script information. Summary: Allow scripts to create local variables // Add return keyword (was: Allow scripts to create local variables) > Allow scripts to create local variables // Add return keyword > ------------------------------------------------------------- > > Key: JEXL-114 > URL: https://issues.apache.org/jira/browse/JEXL-114 > Project: Commons JEXL > Issue Type: Improvement > Affects Versions: 2.0.1 > Reporter: Henri Biestro > Assignee: Henri Biestro > Fix For: 2.0.2 > > > WHY: > Not having local variables nor return in scripts is inconvenient, especially when dealing with loops. > This also precludes using read-only contexts easily which are really convenient when letting end-users enter their own expressions. > HOW: > This could (will) be implemented by extending the parameters feature (script accept parameters during parsing and thus arguments during evaluation) which is itself based on the notion of 'registers' - an array of objects that the interpreter allocates and uses based on script information. > It only requires adding one keyword ("var" seems the obvious choice) in the .jjt. > The "return" keyword is also an easy .jjt addition; obvious implementation is to use an internal exception to force traversing the stack up. > WHAT: > Add the "var" and "return" keyword. > Also add methods to extract the variables (global - see JEXL-113), the parameters (used during parsing) and the local variables (declared within) a script to help pinpoint problems or prepare the evaluation of scripts. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira