commons-jexl-1.1-src/ 40755 0 0 0 10500374603 11603 5ustar 0 0 commons-jexl-1.1-src/examples/ 40755 0 0 0 10500374603 13421 5ustar 0 0 commons-jexl-1.1-src/src/ 40755 0 0 0 10500374603 12372 5ustar 0 0 commons-jexl-1.1-src/src/conf/ 40755 0 0 0 10500374603 13317 5ustar 0 0 commons-jexl-1.1-src/src/java/ 40755 0 0 0 10500374603 13313 5ustar 0 0 commons-jexl-1.1-src/src/java/org/ 40755 0 0 0 10500374603 14102 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/ 40755 0 0 0 10500374603 15323 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/ 40755 0 0 0 10500374603 16776 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/ 40755 0 0 0 10500374603 17740 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/context/ 40755 0 0 0 10500374603 21424 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/junit/ 40755 0 0 0 10500374603 21071 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ 40755 0 0 0 10500374603 21234 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/resolver/ 40755 0 0 0 10500374603 21601 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/ 40755 0 0 0 10500374603 20715 5ustar 0 0 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/ 40755 0 0 0 10500374603 23615 5ustar 0 0 commons-jexl-1.1-src/src/test/ 40755 0 0 0 10500374603 13351 5ustar 0 0 commons-jexl-1.1-src/src/test/org/ 40755 0 0 0 10500374603 14140 5ustar 0 0 commons-jexl-1.1-src/src/test/org/apache/ 40755 0 0 0 10500374603 15361 5ustar 0 0 commons-jexl-1.1-src/src/test/org/apache/commons/ 40755 0 0 0 10500374603 17034 5ustar 0 0 commons-jexl-1.1-src/src/test/org/apache/commons/jexl/ 40755 0 0 0 10500374603 17776 5ustar 0 0 commons-jexl-1.1-src/src/test/org/apache/commons/jexl/junit/ 40755 0 0 0 10500374603 21127 5ustar 0 0 commons-jexl-1.1-src/src/test/org/apache/commons/jexl/parser/ 40755 0 0 0 10500374603 21272 5ustar 0 0 commons-jexl-1.1-src/src/test-scripts/ 40755 0 0 0 10500374603 15036 5ustar 0 0 commons-jexl-1.1-src/xdocs/ 40755 0 0 0 10500374603 12723 5ustar 0 0 commons-jexl-1.1-src/xdocs/images/ 40755 0 0 0 10500374603 14170 5ustar 0 0 commons-jexl-1.1-src/xdocs/reference/ 40755 0 0 0 10500374603 14661 5ustar 0 0 commons-jexl-1.1-src/xdocs/style/ 40755 0 0 0 10500374603 14063 5ustar 0 0 commons-jexl-1.1-src/build.properties.sample100644 0 0 1510 10500374603 16372 0ustar 0 0 # Copyright 2006 The Apache Software Foundation # # Licensed 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. # See the License for the specific language governing permissions and # limitations under the License. # The ant script is mostly self-sufficient as it fetches the # dependencies it needs. # # Commons JEXL dependency information is here: # # http://jakarta.apache.org/commons/jexl/dependencies.html commons-jexl-1.1-src/build.xml100644 0 0 14233 10500374603 13544 0ustar 0 0 ================================= WARNING ================================ Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed. ========================================================================== commons-jexl-1.1-src/examples/ArrayExample.java100644 0 0 3674 10500374603 16765 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; import java.util.List; import java.util.ArrayList; /** * Simple example to show how to access arrays. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: ArrayExample.java 397078 2006-04-26 04:07:54Z dion $ */ public class ArrayExample { /** * Command line entry point. * @param args command line arguments * @throws Exception cos jexl does. */ public static void main(String[] args) throws Exception { /* * First make a jexlContext and put stuff in it */ JexlContext jc = JexlHelper.createContext(); List l = new ArrayList(); l.add("Hello from location 0"); l.add(new Integer(2)); jc.getVars().put("array", l); Expression e = ExpressionFactory.createExpression("array[1]"); Object o = e.evaluate(jc); System.out.println("Object @ location 1 = " + o); e = ExpressionFactory.createExpression("array[0].length()"); o = e.evaluate(jc); System.out.println("The length of the string at location 0 is : " + o); } } commons-jexl-1.1-src/examples/MethodPropertyExample.java100644 0 0 6543 10500374603 20672 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.commons.jexl.JexlHelper; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; /** * Simple example to show how to access method and properties. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: MethodPropertyExample.java 397078 2006-04-26 04:07:54Z dion $ */ public class MethodPropertyExample { /** * Command line entry point. * @param args Command line arguments * @throws Exception on any error. */ public static void main(String[] args) throws Exception { /* * First make a jexlContext and put stuff in it */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo()); jc.getVars().put("number", new Integer(10)); /* * access a method w/o args */ Expression e = ExpressionFactory.createExpression("foo.getFoo()"); Object o = e.evaluate(jc); System.out.println("value returned by the method getFoo() is : " + o); /* * access a method w/ args */ e = ExpressionFactory.createExpression("foo.convert(1)"); o = e.evaluate(jc); System.out.println("value of " + e.getExpression() + " is : " + o); e = ExpressionFactory.createExpression("foo.convert(1+7)"); o = e.evaluate(jc); System.out.println("value of " + e.getExpression() + " is : " + o); e = ExpressionFactory.createExpression("foo.convert(1+number)"); o = e.evaluate(jc); System.out.println("value of " + e.getExpression() + " is : " + o); /* * access a property */ e = ExpressionFactory.createExpression("foo.bar"); o = e.evaluate(jc); System.out.println("value returned for the property 'bar' is : " + o); } /** * Helper example class. */ public static class Foo { /** * Gets foo. * @return a string. */ public String getFoo() { return "This is from getFoo()"; } /** * Gets an arbitrary property. * @param arg property name. * @return arg prefixed with 'This is the property '. */ public String get(String arg) { return "This is the property " + arg; } /** * Gets a string from the argument. * @param i a long. * @return The argument prefixed with 'The value is : ' */ public String convert(long i) { return "The value is : " + i; } } } commons-jexl-1.1-src/LICENSE.txt100644 0 0 26450 10500374603 13552 0ustar 0 0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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. See the License for the specific language governing permissions and limitations under the License. commons-jexl-1.1-src/maven.xml100644 0 0 11225 10500374603 13551 0ustar 0 0 commons-jexl-1.1-src/NOTICE.txt100644 0 0 147 10500374603 13404 0ustar 0 0 This product includes software developed by The Apache Software Foundation (http://www.apache.org/). commons-jexl-1.1-src/project.properties100644 0 0 6301 10500374603 15464 0ustar 0 0 # Copyright 2004-2006 The Apache Software Foundation # # Licensed 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. # See the License for the specific language governing permissions and # limitations under the License. # uncomment the next line to work in offline mode (no jar download & no linkcheck) #maven.mode.online= maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory maven.javadoc.author=false maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api,http://jakarta.apache.org/commons/logging/apidocs # xdocs maven.xdoc.date=left maven.xdoc.poweredby.image=maven-feather.png maven.xdoc.version=${pom.currentVersion} maven.xdoc.developmentProcessUrl=http://jakarta.apache.org/commons/charter.html maven.xdoc.distributionUrl=http://www.apache.org/dist/java-repository/commons-jexl/jars # Compile targets maven.compile.source=1.2 maven.compile.target=1.2 # for changes.xml maven.changes.issue.template=%URL%/browse/%ISSUE% # for compilation maven.compile.debug=on maven.compile.deprecation=on maven.compile.optimize=off # Jar Manifest Additional Attributes maven.jar.manifest.attributes.list=Extension-Name,Specification-Vendor,Specification-Version,Implementation-Vendor,Implementation-Vendor-Id,Implementation-Version,X-Compile-Source-JDK,X-Compile-Target-JDK maven.jar.manifest.attribute.Extension-Name=org.apache.commons.jexl maven.jar.manifest.attribute.Specification-Vendor=Apache Software Foundation maven.jar.manifest.attribute.Specification-Version=1.0 maven.jar.manifest.attribute.Implementation-Vendor=Apache Software Foundation maven.jar.manifest.attribute.Implementation-Vendor-Id=org.apache maven.jar.manifest.attribute.Implementation-Version=1.1-SNAPSHOT maven.jar.manifest.attribute.X-Compile-Source-JDK=${maven.compile.source} maven.jar.manifest.attribute.X-Compile-Target-JDK=${maven.compile.target} # tests maven.junit.fork=true maven.junit.sysproperties=org.xml.sax.driver org.xml.sax.driver=org.apache.xerces.parsers.SAXParser # clover code coverage clover.excludes=**/Test*.java maven.linkcheck.enable=false maven.pmd.rulesetfiles=\ rulesets/basic.xml,\ rulesets/unusedcode.xml,\ rulesets/imports.xml,\ rulesets/codesize.xml,\ rulesets/coupling.xml,\ rulesets/design.xml,\ rulesets/strings.xml maven.checkstyle.properties=${basedir}/src/conf/checkstyle.xml maven.checkstyle.excludes=org/apache/commons/jexl/parser/Parser*.java,\ org/apache/commons/jexl/parser/SimpleCharStream.java,\ org/apache/commons/jexl/parser/Token*.java,\ org/apache/commons/jexl/parser/JJTParserState.java maven.checkstyle.header.file=${basedir}/src/conf/header.txt # Source distro should unpack in a different directory (as against the binary distro) maven.dist.src.assembly.dir=${maven.dist.assembly.dir}/src/${maven.final.name}-src commons-jexl-1.1-src/project.xml100644 0 0 15301 10500374603 14110 0ustar 0 0 3 commons-jexl commons-jexl 2003 1.1 Commons JEXL Commons JEXL Expression Language Engine Jexl is an implementation of the JSTL Expression Language with extensions. /images/jexl-logo-white.png http://jakarta.apache.org/commons/jexl/ org.apache.commons.jexl The Apache Software Foundation http://jakarta.apache.org http://jakarta.apache.org/images/jakarta-logo.gif The Apache Software License, Version 2.0 /LICENSE.txt repo jakarta http://issues.apache.org/jira/ people.apache.org /www/jakarta.apache.org/commons/jexl/ /www/jakarta.apache.org/builds/jakarta-commons/jexl/ scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk scm:svn:https://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk http://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk Commons Dev List commons-dev-subscribe@jakarta.apache.org commons-dev-unsubscribe@jakarta.apache.org http://mail-archives.apache.org/mod_mbox/jakarta-commons-dev/ Commons User List commons-user-subscribe@jakarta.apache.org commons-user-unsubscribe@jakarta.apache.org http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/ 1.0 1.0 COMMONS_JEXL-1_0 dIon Gillard dion dion@apache.org Apache Software Foundation Geir Magnusson Jr. geirm geirm@apache.org independent Tim O'Brien tobrien tobrien@apache.org independent Peter Royal proyal proyal@apache.org Pace Systems Group, Inc. James Strachan jstrachan jstrachan@apache.org SpiritSoft, Inc. Rahul Akolkar rahul rahul AT apache.org Apache Software Foundation commons-logging commons-logging 1.0.3 http://jakarta.apache.org/commons/logging/ <strong>Required</strong> junit junit 3.8.1 http://www.junit.org/ <strong>Test Only</strong> maven maven-xdoc-plugin 1.9.2 http://maven.apache.org/maven-1.x/reference/plugins/xdoc/ plugin <strong>Site Only</strong> - v1.9.2 (minimum) maven-plugins maven-findbugs-plugin 1.1 http://maven-plugins.sourceforge.net/maven-findbugs-plugin/ plugin <strong>Site Only</strong> - v1.1 (minimum) commons-dev@jakarta.apache.org META-INF NOTICE.txt src/java src/test **/*Test.java maven-changes-plugin maven-checkstyle-plugin maven-javadoc-plugin maven-jcoverage-plugin maven-jdepend-plugin maven-junit-report-plugin maven-jxr-plugin maven-license-plugin maven-pmd-plugin maven-tasklist-plugin commons-jexl-1.1-src/RELEASE-NOTES.txt100644 0 0 4071 10500374603 14411 0ustar 0 0 $Id: RELEASE-NOTES.txt 441680 2006-09-08 22:55:31Z rahul $ Commons JEXL Package Version 1.1 Release Notes INTRODUCTION: ============= Jexl is an Expression Language supporting most of the constructs in the JSTL Expression Language, along with some additional extensions. http://jakarta.apache.org/commons/jexl/ Changes in this version include: New Features: ============= o Added Script and ScriptFactory to allow scripts to be executed from text, files or a URL. o Added implementation for bitwise operators: and, complement, or, xor. o Added implementation for the foreach statement. o Added implementation for the while statement. o Added implementation for block statements, e.g. curly braces containing multiple statements. o Added implementation for the if statement. o [JEXL-4] Support assignment to variables. Thanks to Barry Lagerweij. Bugs fixed: =========== o [JEXL-17] Consistently throw ParseException in case of a parsing failure, not an Error. Thanks to Kohsuke Kawaguchi. o [JEXL-3] Allow for static methods to be called on classes and not just objects. Thanks to Guido Anzuoni. o [JEXL-6] Unary minus was only working for integer values. o [JEXL-5] 'abc'.substring(0,1+1) is empty (method matching problem). Other Changes: ============== o Add @since tags to code so we can track API additions via javadoc commons-jexl-1.1-src/src/conf/checkclipse-filter.properties100644 0 0 3421 10500374603 21272 0ustar 0 0 # # Copyright 2001-2004 The Apache Software Foundation. # # Licensed 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. # See the License for the specific language governing permissions and # limitations under the License. # file to specify filters # Files matching one of the given filters are excluded from style checking. # example usage: # - All leading and trailing whitespaces are ignored # - All lines starting with a '#' are comments. # - Regular expressions are Java RegExp-style. See java.util.regex.Pattern. # # Additional notes on Regular expressions: # # 1) Relative pathes (not starting with a '/') get the project location # prepended. Exp: "src/org/test" gets /Project/src/org/test" # 2) Regular Expressions must not use the start-of-line ('^') or the # end-of-line ('$') markers. (They are automatically inserted internally). # 3) Make sure to escape the escape character --> \\ # # The path passed to the filter can be found right-click on a file # -> properties -> Info -> File Path # e.g. /Checklipse/testsrc/testpackage/TestSrc.java # or testsrc/testpackage/TestSrc.java # src/java/org/apache/commons/jexl/parser/JJT.* src/java/org/apache/commons/jexl/parser/Parse.* src/java/org/apache/commons/jexl/parser/SimpleCharStream\.java src/java/org/apache/commons/jexl/parser/Token.* # ignore test code src/test/.* # ignore example code examples/.*\.java commons-jexl-1.1-src/src/conf/checkstyle.properties100644 0 0 1343 10500374603 17671 0ustar 0 0 # # Copyright 2001-2004 The Apache Software Foundation. # # Licensed 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. # See the License for the specific language governing permissions and # limitations under the License. basedir=$SAMEDIR/../.. checkstyle.cache.file=$SAMEDIR/checkstyle.cache checkstyle.header.file=$SAMEDIR/header.txt commons-jexl-1.1-src/src/conf/checkstyle.xml100644 0 0 17462 10500374603 16326 0ustar 0 0 commons-jexl-1.1-src/src/conf/header.txt100644 0 0 1172 10500374603 15406 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */commons-jexl-1.1-src/src/conf/MANIFEST.MF100644 0 0 714 10500374603 15030 0ustar 0 0 Manifest-Version: 1.0 Ant-Version: Apache Ant 1.5.3 Package: org.apache.commons.jexl Extension-Name: commons-jexl Specification-Title: Commons JEXL Expression Language Engine Specification-Vendor: The Apache Software Foundation Implementation-Title: org.apache.commons.jexl Implementation-Vendor: The Apache Software Foundation Implementation-Version: 1.1 Implementation-Vendor-Id: org.apache X-Compile-Source-JDK: 1.2 X-Compile-Target-JDK: 1.2 commons-jexl-1.1-src/src/java/org/apache/commons/jexl/context/HashMapContext.java100644 0 0 2621 10500374603 25253 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.context; import org.apache.commons.jexl.JexlContext; import java.util.HashMap; import java.util.Map; /** * Implementation of JexlContext based on a HashMap. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: HashMapContext.java 397116 2006-04-26 07:01:33Z dion $ */ public class HashMapContext extends HashMap implements JexlContext { /** serialization version id jdk13 generated. */ static final long serialVersionUID = 5715964743204418854L; /** * {@inheritDoc} */ public void setVars(Map vars) { clear(); putAll(vars); } /** * {@inheritDoc} */ public Map getVars() { return this; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/context/package.html100644 0 0 1026 10500374603 24001 0ustar 0 0 Package Documentation for org.apache.commons.jexl.context Package Simple JexlContext implementations.

Introduction

This package only contains one JexlContext implementation, the HashMapContext. A HashMapContext is simply an extension of HashMap which implements the JexlContext interface.

commons-jexl-1.1-src/src/java/org/apache/commons/jexl/Expression.java100644 0 0 4337 10500374603 23046 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; /** *

* Represents a single JEXL expression. This simple interface * provides access to the underlying expression through getExpression(), * and it provides hooks to add a pre- and post- expression resolver. *

* *

* An expression is different than a script - it is simply a reference of * an expression. *

* * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: Expression.java 397092 2006-04-26 05:11:28Z dion $ */ public interface Expression { /** * Evaluates the expression with the variables contained in the * supplied {@link JexlContext}. * * @param context A JexlContext containing variables. * @return The result of this evaluation * @throws Exception on any error */ Object evaluate(JexlContext context) throws Exception; /** * Returns the JEXL expression this Expression was created with. * * @return The JEXL expression to be evaluated */ String getExpression(); /** * Allows addition of a resolver to allow custom interdiction of * expression evaluation. * * @param resolver resolver to be called before Jexl expression evaluated */ void addPreResolver(JexlExprResolver resolver); /** * Allows addition of a resolver to allow custom interdiction of * expression evaluation. * * @param resolver resolver to be called if Jexl expression * evaluated to null. */ void addPostResolver(JexlExprResolver resolver); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/ExpressionFactory.java100644 0 0 13761 10500374603 24417 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.io.StringReader; import org.apache.commons.jexl.parser.ASTExpressionExpression; import org.apache.commons.jexl.parser.ASTForeachStatement; import org.apache.commons.jexl.parser.ASTIfStatement; import org.apache.commons.jexl.parser.ASTReferenceExpression; import org.apache.commons.jexl.parser.ASTStatementExpression; import org.apache.commons.jexl.parser.ASTWhileStatement; import org.apache.commons.jexl.parser.ParseException; import org.apache.commons.jexl.parser.Parser; import org.apache.commons.jexl.parser.SimpleNode; import org.apache.commons.jexl.parser.TokenMgrError; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** *

* Creates Expression objects. To create a JEXL Expression object, pass * valid JEXL syntax to the static createExpression() method: *

* *
 * String jexl = "array[1]";
 * Expression expression = ExpressionFactory.createExpression( jexl );
 * 
* *

* When an {@link Expression} object is created, the JEXL syntax is * parsed and verified. If the supplied expression is neither an * expression nor a reference, an exception is thrown from createException(). *

* @since 1.0 * @author Geir Magnusson Jr. * @version $Id: ExpressionFactory.java 429169 2006-08-06 18:36:29Z rahul $ */ public class ExpressionFactory { /** * The Log to which all ExpressionFactory messages will be logged. */ protected static Log log = LogFactory.getLog("org.apache.commons.jexl.ExpressionFactory"); /** * The singleton ExpressionFactory also holds a single instance of * {@link Parser}. * When parsing expressions, ExpressionFactory synchronizes on Parser. */ protected static Parser parser = new Parser(new StringReader(";")); //$NON-NLS-1$ /** * ExpressionFactory is a singleton and this is the private * instance fufilling that pattern. */ protected static ExpressionFactory ef = new ExpressionFactory(); /** * Private constructor, the single instance is always obtained * with a call to getInstance(). */ private ExpressionFactory() { } /** * Returns the single instance of ExpressionFactory. * @return the instance of ExpressionFactory. */ protected static ExpressionFactory getInstance() { return ef; } /** * Creates an Expression from a String containing valid * JEXL syntax. This method parses the expression which * must contain either a reference or an expression. * @param expression A String containing valid JEXL syntax * @return An Expression object which can be evaluated with a JexlContext * @throws Exception An exception can be thrown if there is a problem * parsing this expression, or if the expression is neither an * expression or a reference. */ public static Expression createExpression(String expression) throws Exception { return getInstance().createNewExpression(expression); } /** * Creates a new Expression based on the expression string. * * @param expression valid Jexl expression * @return Expression * @throws Exception for a variety of reasons - mostly malformed * Jexl expression */ protected Expression createNewExpression(final String expression) throws Exception { String expr = cleanExpression(expression); // Parse the Expression SimpleNode tree; synchronized (parser) { log.debug("Parsing expression: " + expr); try { tree = parser.parse(new StringReader(expr)); } catch (TokenMgrError tme) { throw new ParseException(tme.getMessage()); } } if (tree.jjtGetNumChildren() > 1 && log.isWarnEnabled()) { log.warn("The JEXL Expression created will be a reference" + " to the first expression from the supplied script: \"" + expression + "\" "); } // Must be a simple reference, expression, statement or if, otherwise // throw an exception. SimpleNode node = (SimpleNode) tree.jjtGetChild(0); // TODO: Can we get rid of these checks? if (node instanceof ASTReferenceExpression || node instanceof ASTExpressionExpression || node instanceof ASTStatementExpression || node instanceof ASTIfStatement || node instanceof ASTWhileStatement || node instanceof ASTForeachStatement ) { return new ExpressionImpl(expression, node); } log.error("Invalid Expression, node of type: " + node.getClass().getName()); throw new Exception("Invalid Expression: not a Reference, Expression, " + "Statement or If"); } /** * Trims the expression and adds a semi-colon if missing. * @param expression to clean * @return trimmed expression ending in a semi-colon */ private String cleanExpression(String expression) { String expr = expression.trim(); if (!expr.endsWith(";")) { expr += ";"; } return expr; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/ExpressionImpl.java100644 0 0 10464 10500374603 23706 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.util.ArrayList; import java.util.List; import org.apache.commons.jexl.parser.SimpleNode; /** * Instances of ExpressionImpl are created by the {@link ExpressionFactory}, * and this is the default implementation of the {@link Expression} interface. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: ExpressionImpl.java 397111 2006-04-26 06:47:52Z dion $ */ class ExpressionImpl implements Expression { /** resolvers called before expression evaluation. */ protected List preResolvers; /** resolvers called after expression evaluation. */ protected List postResolvers; /** * Original expression. This is just a 'snippet', not a valid statement * (i.e. foo.bar() vs foo.bar(); */ protected String expression; /** * The resulting AST we can call value() on. */ protected SimpleNode node; /** * do not let this be generally instantiated with a 'new'. * * @param expr the expression. * @param ref the parsed expression. */ ExpressionImpl(String expr, SimpleNode ref) { expression = expr; node = ref; } /** * {@inheritDoc} */ public Object evaluate(JexlContext context) throws Exception { Object val = null; /* * if we have pre resolvers, give them a wack */ if (preResolvers != null) { val = tryResolver(preResolvers, context); if (val != JexlExprResolver.NO_VALUE) { return val; } } val = node.value(context); /* * if null, call post resolvers */ if (val == null && postResolvers != null) { val = tryResolver(postResolvers, context); if (val != JexlExprResolver.NO_VALUE) { return val; } } return val; } /** * Tries the resolvers in the given resolverlist against the context. * * @param resolverList list of JexlExprResolvers * @param context JexlContext to use for evauluation * @return value (including null) or JexlExprResolver.NO_VALUE */ protected Object tryResolver(List resolverList, JexlContext context) { Object val = JexlExprResolver.NO_VALUE; String expr = getExpression(); for (int i = 0; i < resolverList.size(); i++) { JexlExprResolver jer = (JexlExprResolver) resolverList.get(i); val = jer.evaluate(context, expr); /* * as long as it's not NO_VALUE, return it */ if (val != JexlExprResolver.NO_VALUE) { return val; } } return val; } /** * {@inheritDoc} */ public String getExpression() { return expression; } /** * {@inheritDoc} */ public void addPreResolver(JexlExprResolver resolver) { if (preResolvers == null) { preResolvers = new ArrayList(); } preResolvers.add(resolver); } /** * {@inheritDoc} */ public void addPostResolver(JexlExprResolver resolver) { if (postResolvers == null) { postResolvers = new ArrayList(); } postResolvers.add(resolver); } /** * Provide a string representation of the expression. * * @return the expression or blank if it's null. */ public String toString() { String expr = getExpression(); return expr == null ? "" : expr; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/JexlContext.java100644 0 0 3237 10500374603 23154 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.util.Map; /** * Holds a Map of variables which are referenced in a JEXL expression. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlContext.java 397092 2006-04-26 05:11:28Z dion $ */ public interface JexlContext { /** * Replaces variables in a JexlContext with the variables contained * in the supplied Map. When setVars() is called on a JexlContext, * it clears the current Map and puts each entry of the * supplied Map into the current variable Map. * * @param vars Contents of vars will be replaced with the content * of this Map */ void setVars(Map vars); /** * Retrives the Map of variables associated with this JexlContext. The * keys of this map correspond to variable names referenced in a * JEXL expression. * * @return A reference to the variable Map associated with this JexlContext. */ Map getVars(); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/JexlExprResolver.java100644 0 0 3101 10500374603 24156 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; /** * A Resolver allows custom resolution of the expression, and can be * added in front of the jexl engine, or after in the evaluation. * * @todo This needs to be explained in detail. Why do this? * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlExprResolver.java 397092 2006-04-26 05:11:28Z dion $ */ public interface JexlExprResolver { /** represents an expression result of no value. */ Object NO_VALUE = new Object(); /** * Evaluates an expression against the context. * * @todo Must detail the expectations and effects of this resolver. * @param context current data context * @param expression expression to evauluate * @return value (may be null) or the NO_VALUE object to * indicate no resolution. */ Object evaluate(JexlContext context, String expression); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/JexlHelper.java100644 0 0 3544 10500374603 22750 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import org.apache.commons.jexl.context.HashMapContext; /** * Helper to create a context. In the current implementation of JEXL, there * is one implementation of JexlContext - {@link HashMapContext}, and there * is no reason not to directly instantiate {@link HashMapContext} in your * own application. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlHelper.java 397092 2006-04-26 05:11:28Z dion $ */ public class JexlHelper { /** singleton instance. */ protected static JexlHelper helper = new JexlHelper(); /** @return the single instance. */ protected static JexlHelper getInstance() { return helper; } /** * Returns a new {@link JexlContext}. * @return a new JexlContext */ public static JexlContext createContext() { return getInstance().newContext(); } /** * Creates and returns a new {@link JexlContext}. * The current implementation creates a new instance of * {@link HashMapContext}. * @return a new JexlContext */ protected JexlContext newContext() { return new HashMapContext(); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/junit/Asserter.java100644 0 0 5474 10500374603 23633 0ustar 0 0 /* * Copyright 2003-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.junit; import java.util.HashMap; import java.util.Map; import junit.framework.Assert; import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; /** * A utility class for performing JUnit based assertions using Jexl * expressions. This class can make it easier to do unit tests using * Jexl navigation expressions. * * @since 1.0 * @author James Strachan * @version $Revision: 398153 $ */ public class Asserter extends Assert { /** variables used during asserts. */ private final Map variables = new HashMap(); /** context to use during asserts. */ private final JexlContext context = JexlHelper.createContext(); /** * * Create an asserter. */ public Asserter() { } /** * This constructor will register the given variableValue as the * "this" variable. * * @param variableValue 'this'. */ public Asserter(Object variableValue) { setVariable("this", variableValue); } /** * Performs an assertion that the value of the given Jexl expression * evaluates to the given expected value. * * @param expression is the Jexl expression to evaluate * @param expected is the expected value of the expression * @throws Exception if the expression could not be evaluationed or an assertion * fails */ public void assertExpression(String expression, Object expected) throws Exception { Expression exp = ExpressionFactory.createExpression(expression); context.setVars(variables); Object value = exp.evaluate(context); assertEquals("expression: " + expression, expected, value); } /** * Puts a variable of a certain name in the context so that it can be used from * assertion expressions. * * @param name variable name * @param value variable value */ public void setVariable(String name, Object value) { variables.put(name, value); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/junit/package.html100644 0 0 2276 10500374603 23456 0ustar 0 0 Package Documentation for org.apache.commons.jexl.junit Package Using JEXL expressions in JUnit assertions.

Introduction

This package only contains one class, Asserter, which allows you to use a JEXL expression in a JUnit assertion. The following example demonstrates the use of the Asserter class. An instance is created, and the internal JexlContext is populated via calls to setVariable(). Calls to assertExpression() succeed if the expression evaluates to the value of the second parameter, otherwise an AssertionFailedException is thrown.

   Asserter asserter = new Asserter();
   asserter.setVariable("foo", new Foo());
   asserter.setVariable("person", "James");

   asserter.assertExpression("person", "James");
   asserter.assertExpression("size(person)", new Integer(5));
        
   asserter.assertExpression("foo.getCount()", new Integer(5));
   asserter.assertExpression("foo.count", new Integer(5));
  
commons-jexl-1.1-src/src/java/org/apache/commons/jexl/package.html100644 0 0 5452 10500374603 22324 0ustar 0 0 Package Documentation for org.apache.commons.jexl Package Provides a framework for evaluating JEXL expressions.

Introduction

Java Expression Language (JEXL) is an expression language engine which can be embedded in applications and frameworks. JEXL is inspired by Jakarta Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and JavaServer Pages version 2.0 (JSP).

JEXL attempts to bring some of the lessons learned by the Velocity community about expression languages in templating to a wider audience. Commons Jelly needed Velocity-ish method access, it just had to have it.

It must be noted that JEXL is not a compatibile implementation of EL as defined in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of these specifications, see the Commons EL project.

A Brief Example

When evaluating expressions, JEXL merges an Expression with a JexlContext. An Expression is created using ExpressionFactory.createExpression(), passing a String containing valid JEXL syntax. A JexlContext is created using JexlHelper.createContext(), and variables are put into a map exposed through the getVars() method on JexlContext. The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo:

    // Create an expression object
    String jexlExp = "foo.innerFoo.bar()";
    Expression e = ExpressionFactory.createExpression( jexlExp );

    // Create a context and add data
    JexlContext jc = JexlHelper.createContext();
    jc.getVars().put("foo", new Foo() );

    // Now evaluate the expression, getting the result
    Object o = e.evaluate(jc);
commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTAddNode.java100644 0 0 7276 10500374603 24056 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Addition : either integer addition or string concatenation. * * @author Geir Magnusson Jr. * @version $Id: ASTAddNode.java 398180 2006-04-29 15:40:35Z dion $ */ public class ASTAddNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTAddNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTAddNode(Parser p, int id) { super(p, id); } /** * {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); /* * the spec says 'and' */ if (left == null && right == null) { return new Long(0); } /* * if anything is float, double or string with ( "." | "E" | "e") * coerce all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1) ) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1) ) ) { /* * in the event that either is null and not both, then just make the * null a 0 */ try { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return new Double(l.doubleValue() + r.doubleValue()); } catch (java.lang.NumberFormatException nfe) { /* * Well, use strings! */ return left.toString().concat(right.toString()); } } /* * attempt to use Longs */ try { Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); return new Long(l.longValue() + r.longValue()); } catch (java.lang.NumberFormatException nfe) { /* * Well, use strings! */ return left.toString().concat(right.toString()); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTAndNode.java100644 0 0 3651 10500374603 24061 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * && and 'and'. * * @author Geir Magnusson Jr. * @version $Id: ASTAndNode.java 398180 2006-04-29 15:40:35Z dion $ */ public class ASTAndNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTAndNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTAndNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); boolean leftValue = Coercion.coerceBoolean(left).booleanValue(); /* * coercion rules */ return (leftValue && Coercion.coerceBoolean( ((SimpleNode) jjtGetChild(1)).value(jc)).booleanValue()) ? Boolean.TRUE : Boolean.FALSE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.java100644 0 0 13374 10500374603 24774 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.util.Introspector; import org.apache.commons.jexl.util.introspection.Info; import org.apache.commons.jexl.util.introspection.VelPropertyGet; import java.util.List; import java.util.Map; import java.lang.reflect.Array; /** * Like an ASTIdentifier, but with array access allowed. * * $foo[2] * * @author Geir Magnusson Jr. * @version $Id: ASTArrayAccess.java 398180 2006-04-29 15:40:35Z dion $ */ public class ASTArrayAccess extends SimpleNode { /** dummy velocity info. */ private static final Info DUMMY = new Info("", 1, 1); /** * Create the node given an id. * * @param id node id. */ public ASTArrayAccess(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTArrayAccess(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * evaluate array access upon a base object. * * foo.bar[2] * * makes me rethink the array operator :) * @param jc the {@link JexlContext} to evaluate against. * @param obj not used. * @return the value of the array expression. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { ASTIdentifier base = (ASTIdentifier) jjtGetChild(0); Object result = base.execute(obj, jc); /* * ignore the first child - it's our identifier */ for (int i = 1; i < jjtGetNumChildren(); i++) { Object loc = ((SimpleNode) jjtGetChild(i)).value(jc); if (loc == null) { return null; } result = evaluateExpr(result, loc); } return result; } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * get the base ASTIdentifier */ ASTIdentifier base = (ASTIdentifier) jjtGetChild(0); Object o = base.value(jc); /* * ignore the first child - it's our identifier */ for (int i = 1; i < jjtGetNumChildren(); i++) { Object loc = ((SimpleNode) jjtGetChild(i)).value(jc); if (loc == null) { return null; } o = evaluateExpr(o, loc); } return o; } /** * Evaluate the Array expression 'loc' on the given object, o. * e.g. in 'a[2]', 2 is 'loc' and a is 'o'. * * If o or loc are null, null is returned. * If o is a Map, o.get(loc) is returned. * If o is a List, o.get(loc) is returned. loc must resolve to an int value. * If o is an Array, o[loc] is returned. loc must resolve to an int value. * Otherwise loc is treated as a bean property of o. * * @param o an object to be accessed using the array operator or '.' operator. * @param loc the index of the object to be returned. * @return the resulting value. * @throws Exception on any error. */ public static Object evaluateExpr(Object o, Object loc) throws Exception { /* * following the JSTL EL rules */ if (o == null) { return null; } if (loc == null) { return null; } if (o instanceof Map) { if (!((Map) o).containsKey(loc)) { return null; } return ((Map) o).get(loc); } else if (o instanceof List) { int idx = Coercion.coerceInteger(loc).intValue(); try { return ((List) o).get(idx); } catch (IndexOutOfBoundsException iobe) { return null; } } else if (o.getClass().isArray()) { int idx = Coercion.coerceInteger(loc).intValue(); try { return Array.get(o, idx); } catch (ArrayIndexOutOfBoundsException aiobe) { return null; } } else { /* * "Otherwise (a JavaBean object)..." huh? :) */ String s = loc.toString(); VelPropertyGet vg = Introspector.getUberspect().getPropertyGet(o, s, DUMMY); if (vg != null) { return vg.invoke(o); } } throw new Exception("Unsupported object type for array [] accessor"); } /** * Gets the variable name piece of the expression. * @return a String of the identifer. * @see ASTIdentifier#getIdentifierString(). */ public String getIdentifierString() { return ((ASTIdentifier) jjtGetChild(0)).getIdentifierString(); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTAssignment.java100644 0 0 4170 10500374603 24656 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * x = y, assigns a value to a variable in the context. * * @author Dion Gillard * */ public class ASTAssignment extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTAssignment(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTAssignment(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { // left should be the variable (reference) to assign to SimpleNode left = (SimpleNode) jjtGetChild(0); // right should be the expression to evaluate Object right = ((SimpleNode) jjtGetChild(1)).value(context); if (left instanceof ASTReference) { ASTReference reference = (ASTReference) left; left = (SimpleNode) reference.jjtGetChild(0); if (left instanceof ASTIdentifier) { String identifier = ((ASTIdentifier) left) .getIdentifierString(); context.getVars().put(identifier, right); } } return right; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTBitwiseAndNode.java100644 0 0 3564 10500374603 25413 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise And. Syntax: a & b Result is a {@link Long} * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseAndNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseAndNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseAndNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); Long r = right == null ? new Long(0) : Coercion.coerceLong(right); return new Long(l.longValue() & r.longValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTBitwiseComplNode.java100644 0 0 3327 10500374603 25760 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise Complement. Syntax: ~a Result is a Long * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseComplNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseComplNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseComplNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); return new Long(~l.longValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTBitwiseOrNode.java100644 0 0 3552 10500374603 25266 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise Or. Syntax: a | b Result is a Long * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseOrNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseOrNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseOrNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); Long r = right == null ? new Long(0) : Coercion.coerceLong(right); return new Long(l.longValue() | r.longValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTBitwiseXorNode.java100644 0 0 3611 10500374603 25452 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise Or. Syntax: a ^ b Result is a Long * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseXorNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseXorNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseXorNode(Parser p, int id) { super(p, id); } /** * {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); Long r = right == null ? new Long(0) : Coercion.coerceLong(right); return new Long(l.longValue() ^ r.longValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTBlock.java100644 0 0 3616 10500374603 23604 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * { code }, a block of statements enclosed in curly braces. * * @author Dion Gillard * */ public class ASTBlock extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBlock(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBlock(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * @return the value of the block. Execute all statements inside and return * the value of the last. * @param context the {@link JexlContext} to execute against. * @throws Exception on any error. */ public Object value(JexlContext context) throws Exception { int numChildren = jjtGetNumChildren(); Object result = null; for (int i = 0; i < numChildren; i++) { result = ((SimpleNode) jjtGetChild(i)).value(context); } return result; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTDivNode.java100644 0 0 4243 10500374603 24077 0ustar 0 0 /* * Copyright 2003-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.JexlContext; /** * a / b, mathematical divide. * * @author Geir Magnusson Jr. * @version $Id: ASTDivNode.java 398187 2006-04-29 15:58:45Z dion $ */ public class ASTDivNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTDivNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTDivNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); /* * catch div/0 */ if (r.doubleValue() == 0.0) { return new Double(0.0); } return new Double(l.doubleValue() / r.doubleValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTEmptyFunction.java100644 0 0 4662 10500374603 25360 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import java.util.Collection; import java.util.Map; /** * function to see if reference doesn't exist in context. * * @author Geir Magnusson Jr. * @author Tim O'Brien * @version $Id: ASTEmptyFunction.java 398190 2006-04-29 16:04:10Z dion $ */ public class ASTEmptyFunction extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTEmptyFunction(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTEmptyFunction(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { SimpleNode sn = (SimpleNode) jjtGetChild(0); /* * I can't believe this */ Object o = sn.value(jc); if (o == null) { return Boolean.TRUE; } if (o instanceof String && "".equals(o)) { return Boolean.TRUE; } if (o.getClass().isArray() && ((Object[]) o).length == 0) { return Boolean.TRUE; } if (o instanceof Collection && ((Collection) o).isEmpty()) { return Boolean.TRUE; } /* * Map isn't a collection */ if (o instanceof Map && ((Map) o).isEmpty()) { return Boolean.TRUE; } return Boolean.FALSE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTEQNode.java100644 0 0 7704 10500374603 23667 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Represents equality between values. * * If the values are of the same class, .equals() is used. * * If either value is a {@link Float} or {@link Double} (but both are not the same class), * the values are coerced to {@link Double}s before comparing. * * If either value is a {@link Number} or {@link Character} (but both are not the same class), * the values are coerced to {@link Long}s before comparing. * * If either value is a {@link Boolean} (but both are not the same class), * the values are coerced to {@link Boolean}s before comparing. * * If either value is a {@link String} (but both are not the same class), * toString() is called on both before comparing. * * Otherwise left.equals(right) is returned. * * @author Geir Magnusson Jr. * @version $Id: ASTEQNode.java 398190 2006-04-29 16:04:10Z dion $ */ public class ASTEQNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTEQNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTEQNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext pc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(pc); Object right = ((SimpleNode) jjtGetChild(1)).value(pc); if (left == null && right == null) { /* * if both are null L == R */ return Boolean.TRUE; } else if (left == null || right == null) { /* * we know both aren't null, therefore L != R */ return Boolean.FALSE; } else if (left.getClass().equals(right.getClass())) { return left.equals(right) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return l.equals(r) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Number || right instanceof Number || left instanceof Character || right instanceof Character) { return Coercion.coerceLong(left).equals(Coercion.coerceLong(right)) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Boolean || right instanceof Boolean) { return Coercion.coerceBoolean(left).equals( Coercion.coerceBoolean(right)) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof java.lang.String || right instanceof String) { return left.toString().equals(right.toString()) ? Boolean.TRUE : Boolean.FALSE; } return left.equals(right) ? Boolean.TRUE : Boolean.FALSE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTExpression.java100644 0 0 3145 10500374603 24706 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * AST node for expression. * * @author Geir Magnusson Jr. * @version $Id: ASTExpression.java 398190 2006-04-29 16:04:10Z dion $ */ public class ASTExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTExpressionExpression.java100644 0 0 3270 10500374603 26765 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents equality between integers - use .equals() for strings. * * @author Geir Magnusson Jr. * @version $Id: ASTExpressionExpression.java 398190 2006-04-29 16:04:10Z dion $ */ public class ASTExpressionExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTExpressionExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTExpressionExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java100644 0 0 3076 10500374603 24412 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents Boolean false. * * @author Geir Magnusson Jr. * @version $Id: ASTFalseNode.java 398194 2006-04-29 16:14:58Z dion $ */ public class ASTFalseNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTFalseNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTFalseNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return Boolean.FALSE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.java100644 0 0 3211 10500374603 25123 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents a float point number. * * @author Geir Magnusson Jr. * @version $Id: ASTFloatLiteral.java 398194 2006-04-29 16:14:58Z dion $ */ public class ASTFloatLiteral extends SimpleNode { /** the value of the literal. */ protected Float val; /** * Create the node given an id. * * @param id node id. */ public ASTFloatLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTFloatLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return val; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java100644 0 0 6234 10500374603 26005 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import java.util.Iterator; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Introspector; import org.apache.commons.jexl.util.introspection.Info; /** * ForEach statement. Syntax: foreach (var in iterable) Statement() * * @author Dion Gillard * @since 1.1 */ public class ASTForeachStatement extends SimpleNode { /** dummy velocity info. */ private static final Info DUMMY = new Info("", 1, 1); /** index of the loop variable. */ private static final int VAR_INDEX = 0; /** index of the items. */ private static final int ITEMS_INDEX = 1; /** index of the code to execute. */ private static final int STATEMENT_INDEX = 2; /** * Create the node given an id. * * @param id node id. */ public ASTForeachStatement(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTForeachStatement(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object result = null; /* first child is the loop variable */ ASTReference loopVariable = (ASTReference) jjtGetChild(VAR_INDEX); /* second child is the variable to iterate */ SimpleNode iterable = (SimpleNode) jjtGetChild(ITEMS_INDEX); Object iterableValue = iterable.value(jc); // make sure there is a value to iterate on and a statement to execute if (iterableValue != null && jjtGetNumChildren() >= (STATEMENT_INDEX + 1)) { /* third child is the statement to execute */ SimpleNode statement = (SimpleNode) jjtGetChild(2); // get an iterator for the collection/array etc via the // introspector. Iterator itemsIterator = Introspector.getUberspect().getIterator( iterableValue, DUMMY); while (itemsIterator.hasNext()) { // set loopVariable to value of iterator Object value = itemsIterator.next(); jc.getVars().put(loopVariable.getRootString(), value); // execute statement result = statement.value(jc); } } return result; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTGENode.java100644 0 0 6464 10500374603 23657 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * GE : a >= b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTGENode.java 398197 2006-04-29 16:18:04Z dion $ */ public class ASTGENode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTGENode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTGENode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if (left == right) { return Boolean.TRUE; } else if ((left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble >= rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong >= rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) >= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) >= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) <= 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : GE "); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTGTNode.java100644 0 0 6370 10500374603 23672 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * GT : a > b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTGTNode.java 398197 2006-04-29 16:18:04Z dion $ */ public class ASTGTNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTGTNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTGTNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if ((left == right) || (left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble > rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong > rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) > 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) > 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) < 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : GT "); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java100644 0 0 5010 10500374603 24622 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Simple identifier - $foo or $foo.bar (both parts are identifiers). * * @author Geir Magnusson Jr. * @version $Id: ASTIdentifier.java 398199 2006-04-29 16:30:05Z dion $ */ public class ASTIdentifier extends SimpleNode { /** the name of the variable. */ protected String val; /** * Create the node given an id. * * @param id node id. */ public ASTIdentifier(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTIdentifier(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return jc.getVars().get(val); } /** * returns the value of itself applied to the object. We assume that an * identifier can be gotten via a get(String). * e.g. if we have bean.property, 'property' has been parsed as an identifier, * and we need to resolve the expression by calling the property getter. * * @param obj the object to evaluate against. * @param jc the {@link JexlContext}. * @throws Exception on any error. * @return the resulting value. * @see ASTArrayAccess#evaluateExpr(Object, Object) */ public Object execute(Object obj, JexlContext jc) throws Exception { return ASTArrayAccess.evaluateExpr(obj, val); } /** * Gets the name of the variable. * @return the variable name. */ public String getIdentifierString() { return val; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java100644 0 0 4247 10500374603 24776 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * if ( expression ) statement [else statement]. * * @author Dion Gillard * @since 1.1 */ public class ASTIfStatement extends SimpleNode { /** child index of the else statement to execute. */ private static final int ELSE_STATEMENT_INDEX = 2; /** * Create the node given an id. * * @param id node id. */ public ASTIfStatement(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTIfStatement(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object result = null; /* first child is the expression */ Object expression = ((SimpleNode) jjtGetChild(0)).value(jc); if (Coercion.coerceBoolean(expression).booleanValue()) { // true statement result = ((SimpleNode) jjtGetChild(1)).value(jc); } else { // if there is a false, execute it if (jjtGetNumChildren() == ELSE_STATEMENT_INDEX + 1) { result = ((SimpleNode) jjtGetChild(2)).value(jc); } } return result; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTIntegerLiteral.java100644 0 0 4203 10500374603 25455 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents an integer. * * @author Geir Magnusson Jr. * @version $Id: ASTIntegerLiteral.java 398202 2006-04-29 16:40:34Z dion $ */ public class ASTIntegerLiteral extends SimpleNode { /** literal value. */ protected Integer val; /** * Create the node given an id. * * @param id node id. */ public ASTIntegerLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTIntegerLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * Part of reference resolution - wierd... in JSTL EL you can have foo.2 * which is equiv to foo[2] it appears... * * @param obj the object to evaluate against. * @param ctx the {@link JexlContext}. * @throws Exception on any error. * @return the resulting value. * @see ASTArrayAccess#evaluateExpr(Object, Object) */ public Object execute(Object obj, JexlContext ctx) throws Exception { return ASTArrayAccess.evaluateExpr(obj, val); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return val; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTJexlScript.java100644 0 0 3275 10500374603 24642 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Top of the syntax tree - parsed Jexl code. * * @since 1.1 */ public class ASTJexlScript extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTJexlScript(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTJexlScript(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { int numChildren = jjtGetNumChildren(); Object result = null; for (int i = 0; i < numChildren; i++) { SimpleNode child = (SimpleNode) jjtGetChild(i); result = child.value(jc); } return result; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTLENode.java100644 0 0 6464 10500374603 23664 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * LE : a <= b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTLENode.java 398203 2006-04-29 16:44:55Z dion $ */ public class ASTLENode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTLENode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTLENode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if (left == right) { return Boolean.TRUE; } else if ((left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble <= rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong <= rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) <= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) <= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) >= 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : LE "); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTLTNode.java100644 0 0 6372 10500374603 23701 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * LT : a < b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTLTNode.java 398203 2006-04-29 16:44:55Z dion $ */ public class ASTLTNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTLTNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTLTNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if ((left == right) || (left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble < rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong < rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) < 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) < 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) > 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : LT "); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTMethod.java100644 0 0 12136 10500374603 24007 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; import java.math.BigInteger; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Introspector; import org.apache.commons.jexl.util.introspection.VelMethod; import org.apache.commons.jexl.util.introspection.Info; /** * Method execution. */ public class ASTMethod extends SimpleNode { /** dummy velocity info. */ private static final Info DUMMY = new Info("", 1, 1); /** * Create the node given an id. * * @param id node id. */ public ASTMethod(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTMethod(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * evaluate a method invocation upon a base object. * * foo.bar(2) * * @param jc the {@link JexlContext} to evaluate against. * @param obj The object to have the method invoked. * @return the value of the method invocation. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { String methodName = ((ASTIdentifier) jjtGetChild(0)).val; int paramCount = jjtGetNumChildren() - 1; /* * get our params */ Object[] params = new Object[paramCount]; try { for (int i = 0; i < paramCount; i++) { params[i] = ((SimpleNode) jjtGetChild(i + 1)).value(jc); } VelMethod vm = Introspector.getUberspect().getMethod(obj, methodName, params, DUMMY); /* * DG: If we can't find an exact match, narrow the parameters and * try again! */ if (vm == null) { // replace all numbers with the smallest type that will fit for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param instanceof Number) { params[i] = narrow((Number) param); } } vm = Introspector.getUberspect().getMethod(obj, methodName, params, DUMMY); if (vm == null) { return null; } } return vm.invoke(obj, params); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof Exception) { throw (Exception) t; } throw e; } } /** * Given a Number, return back the value using the smallest type the result * will fit into. This works hand in hand with parameter 'widening' in java * method calls, e.g. a call to substring(int,int) with an int and a long * will fail, but a call to substring(int,int) with an int and a short will * succeed. * * @param original the original number. * @return a value of the smallest type the original number will fit into. * @since 1.1 */ private Number narrow(Number original) { if (original == null || original instanceof BigDecimal || original instanceof BigInteger) { return original; } Number result = original; if (original instanceof Double || original instanceof Float) { double value = original.doubleValue(); if (value <= Float.MAX_VALUE && value >= Float.MIN_VALUE) { result = new Float(result.floatValue()); } // else it was already a double } else { long value = original.longValue(); if (value <= Byte.MAX_VALUE && value >= Byte.MIN_VALUE) { // it will fit in a byte result = new Byte((byte) value); } else if (value <= Short.MAX_VALUE && value >= Short.MIN_VALUE) { result = new Short((short) value); } else if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) { result = new Integer((int) value); } // else it was already a long } return result; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTModNode.java100644 0 0 6412 10500374603 24074 0ustar 0 0 /* * Copyright 2003-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * % (mod). * * @author Geir Magnusson Jr. * @version $Id: ASTModNode.java 398206 2006-04-29 16:51:38Z dion $ */ public class ASTModNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTModNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTModNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } /* * if anything is float, double or string with ( "." | "E" | "e") coerce * all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1)) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1))) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); /* * catch div/0 */ if (r.doubleValue() == 0.0) { return new Double(0.0); } return new Double(l.doubleValue() % r.doubleValue()); } /* * otherwise to longs with thee! */ Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); /* * catch the div/0 */ if (r.longValue() == 0) { return new Long(0); } return new Long(l.longValue() % r.longValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTMulNode.java100644 0 0 5770 10500374603 24120 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Multiplication. * * @author Geir Magnusson Jr. * @version $Id: ASTMulNode.java 398206 2006-04-29 16:51:38Z dion $ */ public class ASTMulNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTMulNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTMulNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } /* * if anything is float, double or string with ( "." | "E" | "e") coerce * all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1)) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1))) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return new Double(l.doubleValue() * r.doubleValue()); } /* * otherwise to longs with thee! */ Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); return new Long(l.longValue() * r.longValue()); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTNENode.java100644 0 0 6257 10500374603 23666 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Not equal to. Use '!=' or 'ne', do not use <>. * * @author Geir Magnusson Jr. * @version $Id: ASTNENode.java 398270 2006-04-30 03:02:58Z dion $ */ public class ASTNENode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTNENode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTNENode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext pc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(pc); Object right = ((SimpleNode) jjtGetChild(1)).value(pc); if (left == null && right == null) { /* * first, the possibility that both *are* null */ return Boolean.FALSE; } else if (left == null || right == null) { /* * otherwise, both aren't, so it's clear L != R */ return Boolean.TRUE; } else if (left.getClass().equals(right.getClass())) { return (left.equals(right)) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double) { return (Coercion.coerceDouble(left).equals(Coercion.coerceDouble(right))) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof Number || right instanceof Number || left instanceof Character || right instanceof Character) { return (Coercion.coerceLong(left).equals(Coercion.coerceLong(right))) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof Boolean || right instanceof Boolean) { return (Coercion.coerceBoolean(left).equals(Coercion.coerceBoolean(right))) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof java.lang.String || right instanceof String) { return (left.toString().equals(right.toString())) ? Boolean.FALSE : Boolean.TRUE; } return (left.equals(right)) ? Boolean.FALSE : Boolean.TRUE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTNotNode.java100644 0 0 3630 10500374603 24114 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Not : 'not' or '!'. * * @author Geir Magnusson Jr. * @version $Id: ASTNotNode.java 398270 2006-04-30 03:02:58Z dion $ */ public class ASTNotNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTNotNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTNotNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object val = ((SimpleNode) jjtGetChild(0)).value(jc); /* * coercion rules */ Boolean b = Coercion.coerceBoolean(val); if (b != null) { return b.booleanValue() ? Boolean.FALSE : Boolean.TRUE; } throw new Exception("expression not boolean valued"); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTNullLiteral.java100644 0 0 2726 10500374603 25002 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * 'null'. * * @author Geir Magnusson Jr. */ public class ASTNullLiteral extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTNullLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTNullLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) { return null; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTOrNode.java100644 0 0 3634 10500374603 23740 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.JexlContext; /** * || and 'or'. * * @author Geir Magnusson Jr. * @version $Id: ASTOrNode.java 398272 2006-04-30 03:14:01Z dion $ */ public class ASTOrNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTOrNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTOrNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); boolean leftValue = Coercion.coerceBoolean(left).booleanValue(); /* * coercion rules */ return (leftValue || Coercion.coerceBoolean(((SimpleNode) jjtGetChild(1)).value(jc)).booleanValue()) ? Boolean.TRUE : Boolean.FALSE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTReference.java100644 0 0 10414 10500374603 24462 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * reference - any variable expression. * * @author Geir Magnusson Jr. * @version $Id: ASTReference.java 398272 2006-04-30 03:14:01Z dion $ */ public class ASTReference extends SimpleNode { /** first variable in the expression. */ protected SimpleNode root; /** * Create the node given an id. * * @param id node id. */ public ASTReference(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTReference(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return execute(null, jc); } /** Store the first child as {@link ASTReference#root root}. */ public void jjtClose() { root = (SimpleNode) jjtGetChild(0); } /** * evaluate each piece of the reference. * * e.g. foo.bar.woogie[2].name, foo is our 'root', and we need to * evaluate 'bar.woogie[2].name' relative to foo. * * @param jc the {@link JexlContext} to evaluate against. * @param obj not used. root.value(jc) is used instead. * @return the value of the array expression. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { Object o = root.value(jc); /* * ignore the first child - it's our identifier */ for (int i = 1; i < jjtGetNumChildren(); i++) { o = ((SimpleNode) jjtGetChild(i)).execute(o, jc); // check for a variable in the context named // child0.child1.child2 etc if (o == null) { String varName = getIdentifierToDepth(i); o = jc.getVars().get(varName); } } return o; } /** * This method returns a variable from this identifier and it's children. * For an expression like 'a.b.c', a is child zero, b is child 1 and c is * child 2. * * @param i the depth of the child nodes to go to * @return the a dotted variable from this identifier and it's child nodes. */ private String getIdentifierToDepth(int i) { StringBuffer varName = new StringBuffer(); for (int j = 0; j <= i; j++) { SimpleNode node = (SimpleNode) jjtGetChild(j); if (node instanceof ASTIdentifier) { varName.append(((ASTIdentifier) node).getIdentifierString()); if (j != i) { varName.append('.'); } } } return varName.toString(); } /** * Gets the variable name of {@link ASTReference#root root}. * @return the identifier. * @throws Exception on any error * @see ASTIdentifier#getIdentifierString() * @see ASTArrayAccess#getIdentifierString() */ public String getRootString() throws Exception { if (root instanceof ASTIdentifier) { return ((ASTIdentifier) root).getIdentifierString(); } if (root instanceof ASTArrayAccess) { return ((ASTArrayAccess) root).getIdentifierString(); } throw new Exception("programmer error : ASTReference : root not known" + root); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.java100644 0 0 2764 10500374603 26533 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * variable; A reference by itself. */ public class ASTReferenceExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTReferenceExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTReferenceExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java100644 0 0 6733 10500374603 25175 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Introspector; import org.apache.commons.jexl.util.introspection.Info; import org.apache.commons.jexl.util.introspection.VelMethod; /** * generalized size() function for all classes we can think of. * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * @version $Id: ASTSizeFunction.java 398324 2006-04-30 12:20:24Z dion $ */ public class ASTSizeFunction extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTSizeFunction(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTSizeFunction(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { SimpleNode arg = (SimpleNode) jjtGetChild(0); Object val = arg.value(jc); if (val == null) { throw new Exception("size() : null arg"); } return new Integer(ASTSizeFunction.sizeOf(val)); } /** * Calculate the size of various types: Collection, Array, Map, String, * and anything that has a int size() method. * * @param val the object to get the size of. * @return the size of val * @throws Exception if the size cannot be determined. */ public static int sizeOf(Object val) throws Exception { if (val instanceof Collection) { return ((Collection) val).size(); } else if (val.getClass().isArray()) { return Array.getLength(val); } else if (val instanceof Map) { return ((Map) val).size(); } else if (val instanceof String) { return ((String) val).length(); } else { // check if there is a size method on the object that returns an // integer // and if so, just use it Object[] params = new Object[0]; Info velInfo = new Info("", 1, 1); VelMethod vm = Introspector.getUberspect().getMethod(val, "size", params, velInfo); if (vm != null && vm.getReturnType() == Integer.TYPE) { Integer result = (Integer) vm.invoke(val, params); return result.intValue(); } throw new Exception("size() : unknown type : " + val.getClass()); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java100644 0 0 3577 10500374603 24633 0ustar 0 0 /* * Copyright 2003,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Size Method, e.g. size(). * * @author Mark H. Wilkinson * @version $Id: ASTSizeMethod.java 398324 2006-04-30 12:20:24Z dion $ */ public class ASTSizeMethod extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTSizeMethod(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTSizeMethod(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * evaluate size as part of an expression on a base object. * * foo.bar.size * * @param jc the {@link JexlContext} to evaluate against. * @param obj not used. * @return the value of the array expression. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { return new Integer(ASTSizeFunction.sizeOf(obj)); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.java100644 0 0 2760 10500374603 26575 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Assignment as an expression. */ public class ASTStatementExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTStatementExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTStatementExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java100644 0 0 3211 10500374603 25324 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents a quoted string. * * @author Geir Magnusson Jr. * @version $Id: ASTStringLiteral.java 398324 2006-04-30 12:20:24Z dion $ */ public class ASTStringLiteral extends SimpleNode { /** the parsed literal. */ protected String literal; /** * Create the node given an id. * * @param id node id. */ public ASTStringLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTStringLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return literal; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.java100644 0 0 6114 10500374603 25143 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.JexlContext; /** * Subtraction. * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * @version $Id: ASTSubtractNode.java 398325 2006-04-30 12:34:29Z dion $ */ public class ASTSubtractNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTSubtractNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTSubtractNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } /* * if anything is float, double or string with ( "." | "E" | "e") coerce * all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1)) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1))) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return new Double(l.doubleValue() - r.doubleValue()); } /* * otherwise to longs with thee! */ Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); return new Long(l.longValue() - r.longValue()); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java100644 0 0 3070 10500374603 24271 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents Boolean true. * * @author Geir Magnusson Jr. * @version $Id: ASTTrueNode.java 398325 2006-04-30 12:34:29Z dion $ */ public class ASTTrueNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTTrueNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTTrueNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return Boolean.TRUE; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java100644 0 0 5636 10500374603 25476 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import java.math.BigDecimal; import java.math.BigInteger; import org.apache.commons.jexl.JexlContext; /** * - (unary minus). * * @author Mark H. Wilkinson * @version $Id: ASTUnaryMinusNode.java 398325 2006-04-30 12:34:29Z dion $ */ public class ASTUnaryMinusNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTUnaryMinusNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTUnaryMinusNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object val = ((SimpleNode) jjtGetChild(0)).value(jc); if (val instanceof Byte) { byte valueAsByte = ((Byte) val).byteValue(); return new Byte((byte) -valueAsByte); } else if (val instanceof Short) { short valueAsShort = ((Short) val).shortValue(); return new Short((short) -valueAsShort); } else if (val instanceof Integer) { int valueAsInt = ((Integer) val).intValue(); return new Integer(-valueAsInt); } else if (val instanceof Long) { long valueAsLong = ((Long) val).longValue(); return new Long(-valueAsLong); } else if (val instanceof Float) { float valueAsFloat = ((Float) val).floatValue(); return new Float(-valueAsFloat); } else if (val instanceof Double) { double valueAsDouble = ((Double) val).doubleValue(); return new Double(-valueAsDouble); } else if (val instanceof BigDecimal) { BigDecimal valueAsBigD = (BigDecimal) val; return valueAsBigD.negate(); } else if (val instanceof BigInteger) { BigInteger valueAsBigI = (BigInteger) val; return valueAsBigI.negate(); } throw new Exception("expression not a number"); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.java100644 0 0 3573 10500374603 25511 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * A while loop. Syntax: while ( expression ) statement * * @author Dion Gillard * @since 1.1 */ public class ASTWhileStatement extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTWhileStatement(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTWhileStatement(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object result = null; /* first child is the expression */ SimpleNode expressionNode = (SimpleNode) jjtGetChild(0); while (Coercion.coerceBoolean(expressionNode.value(jc)).booleanValue()) { // execute statement result = ((SimpleNode) jjtGetChild(1)).value(jc); } return result; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/JJTParserState.java100644 0 0 10205 10500374603 25017 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. JJTParserState.java */ package org.apache.commons.jexl.parser; import java.util.Stack; class JJTParserState { private final Stack nodes; private final Stack marks; private int sp; // number of nodes on stack private int mk; // current mark private boolean node_created; JJTParserState() { nodes = new Stack(); marks = new Stack(); sp = 0; mk = 0; } /* * Determines whether the current node was actually closed and pushed. This * should only be called in the final user action of a node scope. */ boolean nodeCreated() { return node_created; } /* * Call this to reinitialize the node stack. It is called automatically by * the parser's ReInit() method. */ void reset() { nodes.removeAllElements(); marks.removeAllElements(); sp = 0; mk = 0; } /* * Returns the root node of the AST. It only makes sense to call this after * a successful parse. */ Node rootNode() { return (Node) nodes.elementAt(0); } /* Pushes a node on to the stack. */ void pushNode(Node n) { nodes.push(n); ++sp; } /* * Returns the node on the top of the stack, and remove it from the stack. */ Node popNode() { if (--sp < mk) { mk = ((Integer) marks.pop()).intValue(); } return (Node) nodes.pop(); } /* Returns the node currently on the top of the stack. */ Node peekNode() { return (Node) nodes.peek(); } /* * Returns the number of children on the stack in the current node scope. */ int nodeArity() { return sp - mk; } void clearNodeScope(Node n) { while (sp > mk) { popNode(); } mk = ((Integer) marks.pop()).intValue(); } void openNodeScope(Node n) { marks.push(new Integer(mk)); mk = sp; n.jjtOpen(); } /* * A definite node is constructed from a specified number of children. That * number of nodes are popped from the stack and made the children of the * definite node. Then the definite node is pushed on to the stack. */ void closeNodeScope(Node n, int num) { mk = ((Integer) marks.pop()).intValue(); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; } /* * A conditional node is constructed if its condition is true. All the nodes * that have been pushed since the node was opened are made children of the * the conditional node, which is then pushed on to the stack. If the * condition is false the node is not constructed and they are left on the * stack. */ void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = ((Integer) marks.pop()).intValue(); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = ((Integer) marks.pop()).intValue(); node_created = false; } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/Node.java100644 0 0 4501 10500374603 23061 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. Node.java */ package org.apache.commons.jexl.parser; /** * All AST nodes must implement this interface. It provides basic machinery for * constructing the parent and child relationships between nodes. */ public interface Node { /** * This method is called after the node has been made the current node. It * indicates that child nodes can now be added to it. */ void jjtOpen(); /** * This method is called after all the child nodes have been added. */ void jjtClose(); /** * This pair of methods are used to inform the node of its parent. * @param n the parent node. */ void jjtSetParent(Node n); /** * Gets the parent node. * @return the parent to this node. */ Node jjtGetParent(); /** * This method tells the node to add its argument to the node's list of * children. * @param n the child node to add * @param i the index to add it at. */ void jjtAddChild(Node n, int i); /** * This method returns a child node. The children are numbered from zero, * left to right. * @param i the index of the child to get. * @return the child at the given index. */ Node jjtGetChild(int i); /** * Gets the number of children the node has. * @return the number of children the node has. */ int jjtGetNumChildren(); /** * Accept the visitor. * @param data arbitrary data. * @param visitor the visitor. * @return the result of the visit. */ Object jjtAccept(ParserVisitor visitor, Object data); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/package.html100644 0 0 621 10500374603 23571 0ustar 0 0 Package Documentation for org.apache.commons.jexl.parser Package Contains the Parser for JEXL script.

Introduction

This package contains the Parser for JEXL script.

commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ParseException.java100644 0 0 17152 10500374603 25153 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 2.1 */ package org.apache.commons.jexl.parser; /** * This exception is thrown when parse errors are encountered. You can * explicitly create objects of this exception type by calling the method * generateParseException in the generated parser. * * You can modify this class to customize your error reporting mechanisms so * long as you retain the public fields. */ public class ParseException extends Exception { /** serialization version id jdk13 generated. */ static final long serialVersionUID = 654626477565941968L; /** * This constructor is used by the method "generateParseException" in the * generated parser. Calling this constructor generates a new object of this * type with the fields "currentToken", "expectedTokenSequences", and * "tokenImage" set. The boolean flag "specialConstructor" is also set to * true to indicate that this constructor was used to create this object. * This constructor calls its super class with the empty string to force the * "toString" method of parent class "Throwable" to print the error message * in the form: ParseException: (result of getMessage) */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { super(""); specialConstructor = true; currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever purpose you * can think of. Constructing the exception in this manner makes the * exception behave in the normal way - i.e., as documented in the class * "Throwable". The fields "errorToken", "expectedTokenSequences", and * "tokenImage" do not contain relevant information. The JavaCC generated * code does not use these constructors. */ public ParseException() { super(); specialConstructor = false; } public ParseException(String message) { super(message); specialConstructor = false; } /** * This variable determines which constructor was used to create this object * and thereby affects the semantics of the "getMessage" method (see below). */ protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If this * object has been created due to a parse error, the token followng this * token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array of integers * represents a sequence of tokens (by their ordinal values) that is * expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated parser * within which the parse error occurred. This array is defined in the * generated ...Constants interface. */ public String[] tokenImage; /** * This method has the standard behavior when this object has been created * using the standard constructors. Otherwise, it uses "currentToken" and * "expectedTokenSequences" to generate a parse error message and returns * it. If this object has been created due to a parse error, and you do not * catch it (it gets thrown from the parser), then this method is called * during the printing of the final stack trace, and hence the correct error * message gets displayed. */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected += tokenImage[expectedTokenSequences[i][j]] + " "; } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected += "..."; } expected += eol + " "; } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected; return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version when these raw * version cannot be used as part of an ASCII string literal. */ protected String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0: continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u").append(s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/Parser.java100644 0 0 426304 10500374603 23501 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */ package org.apache.commons.jexl.parser; import java.io.Reader; public class Parser/* @bgen(jjtree) */implements ParserTreeConstants, ParserConstants { /* @bgen(jjtree) */ protected JJTParserState jjtree = new JJTParserState(); public SimpleNode parse(Reader reader) throws Exception { ReInit(reader); /* * lets do the 'Unique Init' in here to be safe - it's a pain to * remember */ SimpleNode tree = JexlScript(); return tree; } /* * Program structuring syntax follows. */ public final SimpleNode JexlScript() throws ParseException { /* @bgen(jjtree) JexlScript */ ASTJexlScript jjtn000 = new ASTJexlScript(this, JJTJEXLSCRIPT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); String name; try { label_1: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 9: case 11: case 12: case 14: case 36: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 51: case 52: case IDENTIFIER: case STRING_LITERAL: ; break; default: jj_la1[0] = jj_gen; break label_1; } Statement(); } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; { if (true) return jjtn000; } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); } final public void Block() throws ParseException { /* @bgen(jjtree) Block */ ASTBlock jjtn000 = new ASTBlock(this, JJTBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(9); label_2: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 9: case 11: case 12: case 14: case 36: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 51: case 52: case IDENTIFIER: case STRING_LITERAL: ; break; default: jj_la1[1] = jj_gen; break label_2; } Statement(); } jj_consume_token(10); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void EmptyFunction() throws ParseException { /* @bgen(jjtree) EmptyFunction */ ASTEmptyFunction jjtn000 = new ASTEmptyFunction(this, JJTEMPTYFUNCTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(11); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: Reference(); break; case 12: jj_consume_token(12); Reference(); jj_consume_token(13); break; default: jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void SizeFunction() throws ParseException { /* @bgen(jjtree) SizeFunction */ ASTSizeFunction jjtn000 = new ASTSizeFunction(this, JJTSIZEFUNCTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(14); jj_consume_token(12); Reference(); jj_consume_token(13); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Identifier() throws ParseException { /* @bgen(jjtree) Identifier */ ASTIdentifier jjtn000 = new ASTIdentifier(this, JJTIDENTIFIER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); Token t; try { t = jj_consume_token(IDENTIFIER); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.val = t.image; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } /* * Expression syntax follows. */ final public void Expression() throws ParseException { /* @bgen(jjtree) Expression */ ASTExpression jjtn000 = new ASTExpression(this, JJTEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { if (jj_2_1(2147483647)) { Assignment(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 11: case 12: case 14: case 36: case 42: case 43: case 44: case 45: case 46: case 47: case IDENTIFIER: case STRING_LITERAL: ConditionalOrExpression(); break; default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Assignment() throws ParseException { /* @bgen(jjtree) #Assignment( 2) */ ASTAssignment jjtn000 = new ASTAssignment(this, JJTASSIGNMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { PrimaryExpression(); jj_consume_token(15); Expression(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, 2); } } } final public void ConditionalOrExpression() throws ParseException { ConditionalAndExpression(); label_3: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 16: case 17: ; break; default: jj_la1[4] = jj_gen; break label_3; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 16: jj_consume_token(16); ASTOrNode jjtn001 = new ASTOrNode(this, JJTORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { ConditionalAndExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; case 17: jj_consume_token(17); ASTOrNode jjtn002 = new ASTOrNode(this, JJTORNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { ConditionalAndExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void ConditionalAndExpression() throws ParseException { InclusiveOrExpression(); label_4: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 18: case 19: ; break; default: jj_la1[6] = jj_gen; break label_4; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 18: jj_consume_token(18); ASTAndNode jjtn001 = new ASTAndNode(this, JJTANDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { InclusiveOrExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; case 19: jj_consume_token(19); ASTAndNode jjtn002 = new ASTAndNode(this, JJTANDNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { InclusiveOrExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void InclusiveOrExpression() throws ParseException { ExclusiveOrExpression(); label_5: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 20: ; break; default: jj_la1[8] = jj_gen; break label_5; } jj_consume_token(20); ASTBitwiseOrNode jjtn001 = new ASTBitwiseOrNode(this, JJTBITWISEORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { ExclusiveOrExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } } } final public void ExclusiveOrExpression() throws ParseException { AndExpression(); label_6: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 21: ; break; default: jj_la1[9] = jj_gen; break label_6; } jj_consume_token(21); ASTBitwiseXorNode jjtn001 = new ASTBitwiseXorNode(this, JJTBITWISEXORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { AndExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } } } final public void AndExpression() throws ParseException { EqualityExpression(); label_7: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 22: ; break; default: jj_la1[10] = jj_gen; break label_7; } jj_consume_token(22); ASTBitwiseAndNode jjtn001 = new ASTBitwiseAndNode(this, JJTBITWISEANDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { EqualityExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } } } final public void EqualityExpression() throws ParseException { RelationalExpression(); label_8: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 23: case 24: case 25: case 26: ; break; default: jj_la1[11] = jj_gen; break label_8; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 23: jj_consume_token(23); ASTEQNode jjtn001 = new ASTEQNode(this, JJTEQNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { RelationalExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; case 24: jj_consume_token(24); ASTEQNode jjtn002 = new ASTEQNode(this, JJTEQNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { RelationalExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; case 25: jj_consume_token(25); ASTNENode jjtn003 = new ASTNENode(this, JJTNENODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { RelationalExpression(); } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte003; } } if (jjte003 instanceof ParseException) { { if (true) throw (ParseException) jjte003; } } { if (true) throw (Error) jjte003; } } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } break; case 26: jj_consume_token(26); ASTNENode jjtn004 = new ASTNENode(this, JJTNENODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { RelationalExpression(); } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte004; } } if (jjte004 instanceof ParseException) { { if (true) throw (ParseException) jjte004; } } { if (true) throw (Error) jjte004; } } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } break; default: jj_la1[12] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void RelationalExpression() throws ParseException { AdditiveExpression(); label_9: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: ; break; default: jj_la1[13] = jj_gen; break label_9; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 27: jj_consume_token(27); ASTLTNode jjtn001 = new ASTLTNode(this, JJTLTNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { AdditiveExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; case 28: jj_consume_token(28); ASTLTNode jjtn002 = new ASTLTNode(this, JJTLTNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { AdditiveExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; case 29: jj_consume_token(29); ASTGTNode jjtn003 = new ASTGTNode(this, JJTGTNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { AdditiveExpression(); } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte003; } } if (jjte003 instanceof ParseException) { { if (true) throw (ParseException) jjte003; } } { if (true) throw (Error) jjte003; } } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } break; case 30: jj_consume_token(30); ASTGTNode jjtn004 = new ASTGTNode(this, JJTGTNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { AdditiveExpression(); } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte004; } } if (jjte004 instanceof ParseException) { { if (true) throw (ParseException) jjte004; } } { if (true) throw (Error) jjte004; } } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } break; case 31: jj_consume_token(31); ASTLENode jjtn005 = new ASTLENode(this, JJTLENODE); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); try { AdditiveExpression(); } catch (Throwable jjte005) { if (jjtc005) { jjtree.clearNodeScope(jjtn005); jjtc005 = false; } else { jjtree.popNode(); } if (jjte005 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte005; } } if (jjte005 instanceof ParseException) { { if (true) throw (ParseException) jjte005; } } { if (true) throw (Error) jjte005; } } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, 2); } } break; case 32: jj_consume_token(32); ASTLENode jjtn006 = new ASTLENode(this, JJTLENODE); boolean jjtc006 = true; jjtree.openNodeScope(jjtn006); try { AdditiveExpression(); } catch (Throwable jjte006) { if (jjtc006) { jjtree.clearNodeScope(jjtn006); jjtc006 = false; } else { jjtree.popNode(); } if (jjte006 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte006; } } if (jjte006 instanceof ParseException) { { if (true) throw (ParseException) jjte006; } } { if (true) throw (Error) jjte006; } } finally { if (jjtc006) { jjtree.closeNodeScope(jjtn006, 2); } } break; case 33: jj_consume_token(33); ASTGENode jjtn007 = new ASTGENode(this, JJTGENODE); boolean jjtc007 = true; jjtree.openNodeScope(jjtn007); try { AdditiveExpression(); } catch (Throwable jjte007) { if (jjtc007) { jjtree.clearNodeScope(jjtn007); jjtc007 = false; } else { jjtree.popNode(); } if (jjte007 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte007; } } if (jjte007 instanceof ParseException) { { if (true) throw (ParseException) jjte007; } } { if (true) throw (Error) jjte007; } } finally { if (jjtc007) { jjtree.closeNodeScope(jjtn007, 2); } } break; case 34: jj_consume_token(34); ASTGENode jjtn008 = new ASTGENode(this, JJTGENODE); boolean jjtc008 = true; jjtree.openNodeScope(jjtn008); try { AdditiveExpression(); } catch (Throwable jjte008) { if (jjtc008) { jjtree.clearNodeScope(jjtn008); jjtc008 = false; } else { jjtree.popNode(); } if (jjte008 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte008; } } if (jjte008 instanceof ParseException) { { if (true) throw (ParseException) jjte008; } } { if (true) throw (Error) jjte008; } } finally { if (jjtc008) { jjtree.closeNodeScope(jjtn008, 2); } } break; default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void AdditiveExpression() throws ParseException { MultiplicativeExpression(); label_10: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 35: case 36: ; break; default: jj_la1[15] = jj_gen; break label_10; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 35: jj_consume_token(35); ASTAddNode jjtn001 = new ASTAddNode(this, JJTADDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { MultiplicativeExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; case 36: jj_consume_token(36); ASTSubtractNode jjtn002 = new ASTSubtractNode(this, JJTSUBTRACTNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { MultiplicativeExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; default: jj_la1[16] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void MultiplicativeExpression() throws ParseException { UnaryExpression(); label_11: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 37: case 38: case 39: case 40: case 41: ; break; default: jj_la1[17] = jj_gen; break label_11; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 37: jj_consume_token(37); ASTMulNode jjtn001 = new ASTMulNode(this, JJTMULNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { UnaryExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; case 38: jj_consume_token(38); ASTDivNode jjtn002 = new ASTDivNode(this, JJTDIVNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { UnaryExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; case 39: jj_consume_token(39); ASTDivNode jjtn003 = new ASTDivNode(this, JJTDIVNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { UnaryExpression(); } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte003; } } if (jjte003 instanceof ParseException) { { if (true) throw (ParseException) jjte003; } } { if (true) throw (Error) jjte003; } } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } break; case 40: jj_consume_token(40); ASTModNode jjtn004 = new ASTModNode(this, JJTMODNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { UnaryExpression(); } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte004; } } if (jjte004 instanceof ParseException) { { if (true) throw (ParseException) jjte004; } } { if (true) throw (Error) jjte004; } } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } break; case 41: jj_consume_token(41); ASTModNode jjtn005 = new ASTModNode(this, JJTMODNODE); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); try { UnaryExpression(); } catch (Throwable jjte005) { if (jjtc005) { jjtree.clearNodeScope(jjtn005); jjtc005 = false; } else { jjtree.popNode(); } if (jjte005 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte005; } } if (jjte005 instanceof ParseException) { { if (true) throw (ParseException) jjte005; } } { if (true) throw (Error) jjte005; } } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, 2); } } break; default: jj_la1[18] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void UnaryExpression() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 36: jj_consume_token(36); ASTUnaryMinusNode jjtn001 = new ASTUnaryMinusNode(this, JJTUNARYMINUSNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { UnaryExpression(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte001; } } if (jjte001 instanceof ParseException) { { if (true) throw (ParseException) jjte001; } } { if (true) throw (Error) jjte001; } } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 1); } } break; case 42: jj_consume_token(42); ASTBitwiseComplNode jjtn002 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { UnaryExpression(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte002; } } if (jjte002 instanceof ParseException) { { if (true) throw (ParseException) jjte002; } } { if (true) throw (Error) jjte002; } } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 1); } } break; case 43: jj_consume_token(43); ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { UnaryExpression(); } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte003; } } if (jjte003 instanceof ParseException) { { if (true) throw (ParseException) jjte003; } } { if (true) throw (Error) jjte003; } } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 1); } } break; case 44: jj_consume_token(44); ASTNotNode jjtn004 = new ASTNotNode(this, JJTNOTNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { UnaryExpression(); } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte004; } } if (jjte004 instanceof ParseException) { { if (true) throw (ParseException) jjte004; } } { if (true) throw (Error) jjte004; } } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 1); } } break; case INTEGER_LITERAL: case FLOAT_LITERAL: case 11: case 12: case 14: case 45: case 46: case 47: case IDENTIFIER: case STRING_LITERAL: PrimaryExpression(); break; default: jj_la1[19] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void PrimaryExpression() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 45: case 46: case 47: case STRING_LITERAL: Literal(); break; case IDENTIFIER: Reference(); break; case 12: jj_consume_token(12); Expression(); jj_consume_token(13); break; case 11: EmptyFunction(); break; case 14: SizeFunction(); break; default: jj_la1[20] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void Literal() throws ParseException { Token t; switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: IntegerLiteral(); break; case FLOAT_LITERAL: FloatLiteral(); break; case 46: case 47: BooleanLiteral(); break; case STRING_LITERAL: StringLiteral(); break; case 45: NullLiteral(); break; default: jj_la1[21] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void NullLiteral() throws ParseException { /* @bgen(jjtree) NullLiteral */ ASTNullLiteral jjtn000 = new ASTNullLiteral(this, JJTNULLLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(45); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void BooleanLiteral() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 46: ASTTrueNode jjtn001 = new ASTTrueNode(this, JJTTRUENODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { jj_consume_token(46); } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); } } break; case 47: ASTFalseNode jjtn002 = new ASTFalseNode(this, JJTFALSENODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { jj_consume_token(47); } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, true); } } break; default: jj_la1[22] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void IntegerLiteral() throws ParseException { /* @bgen(jjtree) IntegerLiteral */ ASTIntegerLiteral jjtn000 = new ASTIntegerLiteral(this, JJTINTEGERLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); Token t; try { t = jj_consume_token(INTEGER_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.val = Integer.valueOf(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void FloatLiteral() throws ParseException { /* @bgen(jjtree) FloatLiteral */ ASTFloatLiteral jjtn000 = new ASTFloatLiteral(this, JJTFLOATLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); Token t; try { t = jj_consume_token(FLOAT_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.val = Float.valueOf(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void StringLiteral() throws ParseException { /* @bgen(jjtree) StringLiteral */ ASTStringLiteral jjtn000 = new ASTStringLiteral(this, JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); Token t; try { t = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.literal = t.image.substring(1, t.image.length() - 1); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } /* * Statement syntax follows. */ final public void Statement() throws ParseException { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 48: jj_consume_token(48); break; case 9: Block(); break; default: jj_la1[23] = jj_gen; if (jj_2_2(2147483647)) { ReferenceExpression(); } else if (jj_2_3(2147483647)) { StatementExpression(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 11: case 12: case 14: case 36: case 42: case 43: case 44: case 45: case 46: case 47: case IDENTIFIER: case STRING_LITERAL: ExpressionExpression(); break; case 49: IfStatement(); break; case 52: ForeachStatement(); break; case 51: WhileStatement(); break; default: jj_la1[24] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } } final public void ExpressionExpression() throws ParseException { /* @bgen(jjtree) ExpressionExpression */ ASTExpressionExpression jjtn000 = new ASTExpressionExpression(this, JJTEXPRESSIONEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { Expression(); jj_consume_token(48); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void StatementExpression() throws ParseException { /* @bgen(jjtree) StatementExpression */ ASTStatementExpression jjtn000 = new ASTStatementExpression(this, JJTSTATEMENTEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { Assignment(); jj_consume_token(48); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void ReferenceExpression() throws ParseException { /* @bgen(jjtree) ReferenceExpression */ ASTReferenceExpression jjtn000 = new ASTReferenceExpression(this, JJTREFERENCEEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { Reference(); jj_consume_token(48); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void IfStatement() throws ParseException { /* @bgen(jjtree) IfStatement */ ASTIfStatement jjtn000 = new ASTIfStatement(this, JJTIFSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(49); jj_consume_token(12); Expression(); jj_consume_token(13); Statement(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 50: jj_consume_token(50); Statement(); break; default: jj_la1[25] = jj_gen; ; } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void WhileStatement() throws ParseException { /* @bgen(jjtree) WhileStatement */ ASTWhileStatement jjtn000 = new ASTWhileStatement(this, JJTWHILESTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(51); jj_consume_token(12); Expression(); jj_consume_token(13); Statement(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void ForeachStatement() throws ParseException { /* @bgen(jjtree) ForeachStatement */ ASTForeachStatement jjtn000 = new ASTForeachStatement(this, JJTFOREACHSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(52); jj_consume_token(12); Reference(); jj_consume_token(53); Reference(); jj_consume_token(13); Statement(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Method() throws ParseException { /* @bgen(jjtree) Method */ ASTMethod jjtn000 = new ASTMethod(this, JJTMETHOD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { Identifier(); jj_consume_token(12); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 11: case 12: case 14: case 36: case 42: case 43: case 44: case 45: case 46: case 47: case IDENTIFIER: case STRING_LITERAL: Parameter(); label_12: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 54: ; break; default: jj_la1[26] = jj_gen; break label_12; } jj_consume_token(54); Parameter(); } break; default: jj_la1[27] = jj_gen; ; } jj_consume_token(13); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void ArrayAccess() throws ParseException { /* @bgen(jjtree) ArrayAccess */ ASTArrayAccess jjtn000 = new ASTArrayAccess(this, JJTARRAYACCESS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { Identifier(); label_13: while (true) { jj_consume_token(55); if (jj_2_4(3)) { Expression(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: IntegerLiteral(); break; case IDENTIFIER: Reference(); break; default: jj_la1[28] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(56); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 55: ; break; default: jj_la1[29] = jj_gen; break label_13; } } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void SizeMethod() throws ParseException { /* @bgen(jjtree) SizeMethod */ ASTSizeMethod jjtn000 = new ASTSizeMethod(this, JJTSIZEMETHOD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(14); jj_consume_token(12); jj_consume_token(13); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Reference() throws ParseException { /* @bgen(jjtree) Reference */ ASTReference jjtn000 = new ASTReference(this, JJTREFERENCE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { if (jj_2_5(2147483647)) { ArrayAccess(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case IDENTIFIER: Identifier(); break; default: jj_la1[30] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } label_14: while (true) { if (jj_2_6(2)) { ; } else { break label_14; } jj_consume_token(57); if (jj_2_8(2147483647)) { ArrayAccess(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case 14: case IDENTIFIER: if (jj_2_7(3)) { Method(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 14: SizeMethod(); break; case IDENTIFIER: Identifier(); break; case INTEGER_LITERAL: IntegerLiteral(); break; default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; default: jj_la1[32] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { { if (true) throw (RuntimeException) jjte000; } } if (jjte000 instanceof ParseException) { { if (true) throw (ParseException) jjte000; } } { if (true) throw (Error) jjte000; } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void Parameter() throws ParseException { if (jj_2_9(3)) { Expression(); } else { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case INTEGER_LITERAL: case FLOAT_LITERAL: case 45: case 46: case 47: case STRING_LITERAL: Literal(); break; case IDENTIFIER: Reference(); break; default: jj_la1[33] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_1(); jj_save(0, xla); return retval; } final private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_2(); jj_save(1, xla); return retval; } final private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_3(); jj_save(2, xla); return retval; } final private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_4(); jj_save(3, xla); return retval; } final private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_5(); jj_save(4, xla); return retval; } final private boolean jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_6(); jj_save(5, xla); return retval; } final private boolean jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_7(); jj_save(6, xla); return retval; } final private boolean jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_8(); jj_save(7, xla); return retval; } final private boolean jj_2_9(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_9(); jj_save(8, xla); return retval; } final private boolean jj_3R_71() { if (jj_scan_token(17)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_58()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_59() { Token xsp; xsp = jj_scanpos; if (jj_3R_70()) { jj_scanpos = xsp; if (jj_3R_71()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_70() { if (jj_scan_token(16)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_58()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_64() { if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_47() { if (jj_3R_58()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_59()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3_1() { if (jj_3R_15()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(15)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_46() { if (jj_3R_15()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(15)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_34() { if (jj_3R_18()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_62() { if (jj_scan_token(FLOAT_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_36() { if (jj_3R_47()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_35() { if (jj_3R_46()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_17() { Token xsp; xsp = jj_scanpos; if (jj_3R_35()) { jj_scanpos = xsp; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_56() { if (jj_scan_token(12)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(13)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_37() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_18() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_73() { if (jj_scan_token(47)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_63() { Token xsp; xsp = jj_scanpos; if (jj_3R_72()) { jj_scanpos = xsp; if (jj_3R_73()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_72() { if (jj_scan_token(46)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_45() { if (jj_scan_token(14)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(12)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(13)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_27() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_65() { if (jj_scan_token(45)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_55() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_41() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_44() { if (jj_scan_token(11)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_55()) { jj_scanpos = xsp; if (jj_3R_56()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_21() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_54() { if (jj_3R_65()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_53() { if (jj_3R_64()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_67() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_52() { if (jj_3R_63()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_61() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_51() { if (jj_3R_62()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_43() { Token xsp; xsp = jj_scanpos; if (jj_3R_50()) { jj_scanpos = xsp; if (jj_3R_51()) { jj_scanpos = xsp; if (jj_3R_52()) { jj_scanpos = xsp; if (jj_3R_53()) { jj_scanpos = xsp; if (jj_3R_54()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_50() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_26() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_40() { if (jj_3R_18()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_20() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_32() { if (jj_3R_45()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_60() { if (jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_31() { if (jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_30() { if (jj_scan_token(12)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(13)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_66() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_29() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_28() { if (jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_15() { Token xsp; xsp = jj_scanpos; if (jj_3R_28()) { jj_scanpos = xsp; if (jj_3R_29()) { jj_scanpos = xsp; if (jj_3R_30()) { jj_scanpos = xsp; if (jj_3R_31()) { jj_scanpos = xsp; if (jj_3R_32()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_25() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_39() { if (jj_3R_48()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_109() { if (jj_3R_15()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_19() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_108() { if (jj_scan_token(44)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_107() { if (jj_scan_token(43)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_106() { if (jj_scan_token(42)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_105() { if (jj_scan_token(36)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_101() { Token xsp; xsp = jj_scanpos; if (jj_3R_105()) { jj_scanpos = xsp; if (jj_3R_106()) { jj_scanpos = xsp; if (jj_3R_107()) { jj_scanpos = xsp; if (jj_3R_108()) { jj_scanpos = xsp; if (jj_3R_109()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_78() { if (jj_scan_token(54)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_49()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_114() { if (jj_scan_token(41)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3_8() { if (jj_3R_18()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(55)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_25()) { jj_scanpos = xsp; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(56)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_113() { if (jj_scan_token(40)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3_9() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_49() { Token xsp; xsp = jj_scanpos; if (jj_3_9()) { jj_scanpos = xsp; if (jj_3R_60()) { jj_scanpos = xsp; if (jj_3R_61()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_112() { if (jj_scan_token(39)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3_4() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_111() { if (jj_scan_token(38)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3_5() { if (jj_3R_18()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(55)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_19()) { jj_scanpos = xsp; if (jj_3R_20()) { jj_scanpos = xsp; if (jj_3R_21()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(56)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3_7() { if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_110() { if (jj_scan_token(37)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_102() { Token xsp; xsp = jj_scanpos; if (jj_3R_110()) { jj_scanpos = xsp; if (jj_3R_111()) { jj_scanpos = xsp; if (jj_3R_112()) { jj_scanpos = xsp; if (jj_3R_113()) { jj_scanpos = xsp; if (jj_3R_114()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_23() { Token xsp; xsp = jj_scanpos; if (jj_3_7()) { jj_scanpos = xsp; if (jj_3R_39()) { jj_scanpos = xsp; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_22() { if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_57() { if (jj_scan_token(55)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3_4()) { jj_scanpos = xsp; if (jj_3R_66()) { jj_scanpos = xsp; if (jj_3R_67()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(56)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_91() { if (jj_3R_101()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_102()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_42() { if (jj_3R_49()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3_6() { if (jj_scan_token(57)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_22()) { jj_scanpos = xsp; if (jj_3R_23()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_33() { if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_48() { if (jj_scan_token(14)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(12)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(13)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_104() { if (jj_scan_token(36)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_91()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_16() { Token xsp; xsp = jj_scanpos; if (jj_3R_33()) { jj_scanpos = xsp; if (jj_3R_34()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; while (true) { xsp = jj_scanpos; if (jj_3_6()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_103() { if (jj_scan_token(35)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_91()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_92() { Token xsp; xsp = jj_scanpos; if (jj_3R_103()) { jj_scanpos = xsp; if (jj_3R_104()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_85() { if (jj_3R_91()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_92()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_38() { if (jj_3R_18()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; if (jj_3R_57()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; while (true) { xsp = jj_scanpos; if (jj_3R_57()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_100() { if (jj_scan_token(34)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_99() { if (jj_scan_token(33)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_24() { if (jj_3R_18()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(12)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; if (jj_3R_42()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(13)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_98() { if (jj_scan_token(32)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_97() { if (jj_scan_token(31)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_96() { if (jj_scan_token(30)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_95() { if (jj_scan_token(29)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_94() { if (jj_scan_token(28)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_93() { if (jj_scan_token(27)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_86() { Token xsp; xsp = jj_scanpos; if (jj_3R_93()) { jj_scanpos = xsp; if (jj_3R_94()) { jj_scanpos = xsp; if (jj_3R_95()) { jj_scanpos = xsp; if (jj_3R_96()) { jj_scanpos = xsp; if (jj_3R_97()) { jj_scanpos = xsp; if (jj_3R_98()) { jj_scanpos = xsp; if (jj_3R_99()) { jj_scanpos = xsp; if (jj_3R_100()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_83() { if (jj_3R_85()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_86()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_90() { if (jj_scan_token(26)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_83()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_89() { if (jj_scan_token(25)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_83()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_88() { if (jj_scan_token(24)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_83()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_87() { if (jj_scan_token(23)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_83()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_84() { Token xsp; xsp = jj_scanpos; if (jj_3R_87()) { jj_scanpos = xsp; if (jj_3R_88()) { jj_scanpos = xsp; if (jj_3R_89()) { jj_scanpos = xsp; if (jj_3R_90()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_81() { if (jj_3R_83()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_84()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_82() { if (jj_scan_token(22)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_81()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_79() { if (jj_3R_81()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_82()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3_3() { if (jj_3R_15()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(15)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3_2() { if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_scan_token(48)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_80() { if (jj_scan_token(21)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_79()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_74() { if (jj_3R_79()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_80()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_75() { if (jj_scan_token(20)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_74()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_68() { if (jj_3R_74()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_75()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } final private boolean jj_3R_77() { if (jj_scan_token(19)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_68()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_69() { Token xsp; xsp = jj_scanpos; if (jj_3R_76()) { jj_scanpos = xsp; if (jj_3R_77()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_76() { if (jj_scan_token(18)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; if (jj_3R_68()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } final private boolean jj_3R_58() { if (jj_3R_68()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_69()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } public ParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; public boolean lookingAhead = false; private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[34]; final private int[] jj_la1_0 = { 0x5b80, 0x5b80, 0x1000, 0x5980, 0x30000, 0x30000, 0xc0000, 0xc0000, 0x100000, 0x200000, 0x400000, 0x7800000, 0x7800000, 0xf8000000, 0xf8000000, 0x0, 0x0, 0x0, 0x0, 0x5980, 0x5980, 0x180, 0x0, 0x200, 0x5980, 0x0, 0x0, 0x5980, 0x80, 0x0, 0x0, 0x4080, 0x4080, 0x180, }; final private int[] jj_la1_1 = { 0x241bfc10, 0x241bfc10, 0x4000000, 0x2400fc10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x7, 0x18, 0x18, 0x3e0, 0x3e0, 0x2400fc10, 0x2400e000, 0x2000e000, 0xc000, 0x10000, 0x241afc10, 0x40000, 0x400000, 0x2400fc10, 0x4000000, 0x800000, 0x4000000, 0x4000000, 0x4000000, 0x2400e000, }; final private JJCalls[] jj_2_rtns = new JJCalls[9]; private boolean jj_rescan = false; private int jj_gc = 0; public Parser(java.io.InputStream stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(java.io.InputStream stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public Parser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public Parser(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 34; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } final private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } final private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } return (jj_scanpos.kind != kind); } final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } final public Token getToken(int index) { Token t = lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } final private int jj_ntk() { if ((jj_nt = token.next) == null) return (jj_ntk = (token.next = token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.Vector jj_expentries = new java.util.Vector(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; private int jj_endpos; private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } boolean exists = false; for (java.util.Enumeration enumeration = jj_expentries.elements(); enumeration.hasMoreElements();) { int[] oldentry = (int[]) (enumeration.nextElement()); if (oldentry.length == jj_expentry.length) { exists = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { exists = false; break; } } if (exists) break; } } if (!exists) jj_expentries.addElement(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } final public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[62]; for (int i = 0; i < 62; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 34; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1 << j)) != 0) { la1tokens[j] = true; } if ((jj_la1_1[i] & (1 << j)) != 0) { la1tokens[32 + j] = true; } } } } for (int i = 0; i < 62; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.addElement(jj_expentry); } } jj_endpos = 0; jj_rescan_token(); jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = (int[]) jj_expentries.elementAt(i); } return new ParseException(token, exptokseq, tokenImage); } final public void enable_tracing() { } final public void disable_tracing() { } final private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 9; i++) { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; case 2: jj_3_3(); break; case 3: jj_3_4(); break; case 4: jj_3_5(); break; case 5: jj_3_6(); break; case 6: jj_3_7(); break; case 7: jj_3_8(); break; case 8: jj_3_9(); break; } } p = p.next; } while (p != null); } jj_rescan = false; } final private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/Parser.jj100644 0 0 133663 10500374603 23166 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Jexl : Java Expression Language * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * * @version $Id: Parser.jj 136562 2004-02-28 13:45:22Z yoavs $ */ options { STATIC=false; } PARSER_BEGIN(Parser) package org.apache.commons.jexl.parser; import java.io.Reader; import java.io.ByteArrayInputStream; public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ protected JJTParserState jjtree = new JJTParserState(); /*@egen*/ public SimpleNode parse(Reader reader) throws Exception { ReInit(reader); /* * lets do the 'Unique Init' in here to be * safe - it's a pain to remember */ SimpleNode tree = JexlScript(); return tree; } } PARSER_END(Parser) SKIP : /* WHITE SPACE */ { | " " | "\t" | "\n" | "\r" | "\f" } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: ()+ > | < FLOAT_LITERAL: ()+ "."()+ > } /* * Program structuring syntax follows. */ SimpleNode JexlScript() : {/*@bgen(jjtree) JexlScript */ ASTJexlScript jjtn000 = new ASTJexlScript(this, JJTJEXLSCRIPT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ String name; } {/*@bgen(jjtree) JexlScript */ try { /*@egen*/ ( Statement() )* /*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { return jjtn000;}/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Block() : {/*@bgen(jjtree) Block */ ASTBlock jjtn000 = new ASTBlock(this, JJTBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Block */ try { /*@egen*/ "{" ( Statement() )* "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void EmptyFunction() : {/*@bgen(jjtree) EmptyFunction */ ASTEmptyFunction jjtn000 = new ASTEmptyFunction(this, JJTEMPTYFUNCTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) EmptyFunction */ try { /*@egen*/ "empty" ( Reference() | "(" Reference() ")" )/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void SizeFunction() : {/*@bgen(jjtree) SizeFunction */ ASTSizeFunction jjtn000 = new ASTSizeFunction(this, JJTSIZEFUNCTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) SizeFunction */ try { /*@egen*/ "size" "(" Reference() ")"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Identifier() : {/*@bgen(jjtree) Identifier */ ASTIdentifier jjtn000 = new ASTIdentifier(this, JJTIDENTIFIER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) Identifier */ try { /*@egen*/ t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.val = t.image; }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } /* * Expression syntax follows. */ void Expression() : {/*@bgen(jjtree) Expression */ ASTExpression jjtn000 = new ASTExpression(this, JJTEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Expression */ try { /*@egen*/ LOOKAHEAD( PrimaryExpression() "=" ) Assignment() | ConditionalOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Assignment() : {/*@bgen(jjtree) #Assignment( 2) */ ASTAssignment jjtn000 = new ASTAssignment(this, JJTASSIGNMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) #Assignment( 2) */ try { /*@egen*/ PrimaryExpression() "=" Expression()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, 2); } } /*@egen*/ } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||"/*@bgen(jjtree) #OrNode( 2) */ { ASTOrNode jjtn001 = new ASTOrNode(this, JJTORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ ConditionalAndExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "or"/*@bgen(jjtree) #OrNode( 2) */ { ASTOrNode jjtn002 = new ASTOrNode(this, JJTORNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ ConditionalAndExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&"/*@bgen(jjtree) #AndNode( 2) */ { ASTAndNode jjtn001 = new ASTAndNode(this, JJTANDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ InclusiveOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "and"/*@bgen(jjtree) #AndNode( 2) */ { ASTAndNode jjtn002 = new ASTAndNode(this, JJTANDNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ InclusiveOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|"/*@bgen(jjtree) #BitwiseOrNode( 2) */ { ASTBitwiseOrNode jjtn001 = new ASTBitwiseOrNode(this, JJTBITWISEORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ ExclusiveOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^"/*@bgen(jjtree) #BitwiseXorNode( 2) */ { ASTBitwiseXorNode jjtn001 = new ASTBitwiseXorNode(this, JJTBITWISEXORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ AndExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ )* } void AndExpression() : {} { EqualityExpression() ( "&"/*@bgen(jjtree) #BitwiseAndNode( 2) */ { ASTBitwiseAndNode jjtn001 = new ASTBitwiseAndNode(this, JJTBITWISEANDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ EqualityExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ )* } void EqualityExpression() : {} { RelationalExpression() ( "=="/*@bgen(jjtree) #EQNode( 2) */ { ASTEQNode jjtn001 = new ASTEQNode(this, JJTEQNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "eq"/*@bgen(jjtree) #EQNode( 2) */ { ASTEQNode jjtn002 = new ASTEQNode(this, JJTEQNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ | "!="/*@bgen(jjtree) #NENode( 2) */ { ASTNENode jjtn003 = new ASTNENode(this, JJTNENODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } /*@egen*/ | "ne"/*@bgen(jjtree) #NENode( 2) */ { ASTNENode jjtn004 = new ASTNENode(this, JJTNENODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } /*@egen*/ )* } void RelationalExpression() : {} { AdditiveExpression() ( "<"/*@bgen(jjtree) #LTNode( 2) */ { ASTLTNode jjtn001 = new ASTLTNode(this, JJTLTNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "lt"/*@bgen(jjtree) #LTNode( 2) */ { ASTLTNode jjtn002 = new ASTLTNode(this, JJTLTNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ | ">"/*@bgen(jjtree) #GTNode( 2) */ { ASTGTNode jjtn003 = new ASTGTNode(this, JJTGTNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } /*@egen*/ | "gt"/*@bgen(jjtree) #GTNode( 2) */ { ASTGTNode jjtn004 = new ASTGTNode(this, JJTGTNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } /*@egen*/ | "<="/*@bgen(jjtree) #LENode( 2) */ { ASTLENode jjtn005 = new ASTLENode(this, JJTLENODE); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte005) { if (jjtc005) { jjtree.clearNodeScope(jjtn005); jjtc005 = false; } else { jjtree.popNode(); } if (jjte005 instanceof RuntimeException) { throw (RuntimeException)jjte005; } if (jjte005 instanceof ParseException) { throw (ParseException)jjte005; } throw (Error)jjte005; } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, 2); } } /*@egen*/ | "le"/*@bgen(jjtree) #LENode( 2) */ { ASTLENode jjtn006 = new ASTLENode(this, JJTLENODE); boolean jjtc006 = true; jjtree.openNodeScope(jjtn006); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte006) { if (jjtc006) { jjtree.clearNodeScope(jjtn006); jjtc006 = false; } else { jjtree.popNode(); } if (jjte006 instanceof RuntimeException) { throw (RuntimeException)jjte006; } if (jjte006 instanceof ParseException) { throw (ParseException)jjte006; } throw (Error)jjte006; } finally { if (jjtc006) { jjtree.closeNodeScope(jjtn006, 2); } } /*@egen*/ | ">="/*@bgen(jjtree) #GENode( 2) */ { ASTGENode jjtn007 = new ASTGENode(this, JJTGENODE); boolean jjtc007 = true; jjtree.openNodeScope(jjtn007); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte007) { if (jjtc007) { jjtree.clearNodeScope(jjtn007); jjtc007 = false; } else { jjtree.popNode(); } if (jjte007 instanceof RuntimeException) { throw (RuntimeException)jjte007; } if (jjte007 instanceof ParseException) { throw (ParseException)jjte007; } throw (Error)jjte007; } finally { if (jjtc007) { jjtree.closeNodeScope(jjtn007, 2); } } /*@egen*/ | "ge"/*@bgen(jjtree) #GENode( 2) */ { ASTGENode jjtn008 = new ASTGENode(this, JJTGENODE); boolean jjtc008 = true; jjtree.openNodeScope(jjtn008); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte008) { if (jjtc008) { jjtree.clearNodeScope(jjtn008); jjtc008 = false; } else { jjtree.popNode(); } if (jjte008 instanceof RuntimeException) { throw (RuntimeException)jjte008; } if (jjte008 instanceof ParseException) { throw (ParseException)jjte008; } throw (Error)jjte008; } finally { if (jjtc008) { jjtree.closeNodeScope(jjtn008, 2); } } /*@egen*/ )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( "+"/*@bgen(jjtree) #AddNode( 2) */ { ASTAddNode jjtn001 = new ASTAddNode(this, JJTADDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ MultiplicativeExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "-"/*@bgen(jjtree) #SubtractNode( 2) */ { ASTSubtractNode jjtn002 = new ASTSubtractNode(this, JJTSUBTRACTNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ MultiplicativeExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ )* } void MultiplicativeExpression() : {} { UnaryExpression() ( "*"/*@bgen(jjtree) #MulNode( 2) */ { ASTMulNode jjtn001 = new ASTMulNode(this, JJTMULNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "/"/*@bgen(jjtree) #DivNode( 2) */ { ASTDivNode jjtn002 = new ASTDivNode(this, JJTDIVNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ | "div"/*@bgen(jjtree) #DivNode( 2) */ { ASTDivNode jjtn003 = new ASTDivNode(this, JJTDIVNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } /*@egen*/ | "%"/*@bgen(jjtree) #ModNode( 2) */ { ASTModNode jjtn004 = new ASTModNode(this, JJTMODNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } /*@egen*/ | "mod"/*@bgen(jjtree) #ModNode( 2) */ { ASTModNode jjtn005 = new ASTModNode(this, JJTMODNODE); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte005) { if (jjtc005) { jjtree.clearNodeScope(jjtn005); jjtc005 = false; } else { jjtree.popNode(); } if (jjte005 instanceof RuntimeException) { throw (RuntimeException)jjte005; } if (jjte005 instanceof ParseException) { throw (ParseException)jjte005; } throw (Error)jjte005; } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, 2); } } /*@egen*/ )* } void UnaryExpression() : {} { "-"/*@bgen(jjtree) #UnaryMinusNode( 1) */ { ASTUnaryMinusNode jjtn001 = new ASTUnaryMinusNode(this, JJTUNARYMINUSNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 1); } } /*@egen*/ | "~"/*@bgen(jjtree) #BitwiseComplNode( 1) */ { ASTBitwiseComplNode jjtn002 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 1); } } /*@egen*/ | "!"/*@bgen(jjtree) #NotNode( 1) */ { ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 1); } } /*@egen*/ | "not"/*@bgen(jjtree) #NotNode( 1) */ { ASTNotNode jjtn004 = new ASTNotNode(this, JJTNOTNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 1); } } /*@egen*/ | PrimaryExpression() } void PrimaryExpression() : {} { Literal() | Reference() | "(" Expression() ")" | EmptyFunction() | SizeFunction() } void Literal() : { Token t; } { IntegerLiteral() | FloatLiteral() | BooleanLiteral() | StringLiteral() | NullLiteral() } void NullLiteral() : {/*@bgen(jjtree) NullLiteral */ ASTNullLiteral jjtn000 = new ASTNullLiteral(this, JJTNULLLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) NullLiteral */ try { /*@egen*/ "null"/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void BooleanLiteral() : {} {/*@bgen(jjtree) TrueNode */ { ASTTrueNode jjtn001 = new ASTTrueNode(this, JJTTRUENODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ "true"/*@bgen(jjtree)*/ } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); } } /*@egen*/ |/*@bgen(jjtree) FalseNode */ { ASTFalseNode jjtn002 = new ASTFalseNode(this, JJTFALSENODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ "false"/*@bgen(jjtree)*/ } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, true); } } /*@egen*/ } void IntegerLiteral() : {/*@bgen(jjtree) IntegerLiteral */ ASTIntegerLiteral jjtn000 = new ASTIntegerLiteral(this, JJTINTEGERLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) IntegerLiteral */ try { /*@egen*/ ( t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.val = Integer.valueOf(t.image); } )/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void FloatLiteral() : {/*@bgen(jjtree) FloatLiteral */ ASTFloatLiteral jjtn000 = new ASTFloatLiteral(this, JJTFLOATLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) FloatLiteral */ try { /*@egen*/ ( t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.val = Float.valueOf(t.image); } )/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void StringLiteral() : {/*@bgen(jjtree) StringLiteral */ ASTStringLiteral jjtn000 = new ASTStringLiteral(this, JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) StringLiteral */ try { /*@egen*/ ( t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.literal = t.image.substring(1,t.image.length()-1); } )/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } /* * Statement syntax follows. */ void Statement() : {} { ";" | Block() | LOOKAHEAD( Reference() ";" ) ReferenceExpression() | LOOKAHEAD( PrimaryExpression() "=" ) StatementExpression() | ExpressionExpression() | IfStatement() | ForeachStatement() | WhileStatement() } void ExpressionExpression() : {/*@bgen(jjtree) ExpressionExpression */ ASTExpressionExpression jjtn000 = new ASTExpressionExpression(this, JJTEXPRESSIONEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ExpressionExpression */ try { /*@egen*/ Expression() ";"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void StatementExpression() : {/*@bgen(jjtree) StatementExpression */ ASTStatementExpression jjtn000 = new ASTStatementExpression(this, JJTSTATEMENTEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) StatementExpression */ try { /*@egen*/ Assignment() ";"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ReferenceExpression() : {/*@bgen(jjtree) ReferenceExpression */ ASTReferenceExpression jjtn000 = new ASTReferenceExpression(this, JJTREFERENCEEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ReferenceExpression */ try { /*@egen*/ Reference() ";"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void IfStatement() :{/*@bgen(jjtree) IfStatement */ ASTIfStatement jjtn000 = new ASTIfStatement(this, JJTIFSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) IfStatement */ try { /*@egen*/ "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void WhileStatement() : {/*@bgen(jjtree) WhileStatement */ ASTWhileStatement jjtn000 = new ASTWhileStatement(this, JJTWHILESTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) WhileStatement */ try { /*@egen*/ "while" "(" Expression() ")" Statement()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ForeachStatement() : {/*@bgen(jjtree) ForeachStatement */ ASTForeachStatement jjtn000 = new ASTForeachStatement(this, JJTFOREACHSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ForeachStatement */ try { /*@egen*/ "foreach" "(" Reference() "in" Reference() ")" Statement()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Method() : {/*@bgen(jjtree) Method */ ASTMethod jjtn000 = new ASTMethod(this, JJTMETHOD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Method */ try { /*@egen*/ Identifier() "("[ Parameter() ( "," Parameter() )* ] ")"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ArrayAccess() : {/*@bgen(jjtree) ArrayAccess */ ASTArrayAccess jjtn000 = new ASTArrayAccess(this, JJTARRAYACCESS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ArrayAccess */ try { /*@egen*/ Identifier() ("[" ( LOOKAHEAD(3) Expression() | IntegerLiteral() | Reference() ) "]")+/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void SizeMethod() : {/*@bgen(jjtree) SizeMethod */ ASTSizeMethod jjtn000 = new ASTSizeMethod(this, JJTSIZEMETHOD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) SizeMethod */ try { /*@egen*/ "size" "(" ")"/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Reference() : {/*@bgen(jjtree) Reference */ ASTReference jjtn000 = new ASTReference(this, JJTREFERENCE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Reference */ try { /*@egen*/ (LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | Identifier()) (LOOKAHEAD(2) "." ( LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | // (LOOKAHEAD(3) Method() | Identifier() | IntegerLiteral() ) (LOOKAHEAD(3) Method() | SizeMethod() | Identifier() | IntegerLiteral() ) ) )*/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Parameter() : {} { LOOKAHEAD(3) Expression() | Literal() | Reference() } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "a"-"z", "A"-"Z", "_", "$" ] > | < #DIGIT: [ "0"-"9"] > } TOKEN : { }commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/Parser.jjt100644 0 0 16540 10500374603 23324 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Jexl : Java Expression Language * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * * @version $Id: Parser.jjt 136562 2004-02-28 13:45:22Z yoavs $ */ options { MULTI=true; STATIC=false; VISITOR=true; NODE_USES_PARSER=true; } PARSER_BEGIN(Parser) package org.apache.commons.jexl.parser; import java.io.Reader; import java.io.ByteArrayInputStream; public class Parser { public SimpleNode parse(Reader reader) throws Exception { ReInit(reader); /* * lets do the 'Unique Init' in here to be * safe - it's a pain to remember */ SimpleNode tree = JexlScript(); return tree; } } PARSER_END(Parser) SKIP : /* WHITE SPACE */ { | " " | "\t" | "\n" | "\r" | "\f" } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: ()+ > | < FLOAT_LITERAL: ()+ "."()+ > } /* * Program structuring syntax follows. */ SimpleNode JexlScript() : { String name; } { ( Statement() )* { return jjtThis;} } void Block() : {} { "{" ( Statement() )* "}" } void EmptyFunction() : {} { "empty" ( Reference() | "(" Reference() ")" ) } void SizeFunction() : {} { "size" "(" Reference() ")" } void Identifier() : { Token t; } { t= { jjtThis.val = t.image; } } /* * Expression syntax follows. */ void Expression() : {} { LOOKAHEAD( PrimaryExpression() "=" ) Assignment() | ConditionalOrExpression() } void Assignment() #Assignment(2) : {} { PrimaryExpression() "=" Expression() } void ConditionalOrExpression() #void : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() #OrNode(2) | "or" ConditionalAndExpression() #OrNode(2) )* } void ConditionalAndExpression() #void : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() #AndNode(2) | "and" InclusiveOrExpression() #AndNode(2) )* } void InclusiveOrExpression() #void : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() #BitwiseOrNode(2) )* } void ExclusiveOrExpression() #void : {} { AndExpression() ( "^" AndExpression() #BitwiseXorNode(2) )* } void AndExpression() #void : {} { EqualityExpression() ( "&" EqualityExpression() #BitwiseAndNode(2) )* } void EqualityExpression() #void : {} { RelationalExpression() ( "==" RelationalExpression() #EQNode(2) | "eq" RelationalExpression() #EQNode(2) | "!=" RelationalExpression() #NENode(2) | "ne" RelationalExpression() #NENode(2) )* } void RelationalExpression() #void : {} { AdditiveExpression() ( "<" AdditiveExpression() #LTNode(2) | "lt" AdditiveExpression() #LTNode(2) | ">" AdditiveExpression() #GTNode(2) | "gt" AdditiveExpression() #GTNode(2) | "<=" AdditiveExpression() #LENode(2) | "le" AdditiveExpression() #LENode(2) | ">=" AdditiveExpression() #GENode(2) | "ge" AdditiveExpression() #GENode(2) )* } void AdditiveExpression() #void : {} { MultiplicativeExpression() ( "+" MultiplicativeExpression() #AddNode(2) | "-" MultiplicativeExpression() #SubtractNode(2) )* } void MultiplicativeExpression() #void : {} { UnaryExpression() ( "*" UnaryExpression() #MulNode(2) | "/" UnaryExpression() #DivNode(2) | "div" UnaryExpression() #DivNode(2) | "%" UnaryExpression() #ModNode(2) | "mod" UnaryExpression() #ModNode(2) )* } void UnaryExpression() #void : {} { "-" UnaryExpression() #UnaryMinusNode(1) | "~" UnaryExpression() #BitwiseComplNode(1) | "!" UnaryExpression() #NotNode(1) | "not" UnaryExpression() #NotNode(1) | PrimaryExpression() } void PrimaryExpression() #void : {} { Literal() | Reference() | "(" Expression() ")" | EmptyFunction() | SizeFunction() } void Literal() #void : { Token t; } { IntegerLiteral() | FloatLiteral() | BooleanLiteral() | StringLiteral() | NullLiteral() } void NullLiteral() : {} { "null" } void BooleanLiteral() #void : {} { "true" #TrueNode | "false" #FalseNode } void IntegerLiteral() : { Token t; } { ( t= { jjtThis.val = Integer.valueOf(t.image); } ) } void FloatLiteral() : { Token t; } { ( t= { jjtThis.val = Float.valueOf(t.image); } ) } void StringLiteral() : { Token t; } { ( t= { jjtThis.literal = t.image.substring(1,t.image.length()-1); } ) } /* * Statement syntax follows. */ void Statement() #void : {} { ";" | Block() | LOOKAHEAD( Reference() ";" ) ReferenceExpression() | LOOKAHEAD( PrimaryExpression() "=" ) StatementExpression() | ExpressionExpression() | IfStatement() | ForeachStatement() | WhileStatement() } void ExpressionExpression() : {} { Expression() ";" } void StatementExpression() : {} { Assignment() ";" } void ReferenceExpression() : {} { Reference() ";" } void IfStatement() :{} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void ForeachStatement() : {} { "foreach" "(" Reference() "in" Reference() ")" Statement() } void Method() : {} { Identifier() "("[ Parameter() ( "," Parameter() )* ] ")" } void ArrayAccess() : {} { Identifier() ("[" ( LOOKAHEAD(3) Expression() | IntegerLiteral() | Reference() ) "]")+ } void SizeMethod() : {} { "size" "(" ")" } void Reference() : {} { (LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | Identifier()) (LOOKAHEAD(2) "." ( LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | // (LOOKAHEAD(3) Method() | Identifier() | IntegerLiteral() ) (LOOKAHEAD(3) Method() | SizeMethod() | Identifier() | IntegerLiteral() ) ) )* } void Parameter() #void: {} { LOOKAHEAD(3) Expression() | Literal() | Reference() } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "a"-"z", "A"-"Z", "_", "$" ] > | < #DIGIT: [ "0"-"9"] > } TOKEN : { }commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ParserConstants.java100644 0 0 3741 10500374603 25332 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree&JavaCC: Do not edit this line. ParserConstants.java */ package org.apache.commons.jexl.parser; public interface ParserConstants { int EOF = 0; int COMMENT = 1; int INTEGER_LITERAL = 7; int FLOAT_LITERAL = 8; int IDENTIFIER = 58; int LETTER = 59; int DIGIT = 60; int STRING_LITERAL = 61; int DEFAULT = 0; String[] tokenImage = { "", "", "\" \"", "\"\\t\"", "\"\\n\"", "\"\\r\"", "\"\\f\"", "", "", "\"{\"", "\"}\"", "\"empty\"", "\"(\"", "\")\"", "\"size\"", "\"=\"", "\"||\"", "\"or\"", "\"&&\"", "\"and\"", "\"|\"", "\"^\"", "\"&\"", "\"==\"", "\"eq\"", "\"!=\"", "\"ne\"", "\"<\"", "\"lt\"", "\">\"", "\"gt\"", "\"<=\"", "\"le\"", "\">=\"", "\"ge\"", "\"+\"", "\"-\"", "\"*\"", "\"/\"", "\"div\"", "\"%\"", "\"mod\"", "\"~\"", "\"!\"", "\"not\"", "\"null\"", "\"true\"", "\"false\"", "\";\"", "\"if\"", "\"else\"", "\"while\"", "\"foreach\"", "\"in\"", "\",\"", "\"[\"", "\"]\"", "\".\"", "", "", "", "", }; } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ParserTokenManager.java100644 0 0 70510 10500374603 25747 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree&JavaCC: Do not edit this line. ParserTokenManager.java */ package org.apache.commons.jexl.parser; public class ParserTokenManager implements ParserConstants { public java.io.PrintStream debugStream = System.out; public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0) { switch (pos) { case 0: if ((active0 & 0x3ef285550a4800L) != 0L) { jjmatchedKind = 58; return 5; } return -1; case 1: if ((active0 & 0x1cf28000084800L) != 0L) { jjmatchedKind = 58; jjmatchedPos = 1; return 5; } if ((active0 & 0x22000555020000L) != 0L) return 5; return -1; case 2: if ((active0 & 0x1ce00000004800L) != 0L) { jjmatchedKind = 58; jjmatchedPos = 2; return 5; } if ((active0 & 0x128000080000L) != 0L) return 5; return -1; case 3: if ((active0 & 0x18800000000800L) != 0L) { jjmatchedKind = 58; jjmatchedPos = 3; return 5; } if ((active0 & 0x4600000004000L) != 0L) return 5; return -1; case 4: if ((active0 & 0x10000000000000L) != 0L) { jjmatchedKind = 58; jjmatchedPos = 4; return 5; } if ((active0 & 0x8800000000800L) != 0L) return 5; return -1; case 5: if ((active0 & 0x10000000000000L) != 0L) { jjmatchedKind = 58; jjmatchedPos = 5; return 5; } return -1; default: return -1; } } private final int jjStartNfa_0(int pos, long active0) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } private final int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private final int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } private final int jjMoveStringLiteralDfa0_0() { switch (curChar) { case 33: jjmatchedKind = 43; return jjMoveStringLiteralDfa1_0(0x2000000L); case 37: return jjStopAtPos(0, 40); case 38: jjmatchedKind = 22; return jjMoveStringLiteralDfa1_0(0x40000L); case 40: return jjStopAtPos(0, 12); case 41: return jjStopAtPos(0, 13); case 42: return jjStopAtPos(0, 37); case 43: return jjStopAtPos(0, 35); case 44: return jjStopAtPos(0, 54); case 45: return jjStopAtPos(0, 36); case 46: return jjStopAtPos(0, 57); case 47: return jjStopAtPos(0, 38); case 59: return jjStopAtPos(0, 48); case 60: jjmatchedKind = 27; return jjMoveStringLiteralDfa1_0(0x80000000L); case 61: jjmatchedKind = 15; return jjMoveStringLiteralDfa1_0(0x800000L); case 62: jjmatchedKind = 29; return jjMoveStringLiteralDfa1_0(0x200000000L); case 91: return jjStopAtPos(0, 55); case 93: return jjStopAtPos(0, 56); case 94: return jjStopAtPos(0, 21); case 97: return jjMoveStringLiteralDfa1_0(0x80000L); case 100: return jjMoveStringLiteralDfa1_0(0x8000000000L); case 101: return jjMoveStringLiteralDfa1_0(0x4000001000800L); case 102: return jjMoveStringLiteralDfa1_0(0x10800000000000L); case 103: return jjMoveStringLiteralDfa1_0(0x440000000L); case 105: return jjMoveStringLiteralDfa1_0(0x22000000000000L); case 108: return jjMoveStringLiteralDfa1_0(0x110000000L); case 109: return jjMoveStringLiteralDfa1_0(0x20000000000L); case 110: return jjMoveStringLiteralDfa1_0(0x300004000000L); case 111: return jjMoveStringLiteralDfa1_0(0x20000L); case 115: return jjMoveStringLiteralDfa1_0(0x4000L); case 116: return jjMoveStringLiteralDfa1_0(0x400000000000L); case 119: return jjMoveStringLiteralDfa1_0(0x8000000000000L); case 123: return jjStopAtPos(0, 9); case 124: jjmatchedKind = 20; return jjMoveStringLiteralDfa1_0(0x10000L); case 125: return jjStopAtPos(0, 10); case 126: return jjStopAtPos(0, 42); default: return jjMoveNfa_0(3, 0); } } private final int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch (curChar) { case 38: if ((active0 & 0x40000L) != 0L) return jjStopAtPos(1, 18); break; case 61: if ((active0 & 0x800000L) != 0L) return jjStopAtPos(1, 23); else if ((active0 & 0x2000000L) != 0L) return jjStopAtPos(1, 25); else if ((active0 & 0x80000000L) != 0L) return jjStopAtPos(1, 31); else if ((active0 & 0x200000000L) != 0L) return jjStopAtPos(1, 33); break; case 97: return jjMoveStringLiteralDfa2_0(active0, 0x800000000000L); case 101: if ((active0 & 0x4000000L) != 0L) return jjStartNfaWithStates_0(1, 26, 5); else if ((active0 & 0x100000000L) != 0L) return jjStartNfaWithStates_0(1, 32, 5); else if ((active0 & 0x400000000L) != 0L) return jjStartNfaWithStates_0(1, 34, 5); break; case 102: if ((active0 & 0x2000000000000L) != 0L) return jjStartNfaWithStates_0(1, 49, 5); break; case 104: return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L); case 105: return jjMoveStringLiteralDfa2_0(active0, 0x8000004000L); case 108: return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L); case 109: return jjMoveStringLiteralDfa2_0(active0, 0x800L); case 110: if ((active0 & 0x20000000000000L) != 0L) return jjStartNfaWithStates_0(1, 53, 5); return jjMoveStringLiteralDfa2_0(active0, 0x80000L); case 111: return jjMoveStringLiteralDfa2_0(active0, 0x10120000000000L); case 113: if ((active0 & 0x1000000L) != 0L) return jjStartNfaWithStates_0(1, 24, 5); break; case 114: if ((active0 & 0x20000L) != 0L) return jjStartNfaWithStates_0(1, 17, 5); return jjMoveStringLiteralDfa2_0(active0, 0x400000000000L); case 116: if ((active0 & 0x10000000L) != 0L) return jjStartNfaWithStates_0(1, 28, 5); else if ((active0 & 0x40000000L) != 0L) return jjStartNfaWithStates_0(1, 30, 5); break; case 117: return jjMoveStringLiteralDfa2_0(active0, 0x200000000000L); case 124: if ((active0 & 0x10000L) != 0L) return jjStopAtPos(1, 16); break; default: break; } return jjStartNfa_0(0, active0); } private final int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); return 2; } switch (curChar) { case 100: if ((active0 & 0x80000L) != 0L) return jjStartNfaWithStates_0(2, 19, 5); else if ((active0 & 0x20000000000L) != 0L) return jjStartNfaWithStates_0(2, 41, 5); break; case 105: return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L); case 108: return jjMoveStringLiteralDfa3_0(active0, 0xa00000000000L); case 112: return jjMoveStringLiteralDfa3_0(active0, 0x800L); case 114: return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L); case 115: return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L); case 116: if ((active0 & 0x100000000000L) != 0L) return jjStartNfaWithStates_0(2, 44, 5); break; case 117: return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L); case 118: if ((active0 & 0x8000000000L) != 0L) return jjStartNfaWithStates_0(2, 39, 5); break; case 122: return jjMoveStringLiteralDfa3_0(active0, 0x4000L); default: break; } return jjStartNfa_0(1, active0); } private final int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); return 3; } switch (curChar) { case 101: if ((active0 & 0x4000L) != 0L) return jjStartNfaWithStates_0(3, 14, 5); else if ((active0 & 0x400000000000L) != 0L) return jjStartNfaWithStates_0(3, 46, 5); else if ((active0 & 0x4000000000000L) != 0L) return jjStartNfaWithStates_0(3, 50, 5); return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L); case 108: if ((active0 & 0x200000000000L) != 0L) return jjStartNfaWithStates_0(3, 45, 5); return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L); case 115: return jjMoveStringLiteralDfa4_0(active0, 0x800000000000L); case 116: return jjMoveStringLiteralDfa4_0(active0, 0x800L); default: break; } return jjStartNfa_0(2, active0); } private final int jjMoveStringLiteralDfa4_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); return 4; } switch (curChar) { case 97: return jjMoveStringLiteralDfa5_0(active0, 0x10000000000000L); case 101: if ((active0 & 0x800000000000L) != 0L) return jjStartNfaWithStates_0(4, 47, 5); else if ((active0 & 0x8000000000000L) != 0L) return jjStartNfaWithStates_0(4, 51, 5); break; case 121: if ((active0 & 0x800L) != 0L) return jjStartNfaWithStates_0(4, 11, 5); break; default: break; } return jjStartNfa_0(3, active0); } private final int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch (curChar) { case 99: return jjMoveStringLiteralDfa6_0(active0, 0x10000000000000L); default: break; } return jjStartNfa_0(4, active0); } private final int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch (curChar) { case 104: if ((active0 & 0x10000000000000L) != 0L) return jjStartNfaWithStates_0(6, 52, 5); break; default: break; } return jjStartNfa_0(5, active0); } private final void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private final void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private final void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private final void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } private final void jjCheckNAddStates(int start) { jjCheckNAdd(jjnextStates[start]); jjCheckNAdd(jjnextStates[start + 1]); } static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private final int jjMoveNfa_0(int startState, int curPos) { int[] nextStates; int startsAt = 0; jjnewStateCnt = 17; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; MatchLoop: do { switch (jjstateSet[--i]) { case 3: if ((0x3ff000000000000L & l) != 0L) { if (kind > 7) kind = 7; jjCheckNAddStates(0, 2); } else if (curChar == 39) jjCheckNAddTwoStates(10, 11); else if (curChar == 34) jjCheckNAddTwoStates(7, 8); else if (curChar == 36) { if (kind > 58) kind = 58; jjCheckNAdd(5); } else if (curChar == 35) jjstateSet[jjnewStateCnt++] = 0; break; case 0: if (curChar == 35) jjCheckNAddTwoStates(1, 2); break; case 1: if ((0xfffffffbffffdbffL & l) != 0L) jjCheckNAddTwoStates(1, 2); break; case 2: if ((0x2400L & l) != 0L) kind = 1; break; case 4: if (curChar != 36) break; if (kind > 58) kind = 58; jjCheckNAdd(5); break; case 5: if ((0x3ff001000000000L & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAdd(5); break; case 6: if (curChar == 34) jjCheckNAddTwoStates(7, 8); break; case 7: if ((0xfffffffbffffdbffL & l) != 0L) jjCheckNAddTwoStates(7, 8); break; case 8: if (curChar == 34 && kind > 61) kind = 61; break; case 9: if (curChar == 39) jjCheckNAddTwoStates(10, 11); break; case 10: if ((0xffffff7fffffdbffL & l) != 0L) jjCheckNAddTwoStates(10, 11); break; case 11: if (curChar == 39 && kind > 61) kind = 61; break; case 12: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddStates(0, 2); break; case 13: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAdd(13); break; case 14: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(14, 15); break; case 15: if (curChar == 46) jjCheckNAdd(16); break; case 16: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 8) kind = 8; jjCheckNAdd(16); break; default: break; } } while (i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); MatchLoop: do { switch (jjstateSet[--i]) { case 3: case 5: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 58) kind = 58; jjCheckNAdd(5); break; case 1: jjAddStates(3, 4); break; case 7: jjAddStates(5, 6); break; case 10: jjAddStates(7, 8); break; default: break; } } while (i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch (jjstateSet[--i]) { case 1: if ((jjbitVec0[i2] & l2) != 0L) jjAddStates(3, 4); break; case 7: if ((jjbitVec0[i2] & l2) != 0L) jjAddStates(5, 6); break; case 10: if ((jjbitVec0[i2] & l2) != 0L) jjAddStates(7, 8); break; default: break; } } while (i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch (java.io.IOException e) { return curPos; } } } static final int[] jjnextStates = { 13, 14, 15, 1, 2, 7, 8, 10, 11, }; public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, "\173", "\175", "\145\155\160\164\171", "\50", "\51", "\163\151\172\145", "\75", "\174\174", "\157\162", "\46\46", "\141\156\144", "\174", "\136", "\46", "\75\75", "\145\161", "\41\75", "\156\145", "\74", "\154\164", "\76", "\147\164", "\74\75", "\154\145", "\76\75", "\147\145", "\53", "\55", "\52", "\57", "\144\151\166", "\45", "\155\157\144", "\176", "\41", "\156\157\164", "\156\165\154\154", "\164\162\165\145", "\146\141\154\163\145", "\73", "\151\146", "\145\154\163\145", "\167\150\151\154\145", "\146\157\162\145\141\143\150", "\151\156", "\54", "\133", "\135", "\56", null, null, null, null, }; public static final String[] lexStateNames = { "DEFAULT", }; static final long[] jjtoToken = { 0x27ffffffffffff81L, }; static final long[] jjtoSkip = { 0x7eL, }; private SimpleCharStream input_stream; private final int[] jjrounds = new int[17]; private final int[] jjstateSet = new int[34]; protected char curChar; public ParserTokenManager(SimpleCharStream stream) { if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } public ParserTokenManager(SimpleCharStream stream, int lexState) { this(stream); SwitchTo(lexState); } public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private final void ReInitRounds() { int i; jjround = 0x80000001; for (i = 17; i-- > 0;) jjrounds[i] = 0x80000000; } public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } private final Token jjFillToken() { Token t = Token.newToken(jjmatchedKind); t.kind = jjmatchedKind; String im = jjstrLiteralImages[jjmatchedKind]; t.image = (im == null) ? input_stream.GetImage() : im; t.beginLine = input_stream.getBeginLine(); t.beginColumn = input_stream.getBeginColumn(); t.endLine = input_stream.getEndLine(); t.endColumn = input_stream.getEndColumn(); return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; public final Token getNextToken() { int kind; Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop: for (;;) { try { curChar = input_stream.BeginToken(); } catch (java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } try { input_stream.backup(0); while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); return matchedToken; } else { continue EOFLoop; } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ParserTreeConstants.java100644 0 0 5414 10500374603 26151 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ParserTreeConstants.java */ package org.apache.commons.jexl.parser; public interface ParserTreeConstants { int JJTJEXLSCRIPT = 0; int JJTBLOCK = 1; int JJTEMPTYFUNCTION = 2; int JJTSIZEFUNCTION = 3; int JJTIDENTIFIER = 4; int JJTEXPRESSION = 5; int JJTASSIGNMENT = 6; int JJTVOID = 7; int JJTORNODE = 8; int JJTANDNODE = 9; int JJTBITWISEORNODE = 10; int JJTBITWISEXORNODE = 11; int JJTBITWISEANDNODE = 12; int JJTEQNODE = 13; int JJTNENODE = 14; int JJTLTNODE = 15; int JJTGTNODE = 16; int JJTLENODE = 17; int JJTGENODE = 18; int JJTADDNODE = 19; int JJTSUBTRACTNODE = 20; int JJTMULNODE = 21; int JJTDIVNODE = 22; int JJTMODNODE = 23; int JJTUNARYMINUSNODE = 24; int JJTBITWISECOMPLNODE = 25; int JJTNOTNODE = 26; int JJTNULLLITERAL = 27; int JJTTRUENODE = 28; int JJTFALSENODE = 29; int JJTINTEGERLITERAL = 30; int JJTFLOATLITERAL = 31; int JJTSTRINGLITERAL = 32; int JJTEXPRESSIONEXPRESSION = 33; int JJTSTATEMENTEXPRESSION = 34; int JJTREFERENCEEXPRESSION = 35; int JJTIFSTATEMENT = 36; int JJTWHILESTATEMENT = 37; int JJTFOREACHSTATEMENT = 38; int JJTMETHOD = 39; int JJTARRAYACCESS = 40; int JJTSIZEMETHOD = 41; int JJTREFERENCE = 42; String[] jjtNodeName = {"JexlScript", "Block", "EmptyFunction", "SizeFunction", "Identifier", "Expression", "Assignment", "void", "OrNode", "AndNode", "BitwiseOrNode", "BitwiseXorNode", "BitwiseAndNode", "EQNode", "NENode", "LTNode", "GTNode", "LENode", "GENode", "AddNode", "SubtractNode", "MulNode", "DivNode", "ModNode", "UnaryMinusNode", "BitwiseComplNode", "NotNode", "NullLiteral", "TrueNode", "FalseNode", "IntegerLiteral", "FloatLiteral", "StringLiteral", "ExpressionExpression", "StatementExpression", "ReferenceExpression", "IfStatement", "WhileStatement", "ForeachStatement", "Method", "ArrayAccess", "SizeMethod", "Reference", }; } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/ParserVisitor.java100644 0 0 6062 10500374603 25014 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ParserVisitor.java */ package org.apache.commons.jexl.parser; public interface ParserVisitor { Object visit(SimpleNode node, Object data); Object visit(ASTJexlScript node, Object data); Object visit(ASTBlock node, Object data); Object visit(ASTEmptyFunction node, Object data); Object visit(ASTSizeFunction node, Object data); Object visit(ASTIdentifier node, Object data); Object visit(ASTExpression node, Object data); Object visit(ASTAssignment node, Object data); Object visit(ASTOrNode node, Object data); Object visit(ASTAndNode node, Object data); Object visit(ASTBitwiseOrNode node, Object data); Object visit(ASTBitwiseXorNode node, Object data); Object visit(ASTBitwiseAndNode node, Object data); Object visit(ASTEQNode node, Object data); Object visit(ASTNENode node, Object data); Object visit(ASTLTNode node, Object data); Object visit(ASTGTNode node, Object data); Object visit(ASTLENode node, Object data); Object visit(ASTGENode node, Object data); Object visit(ASTAddNode node, Object data); Object visit(ASTSubtractNode node, Object data); Object visit(ASTMulNode node, Object data); Object visit(ASTDivNode node, Object data); Object visit(ASTModNode node, Object data); Object visit(ASTUnaryMinusNode node, Object data); Object visit(ASTBitwiseComplNode node, Object data); Object visit(ASTNotNode node, Object data); Object visit(ASTNullLiteral node, Object data); Object visit(ASTTrueNode node, Object data); Object visit(ASTFalseNode node, Object data); Object visit(ASTIntegerLiteral node, Object data); Object visit(ASTFloatLiteral node, Object data); Object visit(ASTStringLiteral node, Object data); Object visit(ASTExpressionExpression node, Object data); Object visit(ASTStatementExpression node, Object data); Object visit(ASTReferenceExpression node, Object data); Object visit(ASTIfStatement node, Object data); Object visit(ASTWhileStatement node, Object data); Object visit(ASTForeachStatement node, Object data); Object visit(ASTMethod node, Object data); Object visit(ASTArrayAccess node, Object data); Object visit(ASTSizeMethod node, Object data); Object visit(ASTReference node, Object data); }commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/SimpleCharStream.java100644 0 0 25247 10500374603 25431 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 2.1 */ package org.apache.commons.jexl.parser; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public final class SimpleCharStream { public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; public int bufpos = -1; private int bufline[]; private int bufcolumn[]; private int column = 0; private int line = 1; private boolean prevCharIsCR = false; private boolean prevCharIsLF = false; private java.io.Reader inputStream; private char[] buffer; private int maxNextCharInd = 0; private int inBuf = 0; private final void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } private final void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch (java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } public final char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } private final void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r': prevCharIsCR = true; break; case '\n': prevCharIsLF = true; break; case '\t': column--; column += (8 - (column & 07)); break; default: break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } public final char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return (c); } /** * @deprecated * @see #getEndColumn */ public final int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public final int getLine() { return bufline[bufpos]; } public final int getEndColumn() { return bufcolumn[bufpos]; } public final int getEndLine() { return bufline[bufpos]; } public final int getBeginColumn() { return bufcolumn[tokenBegin]; } public final int getBeginLine() { return bufline[tokenBegin]; } public final void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public final String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } public final char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/SimpleNode.java100644 0 0 13720 10500374603 24256 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * A Useful implementation of {@link Node}. Mostly autogenerated by javacc * * @author Geir Magnusson Jr. * @version $Id: SimpleNode.java 398328 2006-04-30 12:46:59Z dion $ */ public class SimpleNode implements Node { /** parent node. */ protected Node parent; /** children of this node. */ protected Node[] children; /** id of the node. */ protected int id; /** parser that created the node. */ protected Parser parser; /** * Create the node given an id. * * @param i node id. */ public SimpleNode(int i) { id = i; } /** * Create a node with the given parser and id. * * @param p a parser. * @param i node id. */ public SimpleNode(Parser p, int i) { this(i); parser = p; } /** * Start of the node. */ public void jjtOpen() { } /** * End of the node. */ public void jjtClose() { } /** {@inheritDoc} */ public void jjtSetParent(Node n) { parent = n; } /** {@inheritDoc} */ public Node jjtGetParent() { return parent; } /** {@inheritDoc} */ public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node[] c = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } /** {@inheritDoc} */ public Node jjtGetChild(int i) { return children[i]; } /** {@inheritDoc} */ public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } /** * Accept the visitor. * * @param visitor a {@link ParserVisitor}. * @param data data to be passed along to the visitor. * @return the value from visiting. * @see ParserVisitor#visit */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * Visit all children. * * @param visitor a {@link ParserVisitor}. * @param data data to be passed along to the visitor. * @return the value from visiting. * @see ParserVisitor#visit */ public Object childrenAccept(ParserVisitor visitor, Object data) { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } /** * Gets a string representation of the node. * @return the node name. */ public String toString() { return ParserTreeConstants.jjtNodeName[id]; } /** * Used during dumping to output the node with a prefix. * @param prefix text to prefix {@link #toString()} * @return text. */ public String toString(String prefix) { return prefix + toString(); } /** * Dump the node and all children. * @param prefix text to prefix the node output. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode) children[i]; if (n != null) { n.dump(prefix + " "); } } } } /** * basic interpret - just invoke interpret on all children. * @param pc the {@link JexlContext context} to interpret against. * @return true if interpretation worked. * @throws Exception on any error. */ public boolean interpret(JexlContext pc) throws Exception { for (int i = 0; i < jjtGetNumChildren(); i++) { SimpleNode node = (SimpleNode) jjtGetChild(i); if (!node.interpret(pc)) { return false; } } return true; } /** * Gets the value of this node. * * @param context the context to retrieve values from. * @return the value of the node. * @throws Exception when evaluating the operands fails. */ public Object value(JexlContext context) throws Exception { return null; } /** * Sets the value for the node - again, only makes sense for some nodes but * lazyness tempts me to put it here. Keeps things simple. * * @param context the context to retrieve values from. * @param value the value. * @return the result. * @throws Exception when evaluating the operands fails. */ public Object setValue(JexlContext context, Object value) throws Exception { return null; } /** * Used to let a node calcuate it's value.. * @param o the object to calculate with. * @param ctx the context to retrieve values from. * @throws Exception when calculating the value fails. * @return the result of the calculation. */ public Object execute(Object o, JexlContext ctx) throws Exception { return null; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/Token.java100644 0 0 6677 10500374603 23274 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */ package org.apache.commons.jexl.parser; /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering system * is determined by JavaCCParser, and a table of these numbers is stored in * the file ...Constants.java. */ public int kind; /** * beginLine and beginColumn describe the position of the first character of * this token; endLine and endColumn describe the position of the last * character of this token. */ public int beginLine, beginColumn, endLine, endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the token * manager has not read tokens beyond this one, this field is set to null. * This is true only if this token is also a regular token. Otherwise, see * below for a description of the contents of this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. When * there are more than one such special token, this field refers to the last * of these special tokens, which in turn refers to the next previous * special token through its specialToken field, and so on until the first * special token (whose specialToken field is null). The next fields of * special tokens refer to other special tokens that immediately follow it * (without an intervening regular token). If there is no such token, this * field is null. */ public Token specialToken; /** * Returns the image. */ public final String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you can * create and return subclass objects based on the value of ofKind. Simply * add the cases to the switch for all those special cases. For example, if * you have a subclass of Token called IDToken that you want to create if * ofKind is ID, simlpy add something like : * * case MyParserConstants.ID : return new IDToken(); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ public static final Token newToken(int ofKind) { switch (ofKind) { default: return new Token(); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/parser/TokenMgrError.java100644 0 0 12335 10500374603 24760 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */ package org.apache.commons.jexl.parser; public class TokenMgrError extends Error { /** serialization version id jdk13 generated. */ static final long serialVersionUID = 2843513002462329650L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token * manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have one of the * above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0: continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the token * manager to indicate a lexical error. Parameters : EOFSeen : indicates if * EOF caused the lexicl error curLexState : lexical state in which this * error occured errorLine : line number when the error occured errorColumn : * column number when the error occured errorAfter : prefix that was seen * before this error occured curchar : the offending character Note: You can * customize the lexical error message by modifying this method. */ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error * messages. For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE * are not of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/resolver/FlatResolver.java100644 0 0 4261 10500374603 25154 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.resolver; import org.apache.commons.jexl.JexlExprResolver; import org.apache.commons.jexl.JexlContext; /** * Simple resolver to try the expression as-is from the context. * * For example, you could resolve ant-ish properties (foo.bar.woogie) * using this... * * hint, hint... * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: FlatResolver.java 397542 2006-04-27 13:43:47Z dion $ */ public class FlatResolver implements JexlExprResolver { /** * Flag to return NO_VALUE on null from context. * this allows jexl to try to evaluate */ protected boolean noValOnNull = true; /** * Default CTOR. */ public FlatResolver() { } /** * CTOR that lets you override the default behavior of * noValOnNull, which is true. (jexl gets a shot after if null) * * @param valOnNull Whether NO_VALUE will be returned instead of null. */ public FlatResolver(boolean valOnNull) { noValOnNull = valOnNull; } /** * Try to resolve expression as-is. * * @param context The context for resolution. * @param expression The flat expression. * @return The resolved value. */ public Object evaluate(JexlContext context, String expression) { Object val = context.getVars().get(expression); if (val == null && noValOnNull) { return JexlExprResolver.NO_VALUE; } return val; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/Script.java100644 0 0 3241 10500374603 22144 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; /** *

A JEXL Script.

*

A script is some valid JEXL syntax to be executed with * a given set of {@link JexlContext variables}.

*

A script is a group of statements, separated by semicolons.

*

The statements can be blocks (curly braces containing code), * Control statements such as if and while * as well as expressions and assignment statements.

* * @since 1.1 */ public interface Script { /** * Executes the script with the variables contained in the * supplied {@link JexlContext}. * * @param context A JexlContext containing variables. * @return The result of this script, usually the result of * the last statement. * @throws Exception on any script parse or execution error. */ Object execute(JexlContext context) throws Exception; /** * Returns the text of this Script. * @return The script to be executed. */ String getText(); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/ScriptFactory.java100644 0 0 16340 10500374603 23520 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringReader; import java.net.URL; import java.net.URLConnection; import org.apache.commons.jexl.parser.ASTJexlScript; import org.apache.commons.jexl.parser.ParseException; import org.apache.commons.jexl.parser.Parser; import org.apache.commons.jexl.parser.SimpleNode; import org.apache.commons.jexl.parser.TokenMgrError; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** *

* Creates {@link Script}s. To create a JEXL Script, pass * valid JEXL syntax to the static createScript() method: *

* *
 * String jexl = "y = x * 12 + 44; y = y * 4;";
 * Script script = ScriptFactory.createScript( jexl );
 * 
* *

* When an {@link Script} is created, the JEXL syntax is * parsed and verified. *

* @since 1.1 * @version $Id: ScriptFactory.java 429175 2006-08-06 19:05:23Z rahul $ */ public class ScriptFactory { /** The Log to which all ScriptFactory messages will be logged.*/ protected static Log log = LogFactory.getLog("org.apache.commons.jexl.ScriptFactory"); /** * The singleton ScriptFactory also holds a single instance of * {@link Parser}. When parsing expressions, ScriptFactory * synchronizes on Parser. */ protected static Parser parser = new Parser(new StringReader(";")); /** * ScriptFactory is a singleton and this is the private * instance fufilling that pattern. */ protected static ScriptFactory factory = new ScriptFactory(); /** * Private constructor, the single instance is always obtained * with a call to getInstance(). */ private ScriptFactory() { } /** * Returns the single instance of ScriptFactory. * @return the instance of ScriptFactory. */ protected static ScriptFactory getInstance() { return factory; } /** * Creates a Script from a String containing valid JEXL syntax. * This method parses the script which validates the syntax. * * @param scriptText A String containing valid JEXL syntax * @return A {@link Script} which can be executed with a * {@link JexlContext}. * @throws Exception An exception can be thrown if there is a * problem parsing the script. */ public static Script createScript(String scriptText) throws Exception { return getInstance().createNewScript(scriptText); } /** * Creates a Script from a {@link File} containing valid JEXL syntax. * This method parses the script and validates the syntax. * * @param scriptFile A {@link File} containing valid JEXL syntax. * Must not be null. Must be a readable file. * @return A {@link Script} which can be executed with a * {@link JexlContext}. * @throws Exception An exception can be thrown if there is a problem * parsing the script. */ public static Script createScript(File scriptFile) throws Exception { if (scriptFile == null) { throw new NullPointerException("scriptFile is null"); } if (!scriptFile.canRead()) { throw new IOException("Can't read scriptFile (" + scriptFile.getCanonicalPath() + ")"); } BufferedReader reader = new BufferedReader(new FileReader(scriptFile)); return createScript(readerToString(reader)); } /** * Creates a Script from a {@link URL} containing valid JEXL syntax. * This method parses the script and validates the syntax. * * @param scriptUrl A {@link URL} containing valid JEXL syntax. * Must not be null. Must be a readable file. * @return A {@link Script} which can be executed with a * {@link JexlContext}. * @throws Exception An exception can be thrown if there is a problem * parsing the script. */ public static Script createScript(URL scriptUrl) throws Exception { if (scriptUrl == null) { throw new NullPointerException("scriptUrl is null"); } URLConnection connection = scriptUrl.openConnection(); BufferedReader reader = new BufferedReader( new InputStreamReader(connection.getInputStream())); return createScript(readerToString(reader)); } /** * Creates a new Script based on the string. * * @param scriptText valid Jexl script * @return Script a new script * @throws Exception for a variety of reasons - mostly malformed scripts */ protected Script createNewScript(String scriptText) throws Exception { String cleanText = cleanScript(scriptText); SimpleNode script; // Parse the Expression synchronized (parser) { log.debug("Parsing script: " + cleanText); try { script = parser.parse(new StringReader(cleanText)); } catch (TokenMgrError tme) { throw new ParseException(tme.getMessage()); } } if (script instanceof ASTJexlScript) { return new ScriptImpl(cleanText, (ASTJexlScript) script); } else { throw new IllegalStateException("Parsed script is not " + "an ASTJexlScript"); } } /** * @todo move to ParseUtils? * Trims the expression and adds a semi-colon if missing. * @param script to clean * @return trimmed expression ending in a semi-colon */ private String cleanScript(String script) { String expr = script.trim(); if (!expr.endsWith(";")) { expr += ";"; } return expr; } /** * Read a buffered reader into a StringBuffer and return a String with * the contents of the reader. * @param reader to be read. * @return the contents of the reader as a String. * @throws IOException on any error reading the reader. */ private static String readerToString(BufferedReader reader) throws IOException { StringBuffer buffer = new StringBuffer(); try { String line = null; while ((line = reader.readLine()) != null) { buffer.append(line).append('\n'); } return buffer.toString(); } finally { reader.close(); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/ScriptImpl.java100644 0 0 3106 10500374603 22766 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import org.apache.commons.jexl.parser.ASTJexlScript; /** * Simple script implementation. * @since 1.1 */ class ScriptImpl implements Script { /** text of the script. */ private final String text; /** syntax tree. */ private final ASTJexlScript parsedScript; /** * Create a new Script from the given string and parsed syntax. * @param scriptText the text of the script. * @param scriptTree the parsed script. */ public ScriptImpl(String scriptText, ASTJexlScript scriptTree) { text = scriptText; parsedScript = scriptTree; } /** * {@inheritDoc} */ public Object execute(JexlContext context) throws Exception { // TODO Auto-generated method stub return parsedScript.value(context); } /** * {@inheritDoc} */ public String getText() { return text; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/AbstractExecutor.java100644 0 0 4277 10500374603 25151 0ustar 0 0 /* * Copyright 2000-2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.logging.Log; /** * Abstract class that is used to execute an arbitrary * method that is in introspected. This is the superclass * for the GetExecutor and PropertyExecutor. * * @since 1.0 * @author Jason van Zyl * @author Geir Magnusson Jr. * @version $Id: AbstractExecutor.java 398171 2006-04-29 14:57:29Z dion $ */ public abstract class AbstractExecutor { /** The executor instance log. */ protected Log rlog = null; /** * Method to be executed. */ protected Method method = null; /** * Execute method against context. * * @param o The owner. * @return The return value. * @throws IllegalAccessException Method is inaccessible. * @throws InvocationTargetException Method body throws an exception. */ public abstract Object execute(Object o) throws IllegalAccessException, InvocationTargetException; /** * Tell whether the executor is alive by looking * at the value of the method. * * @return boolean Whether the executor is alive. */ public boolean isAlive() { return (method != null); } /** * Get the method to be executed. * * @return Method The method to be executed. */ public Method getMethod() { return method; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/ArrayIterator.java100644 0 0 6340 10500374603 24450 0ustar 0 0 /* * Copyright 1999-2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import java.util.Iterator; import java.util.NoSuchElementException; import java.lang.reflect.Array; /** *

* An Iterator wrapper for an Object[]. This will * allow us to deal with all array like structures * in a consistent manner. *

*

* WARNING : this class's operations are NOT synchronized. * It is meant to be used in a single thread, newly created * for each use in the #foreach() directive. * If this is used or shared, synchronize in the * next() method. *

* * @since 1.0 * @author Jason van Zyl * @author Geir Magnusson Jr. * @version $Id: ArrayIterator.java 398329 2006-04-30 12:51:43Z dion $ */ public class ArrayIterator implements Iterator { /** * The objects to iterate over. */ private final Object array; /** * The current position and size in the array. */ private int pos; /** * The size of the array. */ private final int size; /** * Creates a new iterator instance for the specified array. * * @param arr The array for which an iterator is desired. */ public ArrayIterator(Object arr) { /* * if this isn't an array, then throw. Note that this is * for internal use - so this should never happen - if it does * we screwed up. */ if (!arr.getClass().isArray()) { throw new IllegalArgumentException("Programmer error :" + " internal ArrayIterator invoked w/o array"); } array = arr; pos = 0; size = Array.getLength(array); } /** * Move to next element in the array. * * @return The next object in the array. */ public Object next() { if (pos < size) { return Array.get(array, pos++); } /* * we screwed up... */ throw new NoSuchElementException("No more elements: " + pos + " / " + size); } /** * Check to see if there is another element in the array. * * @return Whether there is another element. */ public boolean hasNext() { return (pos < size); } /** * No op--merely added to satify the Iterator interface. */ public void remove() { throw new UnsupportedOperationException(); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/BooleanPropertyExecutor.java100644 0 0 5604 10500374603 26525 0ustar 0 0 /* * Copyright 2000-2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import org.apache.commons.logging.Log; /** * Handles discovery and valuation of a * boolean object property, of the * form public boolean is<Property> when executed. * * We do this separately as to preserve the current * quasi-broken semantics of get <as is property> * get<flip 1st char> get("property") and now followed * by is<Property>. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: BooleanPropertyExecutor.java 398171 2006-04-29 14:57:29Z dion $ */ public class BooleanPropertyExecutor extends PropertyExecutor { /** * Constructor. * * @param rlog The instance log. * @param is The JEXL introspector. * @param clazz The class being analyzed. * @param property The boolean property. */ public BooleanPropertyExecutor(Log rlog, org.apache.commons.jexl.util.introspection.Introspector is, Class clazz, String property) { super(rlog, is, clazz, property); } /** * Locate the getter method for this boolean property. * * @param clazz The class being analyzed. * @param property Name of boolean property. */ protected void discover(Class clazz, String property) { try { char c; StringBuffer sb; Object[] params = {}; /* * now look for a boolean isFoo */ sb = new StringBuffer("is"); sb.append(property); c = sb.charAt(2); if (Character.isLowerCase(c)) { sb.setCharAt(2, Character.toUpperCase(c)); } methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); if (method != null) { /* * now, this has to return a boolean */ if (method.getReturnType() == Boolean.TYPE) { return; } method = null; } } catch (Exception e) { rlog.error("PROGRAMMER ERROR : BooleanPropertyExector() : " + e); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/Coercion.java100644 0 0 12300 10500374603 23432 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; /** * Coercion utilities for the JSTL EL-like coercion. * * @since 1.0 * @author Geir Magnusson Jr. */ public class Coercion { /** * Coerce to a Boolean. * * @param val Object to be coerced. * @return The Boolean coerced value, or null if none possible. */ public static Boolean coerceBoolean(Object val) { if (val == null) { return Boolean.FALSE; } else if (val instanceof Boolean) { return (Boolean) val; } else if (val instanceof String) { return Boolean.valueOf((String) val); } return null; } /** * Coerce to a Integer. * * @param val Object to be coerced. * @return The Integer coerced value. * @throws Exception If Integer coercion fails. */ public static Integer coerceInteger(Object val) throws Exception { if (val == null) { return new Integer(0); } else if (val instanceof String) { if ("".equals(val)) { return new Integer(0); } return Integer.valueOf((String) val); } else if (val instanceof Character) { return new Integer(((Character) val).charValue()); } else if (val instanceof Boolean) { throw new Exception("Boolean->Integer coercion exception"); } else if (val instanceof Number) { return new Integer(((Number) val).intValue()); } throw new Exception("Integer coercion exception"); } /** * Coerce to a Long. * * @param val Object to be coerced. * @return The Long coerced value. * @throws Exception If Long coercion fails. */ public static Long coerceLong(Object val) throws Exception { if (val == null) { return new Long(0); } else if (val instanceof String) { if ("".equals(val)) { return new Long(0); } return Long.valueOf((String) val); } else if (val instanceof Character) { return new Long(((Character) val).charValue()); } else if (val instanceof Boolean) { throw new Exception("Boolean->Long coercion exception"); } else if (val instanceof Number) { return new Long(((Number) val).longValue()); } throw new Exception("Long coercion exception"); } /** * Coerce to a Double. * * @param val Object to be coerced. * @return The Double coerced value. * @throws Exception If Double coercion fails. */ public static Double coerceDouble(Object val) throws Exception { if (val == null) { return new Double(0); } else if (val instanceof String) { if ("".equals(val)) { return new Double(0); } /* * the spec seems to be iffy about this. Going to give it a wack * anyway */ return new Double((String) val); } else if (val instanceof Character) { int i = ((Character) val).charValue(); return new Double(Double.parseDouble(String.valueOf(i))); } else if (val instanceof Boolean) { throw new Exception("Boolean->Double coercion exception"); } else if (val instanceof Double) { return (Double) val; } else if (val instanceof Number) { //The below construct is used rather than ((Number)val).doubleValue() to ensure //equality between comparint new Double( 6.4 / 3 ) and the jexl expression of 6.4 / 3 return new Double(Double.parseDouble(String.valueOf(val))); } throw new Exception("Double coercion exception"); } /** * Is Object a floating point number. * * @param o Object to be analyzed. * @return true if it is a Float or a Double. */ public static boolean isFloatingPoint(final Object o) { return o instanceof Float || o instanceof Double; } /** * Is Object a whole number. * * @param o Object to be analyzed. * @return true if Integer, Long, Byte, Short or Character. */ public static boolean isNumberable(final Object o) { return o instanceof Integer || o instanceof Long || o instanceof Byte || o instanceof Short || o instanceof Character; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/EnumerationIterator.java100644 0 0 3640 10500374603 25660 0ustar 0 0 /* * Copyright 1999-2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import java.util.Iterator; import java.util.Enumeration; /** * An Iterator wrapper for an Enumeration. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: EnumerationIterator.java 398330 2006-04-30 12:52:35Z dion $ */ public class EnumerationIterator implements Iterator { /** * The enumeration to iterate over. */ private final Enumeration enumeration; /** * Creates a new iteratorwrapper instance for the specified * Enumeration. * * @param enumer The Enumeration to wrap. */ public EnumerationIterator(Enumeration enumer) { enumeration = enumer; } /** * Move to next element in the array. * * @return The next object in the array. */ public Object next() { return enumeration.nextElement(); } /** * Check to see if there is another element in the array. * * @return Whether there is another element. */ public boolean hasNext() { return enumeration.hasMoreElements(); } /** * Unimplemented. No analogy in Enumeration */ public void remove() { // not implemented } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/GetExecutor.java100644 0 0 4232 10500374603 24114 0ustar 0 0 /* * Copyright 2000-2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import java.lang.reflect.InvocationTargetException; import org.apache.commons.logging.Log; /** * Executor that simply tries to execute a get(key) * operation. This will try to find a get(key) method * for any type of object, not just objects that * implement the Map interface as was previously * the case. * * @since 1.0 * @author Jason van Zyl * @version $Id: GetExecutor.java 398171 2006-04-29 14:57:29Z dion $ */ public class GetExecutor extends AbstractExecutor { /** * Container to hold the 'key' part of * get(key). */ private final Object[] args = new Object[1]; /** * Default constructor. * * @param r The instance log. * @param ispect The JEXL introspector. * @param c The class being examined. * @param key The key for the get(key) operation. * @throws Exception Failure while trying to obtain the pertinent method. */ public GetExecutor(Log r, org.apache.commons.jexl.util.introspection.Introspector ispect, Class c, String key) throws Exception { rlog = r; args[0] = key; method = ispect.getMethod(c, "get", args); } /** * {@inheritDoc} */ public Object execute(Object o) throws IllegalAccessException, InvocationTargetException { if (method == null) { return null; } return method.invoke(o, args); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/ClassMap.java100644 0 0 35734 10500374603 26314 0ustar 0 0 /* * Copyright 2001-2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Hashtable; import java.util.Map; /** * Taken from the Velocity tree so we can be self-sufficient * * A cache of introspection information for a specific class instance. Keys * {@link java.lang.Method} objects by a concatenation of the method name and * the names of classes that make up the parameters. * * @since 1.0 * @author Jason van Zyl * @author Bob McWhirter * @author Attila Szegedi * @author Geir Magnusson Jr. * @version $Id: ClassMap.java 398459 2006-04-30 23:14:30Z dion $ */ public class ClassMap { /** represents a miss on the cached data. */ private static final class CacheMiss { } /** constant for a miss on the cached data. */ private static final CacheMiss CACHE_MISS = new CacheMiss(); /** represents null or missing arguments. */ private static final Object OBJECT = new Object(); /** * Class passed into the constructor used to as the basis for the Method * map. */ private Class clazz; /** * Cache of Methods, or CACHE_MISS, keyed by method name and actual * arguments used to find it. */ private final Map methodCache = new Hashtable(); /** map from method name and args to a {@link Method}. */ private final MethodMap methodMap = new MethodMap(); /** * Standard constructor. * @param aClass the class to deconstruct. */ public ClassMap(Class aClass) { clazz = aClass; populateMethodCache(); } /** * @return the class object whose methods are cached by this map. */ Class getCachedClass() { return clazz; } /** * Find a Method using the methodKey provided. * * Look in the methodMap for an entry. If found, it'll either be a * CACHE_MISS, in which case we simply give up, or it'll be a Method, in * which case, we return it. * * If nothing is found, then we must actually go and introspect the method * from the MethodMap. * * @param name method name * @param params method parameters * @return CACHE_MISS or a {@link Method} * @throws MethodMap.AmbiguousException if the method and parameters are ambiguous. */ public Method findMethod(String name, Object[] params) throws MethodMap.AmbiguousException { String methodKey = makeMethodKey(name, params); Object cacheEntry = methodCache.get(methodKey); if (cacheEntry == CACHE_MISS) { return null; } if (cacheEntry == null) { try { cacheEntry = methodMap.find(name, params); } catch (MethodMap.AmbiguousException ae) { /* * that's a miss :) */ methodCache.put(methodKey, CACHE_MISS); throw ae; } if (cacheEntry == null) { methodCache.put(methodKey, CACHE_MISS); } else { methodCache.put(methodKey, cacheEntry); } } // Yes, this might just be null. return (Method) cacheEntry; } /** * Populate the Map of direct hits. These are taken from all the public * methods that our class provides. */ private void populateMethodCache() { /* * get all publicly accessible methods */ Method[] methods = getAccessibleMethods(clazz); /* * map and cache them */ for (int i = 0; i < methods.length; i++) { Method method = methods[i]; /* * now get the 'public method', the method declared by a public * interface or class. (because the actual implementing class may be * a facade... */ Method publicMethod = getPublicMethod(method); /* * it is entirely possible that there is no public method for the * methods of this class (i.e. in the facade, a method that isn't on * any of the interfaces or superclass in which case, ignore it. * Otherwise, map and cache */ if (publicMethod != null) { methodMap.add(publicMethod); methodCache.put(makeMethodKey(publicMethod), publicMethod); } } } /** * Make a methodKey for the given method using the concatenation of the name * and the types of the method parameters. */ private String makeMethodKey(Method method) { Class[] parameterTypes = method.getParameterTypes(); StringBuffer methodKey = new StringBuffer(method.getName()); for (int j = 0; j < parameterTypes.length; j++) { /* * If the argument type is primitive then we want to convert our * primitive type signature to the corresponding Object type so * introspection for methods with primitive types will work * correctly. */ if (parameterTypes[j].isPrimitive()) { if (parameterTypes[j].equals(Boolean.TYPE)) methodKey.append("java.lang.Boolean"); else if (parameterTypes[j].equals(Byte.TYPE)) methodKey.append("java.lang.Byte"); else if (parameterTypes[j].equals(Character.TYPE)) methodKey.append("java.lang.Character"); else if (parameterTypes[j].equals(Double.TYPE)) methodKey.append("java.lang.Double"); else if (parameterTypes[j].equals(Float.TYPE)) methodKey.append("java.lang.Float"); else if (parameterTypes[j].equals(Integer.TYPE)) methodKey.append("java.lang.Integer"); else if (parameterTypes[j].equals(Long.TYPE)) methodKey.append("java.lang.Long"); else if (parameterTypes[j].equals(Short.TYPE)) methodKey.append("java.lang.Short"); } else { methodKey.append(parameterTypes[j].getName()); } } return methodKey.toString(); } private static String makeMethodKey(String method, Object[] params) { StringBuffer methodKey = new StringBuffer().append(method); for (int j = 0; j < params.length; j++) { Object arg = params[j]; if (arg == null) { arg = OBJECT; } methodKey.append(arg.getClass().getName()); } return methodKey.toString(); } /** * Retrieves public methods for a class. In case the class is not public, * retrieves methods with same signature as its public methods from public * superclasses and interfaces (if they exist). Basically upcasts every * method to the nearest acccessible method. */ private static Method[] getAccessibleMethods(Class clazz) { Method[] methods = clazz.getMethods(); /* * Short circuit for the (hopefully) majority of cases where the clazz * is public */ if (Modifier.isPublic(clazz.getModifiers())) { return methods; } /* * No luck - the class is not public, so we're going the longer way. */ MethodInfo[] methodInfos = new MethodInfo[methods.length]; for (int i = methods.length; i-- > 0;) { methodInfos[i] = new MethodInfo(methods[i]); } int upcastCount = getAccessibleMethods(clazz, methodInfos, 0); /* * Reallocate array in case some method had no accessible counterpart. */ if (upcastCount < methods.length) { methods = new Method[upcastCount]; } int j = 0; for (int i = 0; i < methodInfos.length; ++i) { MethodInfo methodInfo = methodInfos[i]; if (methodInfo.upcast) { methods[j++] = methodInfo.method; } } return methods; } /** * Recursively finds a match for each method, starting with the class, and * then searching the superclass and interfaces. * * @param clazz Class to check * @param methodInfos array of methods we are searching to match * @param upcastCount current number of methods we have matched * @return count of matched methods */ private static int getAccessibleMethods(Class clazz, MethodInfo[] methodInfos, int upcastCount) { int l = methodInfos.length; /* * if this class is public, then check each of the currently * 'non-upcasted' methods to see if we have a match */ if (Modifier.isPublic(clazz.getModifiers())) { for (int i = 0; i < l && upcastCount < l; ++i) { try { MethodInfo methodInfo = methodInfos[i]; if (!methodInfo.upcast) { methodInfo.tryUpcasting(clazz); upcastCount++; } } catch (NoSuchMethodException e) { /* * Intentionally ignored - it means it wasn't found in the * current class */ } } /* * Short circuit if all methods were upcast */ if (upcastCount == l) { return upcastCount; } } /* * Examine superclass */ Class superclazz = clazz.getSuperclass(); if (superclazz != null) { upcastCount = getAccessibleMethods(superclazz, methodInfos, upcastCount); /* * Short circuit if all methods were upcast */ if (upcastCount == l) { return upcastCount; } } /* * Examine interfaces. Note we do it even if superclazz == null. This is * redundant as currently java.lang.Object does not implement any * interfaces, however nothing guarantees it will not in future. */ Class[] interfaces = clazz.getInterfaces(); for (int i = interfaces.length; i-- > 0;) { upcastCount = getAccessibleMethods(interfaces[i], methodInfos, upcastCount); /* * Short circuit if all methods were upcast */ if (upcastCount == l) { return upcastCount; } } return upcastCount; } /** * For a given method, retrieves its publicly accessible counterpart. This * method will look for a method with same name and signature declared in a * public superclass or implemented interface of this method's declaring * class. This counterpart method is publicly callable. * * @param method a method whose publicly callable counterpart is requested. * @return the publicly callable counterpart method. Note that if the * parameter method is itself declared by a public class, this * method is an identity function. */ public static Method getPublicMethod(Method method) { Class clazz = method.getDeclaringClass(); /* * Short circuit for (hopefully the majority of) cases where the * declaring class is public. */ if ((clazz.getModifiers() & Modifier.PUBLIC) != 0) { return method; } return getPublicMethod(clazz, method.getName(), method.getParameterTypes()); } /** * Looks up the method with specified name and signature in the first public * superclass or implemented interface of the class. * * @param class the class whose method is sought * @param name the name of the method * @param paramTypes the classes of method parameters */ private static Method getPublicMethod(Class clazz, String name, Class[] paramTypes) { /* * if this class is public, then try to get it */ if ((clazz.getModifiers() & Modifier.PUBLIC) != 0) { try { return clazz.getMethod(name, paramTypes); } catch (NoSuchMethodException e) { /* * If the class does not have the method, then neither its * superclass nor any of its interfaces has it so quickly return * null. */ return null; } } /* * try the superclass */ Class superclazz = clazz.getSuperclass(); if (superclazz != null) { Method superclazzMethod = getPublicMethod(superclazz, name, paramTypes); if (superclazzMethod != null) { return superclazzMethod; } } /* * and interfaces */ Class[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; ++i) { Method interfaceMethod = getPublicMethod(interfaces[i], name, paramTypes); if (interfaceMethod != null) { return interfaceMethod; } } return null; } /** * Used for the iterative discovery process for public methods. */ private static final class MethodInfo { Method method; String name; Class[] parameterTypes; boolean upcast; MethodInfo(Method method) { this.method = null; name = method.getName(); parameterTypes = method.getParameterTypes(); upcast = false; } void tryUpcasting(Class clazz) throws NoSuchMethodException { method = clazz.getMethod(name, parameterTypes); name = null; parameterTypes = null; upcast = true; } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/Info.java100644 0 0 3564 10500374603 25460 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; /** * Little class to carry in info such as template name, line and column for * information error reporting from the uberspector implementations * * Taken from velocity for self-sufficiency. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: Info.java 398463 2006-04-30 23:48:42Z dion $ */ public class Info { /** line number. */ private int line; /** column number. */ private int column; /** name. */ private String templateName; /** * Create info. * @param tn template name * @param l line number * @param c column */ public Info(String tn, int l, int c) { templateName = tn; line = l; column = c; } /** * Gets the template name. * @return template name */ public String getTemplateName() { return templateName; } /** * Gets the line number. * @return line number. */ public int getLine() { return line; } /** * Gets the column number. * @return the column. */ public int getColumn() { return column; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/Introspector.java100644 0 0 10025 10500374603 27266 0ustar 0 0 /* * Copyright 2001-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import java.lang.reflect.Method; import org.apache.commons.logging.Log; /** * This basic function of this class is to return a Method * object for a particular class given the name of a method * and the parameters to the method in the form of an Object[] * * The first time the Introspector sees a * class it creates a class method map for the * class in question. Basically the class method map * is a Hashtable where Method objects are keyed by a * concatenation of the method name and the names of * classes that make up the parameters. * * For example, a method with the following signature: * * public void method(String a, StringBuffer b) * * would be mapped by the key: * * "method" + "java.lang.String" + "java.lang.StringBuffer" * * This mapping is performed for all the methods in a class * and stored for * @since 1.0 * @author Jason van Zyl * @author Bob McWhirter * @author Attila Szegedi * @author Paulo Gaspar * @version $Id: Introspector.java 398171 2006-04-29 14:57:29Z dion $ */ public class Introspector extends IntrospectorBase { /** * define a public string so that it can be looked for * if interested. */ public static final String CACHEDUMP_MSG = "Introspector : detected classloader change. Dumping cache."; /** * our engine runtime services. */ private final Log rlog; /** * Recieves our RuntimeServices object. * @param logger a {@link Log}. */ public Introspector(Log logger) { this.rlog = logger; } /** * Gets the method defined by name and * params for the Class c. * * @param c Class in which the method search is taking place * @param name Name of the method being searched for * @param params An array of Objects (not Classes) that describe the * the parameters * * @return The desired Method object. * @throws Exception if the superclass does. */ public Method getMethod(Class c, String name, Object[] params) throws Exception { /* * just delegate to the base class */ try { return super.getMethod(c, name, params); } catch (MethodMap.AmbiguousException ae) { /* * whoops. Ambiguous. Make a nice log message and return null... */ StringBuffer msg = new StringBuffer("Introspection Error : Ambiguous method invocation ") .append(name).append("( "); for (int i = 0; i < params.length; i++) { if (i > 0) { msg.append(", "); } msg.append(params[i].getClass().getName()); } msg.append(") for class ").append(c.getName()); rlog.error(msg.toString()); } return null; } /** * Clears the classmap and classname * caches, and logs that we did so. */ protected void clearCache() { super.clearCache(); rlog.info(CACHEDUMP_MSG); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/IntrospectorBase.java100644 0 0 11333 10500374603 30064 0ustar 0 0 /* * Copyright 2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import java.util.Map; import java.util.Set; import java.util.HashMap; import java.util.HashSet; import java.lang.reflect.Method; /** * This basic function of this class is to return a Method object for a * particular class given the name of a method and the parameters to the method * in the form of an Object[] * * The first time the Introspector sees a class it creates a class method map * for the class in question. Basically the class method map is a Hastable where * Method objects are keyed by a concatenation of the method name and the names * of classes that make up the parameters. * * For example, a method with the following signature: * * public void method(String a, StringBuffer b) * * would be mapped by the key: * * "method" + "java.lang.String" + "java.lang.StringBuffer" * * This mapping is performed for all the methods in a class and stored for * * @since 1.0 * @author Jason van Zyl * @author Bob McWhirter * @author Attila Szegedi * @author Paulo Gaspar * @version $Id: IntrospectorBase.java 398464 2006-04-30 23:50:43Z dion $ */ public class IntrospectorBase { /** * Holds the method maps for the classes we know about, keyed by Class * object. */ protected Map classMethodMaps = new HashMap(); /** * Holds the qualified class names for the classes we hold in the * classMethodMaps hash. */ protected Set cachedClassNames = new HashSet(); /** * Gets the method defined by name and params * for the Class c. * * @param c Class in which the method search is taking place * @param name Name of the method being searched for * @param params An array of Objects (not Classes) that describe the the * parameters * * @return The desired Method object. * @throws Exception on any logical error. */ public Method getMethod(Class c, String name, Object[] params) throws Exception { if (c == null) { throw new Exception("Introspector.getMethod(): Class method key was null: " + name); } ClassMap classMap = null; synchronized (classMethodMaps) { classMap = (ClassMap) classMethodMaps.get(c); /* * if we don't have this, check to see if we have it by name. if so, * then we have a classloader change so dump our caches. */ if (classMap == null) { if (cachedClassNames.contains(c.getName())) { /* * we have a map for a class with same name, but not this * class we are looking at. This implies a classloader * change, so dump */ clearCache(); } classMap = createClassMap(c); } } return classMap.findMethod(name, params); } /** * Creates a class map for specific class and registers it in the cache. * Also adds the qualified name to the name->class map for later Classloader * change detection. * @param c class. * @return a {@link ClassMap} */ protected ClassMap createClassMap(Class c) { ClassMap classMap = new ClassMap(c); classMethodMaps.put(c, classMap); cachedClassNames.add(c.getName()); return classMap; } /** * Clears the classmap and classname caches. */ protected void clearCache() { /* * since we are synchronizing on this object, we have to clear it rather * than just dump it. */ classMethodMaps.clear(); /* * for speed, we can just make a new one and let the old one be GC'd */ cachedClassNames = new HashSet(); } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/MethodMap.java100644 0 0 36330 10500374603 26460 0ustar 0 0 /* * Copyright 2001,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * * @author Jason van Zyl * @author Bob McWhirter * @author Christoph Reck * @author Geir Magnusson Jr. * @author Attila Szegedi * @since 1.0 * @version $Id: MethodMap.java 398495 2006-05-01 01:33:43Z dion $ */ public class MethodMap { /** whether a method is more specific than a previously compared one. */ private static final int MORE_SPECIFIC = 0; /** whether a method is less specific than a previously compared one. */ private static final int LESS_SPECIFIC = 1; /** A method doesn't match a previously compared one. */ private static final int INCOMPARABLE = 2; /** * Keep track of all methods with the same name. */ protected Map methodByNameMap = new Hashtable(); /** * Add a method to a list of methods by name. For a particular class we are * keeping track of all the methods with the same name. * @param method the method. */ public void add(Method method) { String methodName = method.getName(); List l = get(methodName); if (l == null) { l = new ArrayList(); methodByNameMap.put(methodName, l); } l.add(method); } /** * Return a list of methods with the same name. * * @param key The method name. * @return List list of methods */ public List get(String key) { return (List) methodByNameMap.get(key); } /** *

* Find a method. Attempts to find the most specific applicable method using * the algorithm described in the JLS section 15.12.2 (with the exception * that it can't distinguish a primitive type argument from an object type * argument, since in reflection primitive type arguments are represented by * their object counterparts, so for an argument of type (say) * java.lang.Integer, it will not be able to decide between a method that * takes int and a method that takes java.lang.Integer as a parameter. *

* *

* This turns out to be a relatively rare case where this is needed - * however, functionality like this is needed. *

* * @param methodName name of method * @param args the actual arguments with which the method is called * @return the most specific applicable method, or null if no method is * applicable. * @throws AmbiguousException if there is more than one maximally specific * applicable method */ public Method find(String methodName, Object[] args) throws AmbiguousException { List methodList = get(methodName); if (methodList == null) { return null; } int l = args.length; Class[] classes = new Class[l]; for (int i = 0; i < l; ++i) { Object arg = args[i]; /* * if we are careful down below, a null argument goes in there so we * can know that the null was passed to the method */ classes[i] = arg == null ? null : arg.getClass(); } return getMostSpecific(methodList, classes); } /** * simple distinguishable exception, used when we run across ambiguous * overloading. */ public static class AmbiguousException extends Exception { /** serialization version id jdk13 generated. */ static final long serialVersionUID = 8758118091728717367L; } /** * Gets the most specific method from a list. * @param methods list of {@link Method methods} * @param classes argument types * @return the most specific method, or null * @throws AmbiguousException if there is more than one specific method */ private static Method getMostSpecific(List methods, Class[] classes) throws AmbiguousException { LinkedList applicables = getApplicables(methods, classes); if (applicables.isEmpty()) { return null; } if (applicables.size() == 1) { return (Method) applicables.getFirst(); } /* * This list will contain the maximally specific methods. Hopefully at * the end of the below loop, the list will contain exactly one method, * (the most specific method) otherwise we have ambiguity. */ LinkedList maximals = new LinkedList(); for (Iterator applicable = applicables.iterator(); applicable.hasNext();) { Method app = (Method) applicable.next(); Class[] appArgs = app.getParameterTypes(); boolean lessSpecific = false; for (Iterator maximal = maximals.iterator(); !lessSpecific && maximal.hasNext();) { Method max = (Method) maximal.next(); switch (moreSpecific(appArgs, max.getParameterTypes())) { case MORE_SPECIFIC: /* * This method is more specific than the previously * known maximally specific, so remove the old maximum. */ maximal.remove(); break; case LESS_SPECIFIC: /* * This method is less specific than some of the * currently known maximally specific methods, so we * won't add it into the set of maximally specific * methods */ lessSpecific = true; break; } } if (!lessSpecific) { maximals.addLast(app); } } if (maximals.size() > 1) { // We have more than one maximally specific method throw new AmbiguousException(); } return (Method) maximals.getFirst(); } /** * Determines which method signature (represented by a class array) is more * specific. This defines a partial ordering on the method signatures. * * @param c1 first signature to compare * @param c2 second signature to compare * @return MORE_SPECIFIC if c1 is more specific than c2, LESS_SPECIFIC if c1 * is less specific than c2, INCOMPARABLE if they are incomparable. */ private static int moreSpecific(Class[] c1, Class[] c2) { boolean c1MoreSpecific = false; boolean c2MoreSpecific = false; for (int i = 0; i < c1.length; ++i) { if (c1[i] != c2[i]) { c1MoreSpecific = c1MoreSpecific || isStrictMethodInvocationConvertible(c2[i], c1[i]); c2MoreSpecific = c2MoreSpecific || isStrictMethodInvocationConvertible(c1[i], c2[i]); } } if (c1MoreSpecific) { if (c2MoreSpecific) { /* * Incomparable due to cross-assignable arguments (i.e. * foo(String, Object) vs. foo(Object, String)) */ return INCOMPARABLE; } return MORE_SPECIFIC; } if (c2MoreSpecific) { return LESS_SPECIFIC; } /* * Incomparable due to non-related arguments (i.e. foo(Runnable) vs. * foo(Serializable)) */ return INCOMPARABLE; } /** * Returns all methods that are applicable to actual argument types. * * @param methods list of all candidate methods * @param classes the actual types of the arguments * @return a list that contains only applicable methods (number of formal * and actual arguments matches, and argument types are assignable * to formal types through a method invocation conversion). */ private static LinkedList getApplicables(List methods, Class[] classes) { LinkedList list = new LinkedList(); for (Iterator imethod = methods.iterator(); imethod.hasNext();) { Method method = (Method) imethod.next(); if (isApplicable(method, classes)) { list.add(method); } } return list; } /** * Returns true if the supplied method is applicable to actual argument * types. * @param method the method to check * @param classes possible argument types * @return true if the arguments are applicable to the method. */ private static boolean isApplicable(Method method, Class[] classes) { Class[] methodArgs = method.getParameterTypes(); if (methodArgs.length != classes.length) { return false; } for (int i = 0; i < classes.length; ++i) { if (!isMethodInvocationConvertible(methodArgs[i], classes[i])) { return false; } } return true; } /** * Determines whether a type represented by a class object is convertible to * another type represented by a class object using a method invocation * conversion, treating object types of primitive types as if they were * primitive types (that is, a Boolean actual parameter type matches boolean * primitive formal type). This behavior is because this method is used to * determine applicable methods for an actual parameter list, and primitive * types are represented by their object duals in reflective method calls. * * @param formal the formal parameter type to which the actual parameter * type should be convertible * @param actual the actual parameter type. * @return true if either formal type is assignable from actual type, or * formal is a primitive type and actual is its corresponding object * type or an object type of a primitive type that can be converted * to the formal type. */ private static boolean isMethodInvocationConvertible(Class formal, Class actual) { /* * if it's a null, it means the arg was null */ if (actual == null && !formal.isPrimitive()) { return true; } /* * Check for identity or widening reference conversion */ if (actual != null && formal.isAssignableFrom(actual)) { return true; } /* * Check for boxing with widening primitive conversion. Note that actual * parameters are never primitives. */ if (formal.isPrimitive()) { if (formal == Boolean.TYPE && actual == Boolean.class) { return true; } if (formal == Character.TYPE && actual == Character.class) { return true; } if (formal == Byte.TYPE && actual == Byte.class) { return true; } if (formal == Short.TYPE && (actual == Short.class || actual == Byte.class)) { return true; } if (formal == Integer.TYPE && (actual == Integer.class || actual == Short.class || actual == Byte.class)) { return true; } if (formal == Long.TYPE && (actual == Long.class || actual == Integer.class || actual == Short.class || actual == Byte.class)) { return true; } if (formal == Float.TYPE && (actual == Float.class || actual == Long.class || actual == Integer.class || actual == Short.class || actual == Byte.class)) { return true; } if (formal == Double.TYPE && (actual == Double.class || actual == Float.class || actual == Long.class || actual == Integer.class || actual == Short.class || actual == Byte.class)) { return true; } } return false; } /** * Determines whether a type represented by a class object is convertible to * another type represented by a class object using a method invocation * conversion, without matching object and primitive types. This method is * used to determine the more specific type when comparing signatures of * methods. * * @param formal the formal parameter type to which the actual parameter * type should be convertible * @param actual the actual parameter type. * @return true if either formal type is assignable from actual type, or * formal and actual are both primitive types and actual can be * subject to widening conversion to formal. */ private static boolean isStrictMethodInvocationConvertible(Class formal, Class actual) { /* * we shouldn't get a null into, but if so */ if (actual == null && !formal.isPrimitive()) { return true; } /* * Check for identity or widening reference conversion */ if (formal.isAssignableFrom(actual)) { return true; } /* * Check for widening primitive conversion. */ if (formal.isPrimitive()) { if (formal == Short.TYPE && (actual == Byte.TYPE)) { return true; } if (formal == Integer.TYPE && (actual == Short.TYPE || actual == Byte.TYPE)) { return true; } if (formal == Long.TYPE && (actual == Integer.TYPE || actual == Short.TYPE || actual == Byte.TYPE)) { return true; } if (formal == Float.TYPE && (actual == Long.TYPE || actual == Integer.TYPE || actual == Short.TYPE || actual == Byte.TYPE)) { return true; } if (formal == Double.TYPE && (actual == Float.TYPE || actual == Long.TYPE || actual == Integer.TYPE || actual == Short.TYPE || actual == Byte.TYPE)) { return true; } } return false; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/Uberspect.java100644 0 0 5317 10500374603 26517 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import java.util.Iterator; /** * 'Federated' introspection/reflection interface to allow the introspection * behavior in Velocity to be customized. * * @since 1.0 * @author Geir Magusson Jr. * @version $Id: Uberspect.java 398498 2006-05-01 01:48:57Z dion $ */ public interface Uberspect { /** * Initializer - will be called before use. * @throws Exception on any error. */ void init() throws Exception; /** * To support iteratives - #foreach(). * @param info template info. * @param obj to get the iterator for. * @throws Exception on any error. * @return an iterator over obj. */ Iterator getIterator(Object obj, Info info) throws Exception; /** * Returns a general method, corresponding to $foo.bar( $woogie ). * @param obj the object * @param method the method name * @param args method arguments * @param info template info * @throws Exception on any error. * @return a {@link VelMethod}. */ VelMethod getMethod(Object obj, String method, Object[] args, Info info) throws Exception; /** * Property getter - returns VelPropertyGet appropos for #set($foo = * $bar.woogie). * @param obj the object to get the property from. * @param identifier property name * @param info template info * @throws Exception on any error. * @return a {@link VelPropertyGet}. */ VelPropertyGet getPropertyGet(Object obj, String identifier, Info info) throws Exception; /** * Property setter - returns VelPropertySet appropos for #set($foo.bar = * "geir"). * @param obj the object to get the property from. * @param identifier property name * @param arg value to set. * @param info template info * @throws Exception on any error. * @return a {@link VelPropertySet}. */ VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info info) throws Exception; } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java100644 0 0 25524 10500374603 27363 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import org.apache.commons.jexl.util.ArrayIterator; import org.apache.commons.jexl.util.EnumerationIterator; import org.apache.commons.jexl.util.AbstractExecutor; import org.apache.commons.jexl.util.GetExecutor; import org.apache.commons.jexl.util.BooleanPropertyExecutor; import org.apache.commons.jexl.util.PropertyExecutor; import org.apache.commons.logging.Log; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.util.Iterator; import java.util.Collection; import java.util.Map; import java.util.Enumeration; import java.util.ArrayList; /** * Implementation of Uberspect to provide the default introspective * functionality of Velocity. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: UberspectImpl.java 398509 2006-05-01 03:34:35Z dion $ */ public class UberspectImpl implements Uberspect, UberspectLoggable { /** index of the first character of the property. */ private static final int PROPERTY_START_INDEX = 3; /** * Our runtime logger. */ private Log rlog; /** * the default Velocity introspector. */ private static Introspector introspector; /** * init - does nothing - we need to have setRuntimeLogger called before * getting our introspector, as the default vel introspector depends upon * it. * @throws Exception on any error. */ public void init() throws Exception { } /** * Sets the runtime logger - this must be called before anything else * besides init() as to get the logger. Makes the pull model appealing... * @param runtimeLogger service to use for logging. */ public void setRuntimeLogger(Log runtimeLogger) { rlog = runtimeLogger; introspector = new Introspector(rlog); } /** * {@inheritDoc} */ public Iterator getIterator(Object obj, Info i) throws Exception { if (obj.getClass().isArray()) { return new ArrayIterator(obj); } else if (obj instanceof Collection) { return ((Collection) obj).iterator(); } else if (obj instanceof Map) { return ((Map) obj).values().iterator(); } else if (obj instanceof Iterator) { rlog.warn("Warning! The iterative " + " is an Iterator in the #foreach() loop at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName() + ". Because it's not resetable," + " if used in more than once, this may lead to" + " unexpected results."); return ((Iterator) obj); } else if (obj instanceof Enumeration) { rlog.warn("Warning! The iterative " + " is an Enumeration in the #foreach() loop at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName() + ". Because it's not resetable," + " if used in more than once, this may lead to" + " unexpected results."); return new EnumerationIterator((Enumeration) obj); } /* we have no clue what this is */ rlog.warn("Could not determine type of iterator in " + "#foreach loop " + " at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName()); return null; } /** * {@inheritDoc} */ public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i) throws Exception { if (obj == null) { return null; } Method m = introspector.getMethod(obj.getClass(), methodName, args); if (m == null && obj instanceof Class) { m = introspector.getMethod((Class) obj, methodName, args); } return (m == null) ? null : new VelMethodImpl(m); } /** * {@inheritDoc} */ public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i) throws Exception { AbstractExecutor executor; Class claz = obj.getClass(); /* * first try for a getFoo() type of property (also getfoo() ) */ executor = new PropertyExecutor(rlog, introspector, claz, identifier); /* * look for boolean isFoo() */ if (!executor.isAlive()) { executor = new BooleanPropertyExecutor(rlog, introspector, claz, identifier); } /* * if that didn't work, look for get("foo") */ if (!executor.isAlive()) { executor = new GetExecutor(rlog, introspector, claz, identifier); } return (executor == null) ? null : new VelGetterImpl(executor); } /** * {@inheritDoc} */ public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info i) throws Exception { Class claz = obj.getClass(); VelMethod vm = null; try { /* * first, we introspect for the set setter method */ Object[] params = {arg}; try { vm = getMethod(obj, "set" + identifier, params, i); if (vm == null) { throw new NoSuchMethodException(); } } catch (NoSuchMethodException nsme2) { StringBuffer sb = new StringBuffer("set"); sb.append(identifier); if (Character.isLowerCase(sb.charAt(PROPERTY_START_INDEX))) { sb.setCharAt(PROPERTY_START_INDEX, Character.toUpperCase(sb.charAt(PROPERTY_START_INDEX))); } else { sb.setCharAt(PROPERTY_START_INDEX, Character.toLowerCase(sb.charAt(PROPERTY_START_INDEX))); } vm = getMethod(obj, sb.toString(), params, i); if (vm == null) { throw new NoSuchMethodException(); } } } catch (NoSuchMethodException nsme) { /* * right now, we only support the Map interface */ if (Map.class.isAssignableFrom(claz)) { Object[] params = {new Object(), new Object()}; vm = getMethod(obj, "put", params, i); if (vm != null) { return new VelSetterImpl(vm, identifier); } } } return (vm == null) ? null : new VelSetterImpl(vm); } /** * An implementation of {@link VelMethod}. */ public class VelMethodImpl implements VelMethod { /** the method. */ protected Method method = null; /** * Create a new instance. * * @param m the method. */ public VelMethodImpl(Method m) { method = m; } /** * {@inheritDoc} */ public Object invoke(Object o, Object[] params) throws Exception { try { return method.invoke(o, params); } catch (InvocationTargetException e) { final Throwable t = e.getTargetException(); if (t instanceof Exception) { throw (Exception) t; } else if (t instanceof Error) { throw (Error) t; } else { throw e; } } } /** * {@inheritDoc} */ public boolean isCacheable() { return true; } /** * {@inheritDoc} */ public String getMethodName() { return method.getName(); } /** * {@inheritDoc} */ public Class getReturnType() { return method.getReturnType(); } } /** * {@inheritDoc} */ public class VelGetterImpl implements VelPropertyGet { /** executor for performing the get. */ protected AbstractExecutor ae = null; /** * Create the getter using an {@link AbstractExecutor} to * do the work. * @param exec the executor. */ public VelGetterImpl(AbstractExecutor exec) { ae = exec; } /** * {@inheritDoc} */ public Object invoke(Object o) throws Exception { return ae.execute(o); } /** * {@inheritDoc} */ public boolean isCacheable() { return true; } /** * {@inheritDoc} */ public String getMethodName() { return ae.getMethod().getName(); } } /** * {@inheritDoc} */ public class VelSetterImpl implements VelPropertySet { /** the method to call. */ protected VelMethod vm = null; /** the key for indexed and other properties. */ protected String putKey = null; /** * Create an instance. * @param velmethod the method to call on set. */ public VelSetterImpl(VelMethod velmethod) { this.vm = velmethod; } /** * Create an instance. * @param velmethod the method to call on set. * @param key the index or other value passed to a * setProperty(xxx, value) method. */ public VelSetterImpl(VelMethod velmethod, String key) { this.vm = velmethod; putKey = key; } /** {@inheritDoc} */ public Object invoke(Object o, Object value) throws Exception { ArrayList al = new ArrayList(); if (putKey == null) { al.add(value); } else { al.add(putKey); al.add(value); } return vm.invoke(o, al.toArray()); } /** {@inheritDoc} */ public boolean isCacheable() { return true; } /** {@inheritDoc} */ public String getMethodName() { return vm.getMethodName(); } } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/UberspectLoggable.java100644 0 0 2342 10500374603 30147 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; import org.apache.commons.logging.Log; /** * Marker interface to let an uberspector indicate it can and wants to log. * * Thanks to Paulo for the suggestion * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: UberspectLoggable.java 398512 2006-05-01 03:41:02Z dion $ * */ public interface UberspectLoggable { /** * Sets the logger. This will be called before any calls to the uberspector * @param logger the logger. */ void setRuntimeLogger(Log logger); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/VelMethod.java100644 0 0 3400 10500374603 26441 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; /** * Method used for regular method invocation. * * $foo.bar() * * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: VelMethod.java 398513 2006-05-01 03:42:52Z dion $ */ public interface VelMethod { /** * invocation method - called when the method invocation should be performed * and a value returned. * @param o the object * @param params method parameters. * @return the result * @throws Exception on any error. */ Object invoke(Object o, Object[] params) throws Exception; /** * specifies if this VelMethod is cacheable and able to be reused for this * class of object it was returned for. * * @return true if can be reused for this class, false if not */ boolean isCacheable(); /** * Gets the method name used. * @return method name */ String getMethodName(); /** * returns the return type of the method invoked. * @return return type */ Class getReturnType(); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/VelPropertyGet.java100644 0 0 3275 10500374603 27517 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; /** * Interface defining a 'getter'. For uses when looking for resolution of * property references * * $foo.bar * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: VelPropertyGet.java 398514 2006-05-01 03:44:34Z dion $ */ public interface VelPropertyGet { /** * invocation method - called when the 'get action' should be performed and * a value returned. * @param o the object to get the property from. * @return the property value. * @throws Exception on any error. */ Object invoke(Object o) throws Exception; /** * specifies if this VelPropertyGet is cacheable and able to be reused for * this class of object it was returned for. * * @return true if can be reused for this class, false if not */ boolean isCacheable(); /** * returns the method name used to return this 'property'. * @return the method name. */ String getMethodName(); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/introspection/VelPropertySet.java100644 0 0 3370 10500374603 27527 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util.introspection; /** * Interface used for setting values that appear to be properties in Velocity. * Ex. * * #set($foo.bar = "hello") * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: VelPropertySet.java 398515 2006-05-01 03:46:33Z dion $ */ public interface VelPropertySet { /** * method used to set the value in the object. * * @param o Object on which the method will be called with the arg * @param arg value to be set * @return the value returned from the set operation (impl specific) * @throws Exception on any error. */ Object invoke(Object o, Object arg) throws Exception; /** * specifies if this VelPropertySet is cacheable and able to be reused for * this class of object it was returned for. * * @return true if can be reused for this class, false if not */ boolean isCacheable(); /** * returns the method name used to set this 'property'. * @return the method name. */ String getMethodName(); } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/Introspector.java100644 0 0 3433 10500374603 24353 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import org.apache.commons.jexl.util.introspection.Uberspect; import org.apache.commons.jexl.util.introspection.UberspectImpl; import org.apache.commons.jexl.util.introspection.UberspectLoggable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Little class to manage a Velocity uberspector (Vel 1.4+) for instrospective * services. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: Introspector.java 398171 2006-04-29 14:57:29Z dion $ */ public class Introspector { /** * The uberspector from Velocity that handles all instrospection patterns. */ private static Uberspect uberSpect; static { Log logger = LogFactory.getLog(Introspector.class); uberSpect = new UberspectImpl(); ((UberspectLoggable) uberSpect).setRuntimeLogger(logger); } /** * For now, expose the raw uberspector to the AST. * * @return Uberspect The Velocity uberspector. */ public static Uberspect getUberspect() { return uberSpect; } } commons-jexl-1.1-src/src/java/org/apache/commons/jexl/util/PropertyExecutor.java100644 0 0 7130 10500374603 25221 0ustar 0 0 /* * Copyright 2000-2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.util; import java.lang.reflect.InvocationTargetException; import org.apache.commons.jexl.util.introspection.Introspector; import org.apache.commons.logging.Log; /** * Returned the value of object property when executed. * @since 1.0 */ public class PropertyExecutor extends AbstractExecutor { /** index of the first character of the property. */ private static final int PROPERTY_START_INDEX = 3; /** The JEXL introspector used. */ protected Introspector introspector = null; /** The method used. */ protected String methodUsed = null; /** * Constructor. * * @param r The log for this property executor instance. * @param ispctr The JEXL introspector. * @param clazz The class being examined. * @param property The property being addressed. */ public PropertyExecutor(Log r, Introspector ispctr, Class clazz, String property) { rlog = r; introspector = ispctr; discover(clazz, property); } /** * Locate the getter method for this property. * * @param clazz The class being analyzed. * @param property Name of the property. */ protected void discover(Class clazz, String property) { /* * this is gross and linear, but it keeps it straightforward. */ try { char c; StringBuffer sb; Object[] params = {}; /* * start with get * this leaves the property name * as is... */ sb = new StringBuffer("get"); sb.append(property); methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); if (method != null) { return; } /* * now the convenience, flip the 1st character */ sb = new StringBuffer("get"); sb.append(property); c = sb.charAt(PROPERTY_START_INDEX); if (Character.isLowerCase(c)) { sb.setCharAt(PROPERTY_START_INDEX, Character.toUpperCase(c)); } else { sb.setCharAt(PROPERTY_START_INDEX, Character.toLowerCase(c)); } methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); if (method != null) { return; } } catch (Exception e) { rlog.error("PROGRAMMER ERROR : PropertyExector() : " + e); } } /** * {@inheritDoc} */ public Object execute(Object o) throws IllegalAccessException, InvocationTargetException { if (method == null) { return null; } return method.invoke(o, null); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/BitwiseOperatorTest.java100644 0 0 17544 10500374603 24753 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import junit.framework.TestCase; /** * Tests for the bitwise operators. * @author Dion Gillard * @since 1.1 */ public class BitwiseOperatorTest extends TestCase { /** * Create the named test. * @param name test name */ public BitwiseOperatorTest(String name) { super(name); } public void testAndWithTwoNulls() throws Exception { Expression e = ExpressionFactory.createExpression("null & null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testAndWithLeftNull() throws Exception { Expression e = ExpressionFactory.createExpression("null & 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testAndWithRightNull() throws Exception { Expression e = ExpressionFactory.createExpression("1 & null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testAndSimple() throws Exception { Expression e = ExpressionFactory.createExpression("15 & 3"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(3), o); } public void testAndVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x & y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(15)); jc.getVars().put("y", new Short((short)7)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(7), o); } public void testAndVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x & y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(15)); jc.getVars().put("y", "7"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(7), o); } public void testComplementWithNull() throws Exception { Expression e = ExpressionFactory.createExpression("~null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-1), o); } public void testComplementSimple() throws Exception { Expression e = ExpressionFactory.createExpression("~128"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-129), o); } public void testComplementVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("~x"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(15)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-16), o); } public void testComplementVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("~x"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", "15"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-16), o); } public void testOrWithTwoNulls() throws Exception { Expression e = ExpressionFactory.createExpression("null | null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testOrWithLeftNull() throws Exception { Expression e = ExpressionFactory.createExpression("null | 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testOrWithRightNull() throws Exception { Expression e = ExpressionFactory.createExpression("1 | null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testOrSimple() throws Exception { Expression e = ExpressionFactory.createExpression("12 | 3"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(15), o); } public void testOrVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x | y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(12)); jc.getVars().put("y", new Short((short) 3)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(15), o); } public void testOrVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x | y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(12)); jc.getVars().put("y", "3"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(15), o); } public void testXorWithTwoNulls() throws Exception { Expression e = ExpressionFactory.createExpression("null ^ null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testXorWithLeftNull() throws Exception { Expression e = ExpressionFactory.createExpression("null ^ 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testXorWithRightNull() throws Exception { Expression e = ExpressionFactory.createExpression("1 ^ null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testXorSimple() throws Exception { Expression e = ExpressionFactory.createExpression("1 ^ 3"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); } public void testXorVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x ^ y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); jc.getVars().put("y", new Short((short) 3)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); } public void testXorVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x ^ y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); jc.getVars().put("y", "3"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/BlockTest.java100644 0 0 6114 10500374603 22632 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import junit.framework.TestCase; /** * Tests for blocks * @since 1.1 */ public class BlockTest extends TestCase { /** * Create the test * * @param testName name of the test */ public BlockTest(String testName) { super(testName); } public void testBlockSimple() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { 'hello'; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", "hello", o); } public void testBlockExecutesAll() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { x = 'Hello'; y = 'World';}"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("First result is wrong", "Hello", jc.getVars().get("x")); assertEquals("Second result is wrong", "World", jc.getVars().get("y")); assertEquals("Block result is wrong", "World", o); } public void testEmptyBlock() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is wrong", o); } public void testBlockLastExecuted01() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { x = 1; } else { x = 2; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Block result is wrong", new Integer(1), o); } public void testBlockLastExecuted02() throws Exception { Expression e = ExpressionFactory .createExpression("if (false) { x = 1; } else { x = 2; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Block result is wrong", new Integer(2), o); } public void testNestedBlock() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { x = 'hello'; y = 'world';" + " if (true) { x; } y; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Block result is wrong", "world", o); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/Foo.java100644 0 0 4644 10500374603 21471 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.util.ArrayList; import java.util.List; /** * A simple bean used for testing purposes * * @since 1.0 * @author Geir Magnusson Jr. * @version $Revision: 391861 $ */ public class Foo { private boolean beenModified = false; private String property1 = "some value"; public String bar() { return JexlTest.METHOD_STRING; } public String getBar() { return JexlTest.GET_METHOD_STRING; } public Foo getInnerFoo() { return new Foo(); } public String get(String arg) { return "Repeat : " + arg; } public String convertBoolean(boolean b) { return "Boolean : " + b; } public int getCount() { return 5; } public List getCheeseList() { ArrayList answer = new ArrayList(); answer.add("cheddar"); answer.add("edam"); answer.add("brie"); return answer; } public String[] getArray() { return JexlTest.GET_METHOD_ARRAY; } public String[][] getArray2() { return JexlTest.GET_METHOD_ARRAY2; } public boolean isSimple() { return true; } public int square(int value) { return value * value; } public boolean getTrueAndModify() { beenModified = true; return true; } public boolean getModified() { return beenModified; } public int getSize() { return 22; } public String getProperty1() { return property1; } public void setProperty1(String newValue) { property1 = newValue; } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/ForEachTest.java100644 0 0 12212 10500374603 23123 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.util.StringTokenizer; import junit.framework.TestCase; /** * Tests for the foreach statement * @author Dion Gillard * @since 1.1 */ public class ForEachTest extends TestCase { /** create a named test */ public ForEachTest(String name) { super(name); } public void testForEachWithEmptyStatement() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) ;"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is not null", o); } public void testForEachWithEmptyList() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) 1+1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is not null", o); } public void testForEachWithArray() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new Object[] {"Hello", "World"}); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithCollection() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", Arrays.asList(new Object[] {"Hello", "World"})); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithEnumeration() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new StringTokenizer("Hello,World", ",")); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithIterator() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", Arrays.asList(new Object[] {"Hello", "World"}).iterator()); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithMap() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); Map map = System.getProperties(); String lastProperty = (String) new ArrayList(map.values()).get(System.getProperties().size() - 1); jc.getVars().put("list", map); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", lastProperty, o); } public void testForEachWithBlock() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) { x = x + item; }"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new Object[] {"1", "1"}); jc.getVars().put("x", new Integer(0)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); assertEquals("x is wrong", new Long(2), jc.getVars().get("x")); } public void testForEachWithListExpression() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list.keySet()) item"); JexlContext jc = JexlHelper.createContext(); Map map = System.getProperties(); String lastKey = (String) new ArrayList(map.keySet()).get(System.getProperties().size() - 1); jc.getVars().put("list", map); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", lastKey, o); } public void testForEachWithProperty() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list.cheeseList) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new Foo()); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "brie", o); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/IfTest.java100644 0 0 12136 10500374603 22157 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import junit.framework.TestCase; /** * Test cases for the if statement. * * @author Dion Gillard * @since 1.1 */ public class IfTest extends TestCase { public IfTest(String testName) { super(testName); } /** * Make sure if true executes the true statement * * @throws Exception on any error */ public void testSimpleIfTrue() throws Exception { Expression e = ExpressionFactory.createExpression("if (true) 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is not 1", new Integer(1), o); } /** * Make sure if false doesn't execute the true statement * * @throws Exception on any error */ public void testSimpleIfFalse() throws Exception { Expression e = ExpressionFactory.createExpression("if (false) 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Return value is not empty", o); } /** * Make sure if false executes the false statement * * @throws Exception on any error */ public void testSimpleElse() throws Exception { Expression e = ExpressionFactory .createExpression("if (false) 1; else 2;"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is not 2", new Integer(2), o); } /** * Test the if statement handles blocks correctly * * @throws Exception on any error */ public void testBlockIfTrue() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { 'hello'; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", "hello", o); } /** * Test the if statement handles blocks in the else statement correctly * * @throws Exception on any error */ public void testBlockElse() throws Exception { Expression e = ExpressionFactory .createExpression("if (false) {1;} else {2;}"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Integer(2), o); } /** * Test the if statement evaluates expressions correctly * * @throws Exception on any error */ public void testIfWithSimpleExpression() throws Exception { Expression e = ExpressionFactory .createExpression("if (x == 1) true;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); Object o = e.evaluate(jc); assertEquals("Result is not true", Boolean.TRUE, o); } /** * Test the if statement evaluates arithmetic expressions correctly * * @throws Exception on any error */ public void testIfWithArithmeticExpression() throws Exception { Expression e = ExpressionFactory .createExpression("if ((x * 2) + 1 == 5) true;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(2)); Object o = e.evaluate(jc); assertEquals("Result is not true", Boolean.TRUE, o); } /** * Test the if statement evaluates decimal arithmetic expressions correctly * * @throws Exception on any error */ public void testIfWithDecimalArithmeticExpression() throws Exception { Expression e = ExpressionFactory .createExpression("if ((x * 2) == 5) true;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Float(2.5f)); Object o = e.evaluate(jc); assertEquals("Result is not true", Boolean.TRUE, o); } /** * Test the if statement works with assignment * * @throws Exception on any error */ public void testIfWithAssignment() throws Exception { Expression e = ExpressionFactory .createExpression("if ((x * 2) == 5) {y = 1;} else {y = 2;}"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Float(2.5f)); e.evaluate(jc); Object result = jc.getVars().get("y"); assertEquals("y has the wrong value", new Integer(1), result); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/Jexl.java100644 0 0 2643 10500374603 21645 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.util.Map; /** * @author Dion Gillard * @since 1.0 * Command line interface for Jexl for use in testing */ public class Jexl { public static void main(String[] args) { // dummy context to get variables JexlContext context = new JexlContext() { public Map getVars() { return System.getProperties(); } public void setVars(Map map) { } }; try { for (int i = 0; i < args.length; i++) { Expression e = ExpressionFactory.createExpression(args[i]); System.out.println("evaluate(" + args[i] + ") = '" + e.evaluate(context) + "'"); } } catch (Exception e) { e.printStackTrace(); } } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/JexlTest.java100644 0 0 104212 10500374603 22540 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.io.StringReader; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.BitSet; import java.util.Calendar; import java.util.Collections; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.commons.jexl.parser.ParseException; import org.apache.commons.jexl.parser.Parser; import org.apache.commons.jexl.resolver.FlatResolver; /** * Simple testcases * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlTest.java 391888 2006-04-06 03:34:59Z dion $ */ public class JexlTest extends TestCase { protected static final String METHOD_STRING = "Method string"; protected static final String GET_METHOD_STRING = "GetMethod string"; protected static final String[] GET_METHOD_ARRAY = new String[] { "One", "Two", "Three" }; protected static final String[][] GET_METHOD_ARRAY2 = new String[][] { {"One", "Two", "Three"},{"Four", "Five", "Six"} }; public static Test suite() { return new TestSuite(JexlTest.class); } public JexlTest(String testName) { super(testName); } /** * test a simple property expression */ public void testProperty() throws Exception { /* * tests a simple property expression */ Expression e = ExpressionFactory.createExpression("foo.bar"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); Object o = e.evaluate(jc); assertTrue("o not instanceof String", o instanceof String); assertEquals("o incorrect", GET_METHOD_STRING, o); } /** * test a simple method expression */ public void testMethod() throws Exception { /* * tests a simple method expression */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); assertExpression(jc, "foo.bar()", METHOD_STRING); } /** * test a simple method expression */ public void testArrayAccess() throws Exception { JexlContext jc = JexlHelper.createContext(); /* * test List access */ List l = new ArrayList(); l.add(new Integer(1)); l.add(new Integer(2)); l.add(new Integer(3)); jc.getVars().put("list", l); assertExpression(jc, "list[1]", new Integer(2)); assertExpression(jc, "list[1+1]", new Integer(3)); jc.getVars().put("loc", new Integer(1)); assertExpression(jc, "list[loc+1]", new Integer(3)); /* * test array access */ String[] args = {"hello", "there"}; jc.getVars().put("array", args); assertExpression(jc, "array[0]", "hello"); /* * to think that this was an intentional syntax... */ assertExpression(jc, "array.0", "hello"); /* * test map access */ Map m = new HashMap(); m.put("foo", "bar"); jc.getVars().put("map", m); jc.getVars().put("key", "foo"); assertExpression(jc, "map[\"foo\"]", "bar"); assertExpression(jc, "map[key]", "bar"); /* * test bean access */ jc.getVars().put("foo", new Foo()); assertExpression(jc, "foo[\"bar\"]", GET_METHOD_STRING); assertExpression(jc, "foo[\"bar\"] == foo.bar", Boolean.TRUE); } public void testMulti() throws Exception { /* * tests a simple property expression */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); assertExpression(jc, "foo.innerFoo.bar()", METHOD_STRING); } public void testBoolean() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); jc.getVars().put("a", Boolean.TRUE); jc.getVars().put("b", Boolean.FALSE); assertExpression(jc, "foo.convertBoolean(a==b)", "Boolean : false"); assertExpression(jc, "foo.convertBoolean(a==true)", "Boolean : true"); assertExpression(jc, "foo.convertBoolean(a==false)", "Boolean : false"); assertExpression(jc, "foo.convertBoolean(true==false)", "Boolean : false"); assertExpression(jc, "true eq false", Boolean.FALSE); assertExpression(jc, "true ne false", Boolean.TRUE); } public void testStringLit() throws Exception { /* * tests a simple property expression */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); assertExpression(jc, "foo.get(\"woogie\")", "Repeat : woogie"); } public void testExpression() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); jc.getVars().put("a", Boolean.TRUE); jc.getVars().put("b", Boolean.FALSE); jc.getVars().put("num", new Integer(5)); jc.getVars().put("now", Calendar.getInstance().getTime()); GregorianCalendar gc = new GregorianCalendar(5000, 11, 20); jc.getVars().put("now2", gc.getTime()); assertExpression(jc, "a == b", Boolean.FALSE); assertExpression(jc, "a==true", Boolean.TRUE); assertExpression(jc, "a==false", Boolean.FALSE); assertExpression(jc, "true==false", Boolean.FALSE); assertExpression(jc, "2 < 3", Boolean.TRUE); assertExpression(jc, "num < 5", Boolean.FALSE); assertExpression(jc, "num < num", Boolean.FALSE); assertExpression(jc, "num < null", Boolean.FALSE); assertExpression(jc, "num < 2.5", Boolean.FALSE); assertExpression(jc, "now2 < now", Boolean.FALSE); // test comparable // assertExpression(jc, "'6' <= '5'", Boolean.FALSE); assertExpression(jc, "num <= 5", Boolean.TRUE); assertExpression(jc, "num <= num", Boolean.TRUE); assertExpression(jc, "num <= null", Boolean.FALSE); assertExpression(jc, "num <= 2.5", Boolean.FALSE); assertExpression(jc, "now2 <= now", Boolean.FALSE); // test comparable // assertExpression(jc, "'6' >= '5'", Boolean.TRUE); assertExpression(jc, "num >= 5", Boolean.TRUE); assertExpression(jc, "num >= num", Boolean.TRUE); assertExpression(jc, "num >= null", Boolean.FALSE); assertExpression(jc, "num >= 2.5", Boolean.TRUE); assertExpression(jc, "now2 >= now", Boolean.TRUE); // test comparable assertExpression(jc, "'6' > '5'", Boolean.TRUE); assertExpression(jc, "num > 4", Boolean.TRUE); assertExpression(jc, "num > num", Boolean.FALSE); assertExpression(jc, "num > null", Boolean.FALSE); assertExpression(jc, "num > 2.5", Boolean.TRUE); assertExpression(jc, "now2 > now", Boolean.TRUE); // test comparable assertExpression(jc, "\"foo\" + \"bar\" == \"foobar\"", Boolean.TRUE); } public void testEmpty() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("string", ""); jc.getVars().put("array", new Object[0]); jc.getVars().put("map", new HashMap()); jc.getVars().put("list", new ArrayList()); jc.getVars().put("set", (new HashMap()).keySet()); jc.getVars().put("longstring", "thingthing"); /* * I can't believe anyone thinks this is a syntax.. :) */ assertExpression(jc, "empty nullthing", Boolean.TRUE); assertExpression(jc, "empty string", Boolean.TRUE); assertExpression(jc, "empty array", Boolean.TRUE); assertExpression(jc, "empty map", Boolean.TRUE); assertExpression(jc, "empty set", Boolean.TRUE); assertExpression(jc, "empty list", Boolean.TRUE); assertExpression(jc, "empty longstring", Boolean.FALSE); assertExpression(jc, "not empty longstring", Boolean.TRUE); } public void testSize() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("s", "five!"); jc.getVars().put("array", new Object[5]); Map map = new HashMap(); map.put("1", new Integer(1)); map.put("2", new Integer(2)); map.put("3", new Integer(3)); map.put("4", new Integer(4)); map.put("5", new Integer(5)); jc.getVars().put("map", map); List list = new ArrayList(); list.add("1"); list.add("2"); list.add("3"); list.add("4"); list.add("5"); jc.getVars().put("list", list); // 30652 - support for set Set set = new HashSet(); set.addAll(list); set.add("1"); jc.getVars().put("set", set); // support generic int size() method BitSet bitset = new BitSet(5); jc.getVars().put("bitset", bitset); assertExpression(jc, "size(s)", new Integer(5)); assertExpression(jc, "size(array)", new Integer(5)); assertExpression(jc, "size(list)", new Integer(5)); assertExpression(jc, "size(map)", new Integer(5)); assertExpression(jc, "size(set)", new Integer(5)); assertExpression(jc, "size(bitset)", new Integer(64)); assertExpression(jc, "list.size()", new Integer(5)); assertExpression(jc, "map.size()", new Integer(5)); assertExpression(jc, "set.size()", new Integer(5)); assertExpression(jc, "bitset.size()", new Integer(64)); assertExpression(jc, "list.get(size(list) - 1)", "5"); assertExpression(jc, "list[size(list) - 1]", "5"); assertExpression(jc, "list.get(list.size() - 1)", "5"); } public void testSizeAsProperty() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("map", Collections.singletonMap( "size", "cheese")); jc.getVars().put("foo", new Foo()); assertExpression(jc, "map['size']", "cheese"); // PR - unsure whether or not we should support map.size or force usage of the above 'escaped' version // assertExpression(jc, "map.size", "cheese"); assertExpression(jc, "foo.getSize()", new Integer(22)); // failing assertion for size property //assertExpression(jc, "foo.size", new Integer(22)); } /** * test some String method calls */ public void testStringMethods() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "abcdef"); assertExpression(jc, "foo.substring(3)", "def"); assertExpression(jc, "foo.substring(0,(size(foo)-3))", "abc"); assertExpression(jc, "foo.substring(0,size(foo)-3)", "abc"); assertExpression(jc, "foo.substring(0,foo.length()-3)", "abc"); assertExpression(jc, "foo.substring(0, 1+1)", "ab"); } /** * test some simple mathematical calculations */ public void testUnaryMinus() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("aByte", new Byte((byte)1)); jc.getVars().put("aShort", new Short((short)2)); jc.getVars().put("anInteger", new Integer(3)); jc.getVars().put("aLong", new Long(4)); jc.getVars().put("aFloat", new Float(5.5)); jc.getVars().put("aDouble", new Double(6.6)); jc.getVars().put("aBigInteger", new BigInteger("7")); jc.getVars().put("aBigDecimal", new BigDecimal("8.8")); assertExpression(jc, "-3", new Integer("-3")); assertExpression(jc, "-3.0", new Float("-3.0")); assertExpression(jc, "-aByte", new Byte((byte)-1)); assertExpression(jc, "-aShort", new Short((short)-2)); assertExpression(jc, "-anInteger", new Integer(-3)); assertExpression(jc, "-aLong", new Long(-4)); assertExpression(jc, "-aFloat", new Float(-5.5)); assertExpression(jc, "-aDouble", new Double(-6.6)); assertExpression(jc, "-aBigInteger", new BigInteger("-7")); assertExpression(jc, "-aBigDecimal", new BigDecimal("-8.8")); } /** * test some simple mathematical calculations */ public void testCalculations() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Integer(2) ); assertExpression(jc, "foo + 2", new Long(4)); assertExpression(jc, "3 + 3", new Long(6)); assertExpression(jc, "3 + 3 + foo", new Long(8)); assertExpression(jc, "3 * 3", new Long(9)); assertExpression(jc, "3 * 3 + foo", new Long(11)); assertExpression(jc, "3 * 3 - foo", new Long(7)); /* * test some floaty stuff */ assertExpression(jc, "3 * \"3.0\"", new Double(9)); assertExpression(jc, "3 * 3.0", new Double(9)); /* * test / and % */ assertExpression(jc, "6 / 3", new Double(6/3)); assertExpression(jc, "6.4 / 3", new Double(6.4 / 3)); assertExpression(jc, "0 / 3", new Double(0 / 3)); assertExpression(jc, "3 / 0", new Double(0)); assertExpression(jc, "4 % 3", new Long(1)); assertExpression(jc, "4.8 % 3", new Double(4.8 % 3)); /* * test to ensure new string cat works */ jc.getVars().put("stringy", "thingy" ); assertExpression(jc, "stringy + 2", "thingy2"); /* * test new null coersion */ jc.getVars().put("imanull", null ); assertExpression(jc, "imanull + 2", new Long(2)); assertExpression(jc, "imanull + imanull", new Long(0)); /* test for bugzilla 31577 */ jc.getVars().put("n", new Integer(0)); assertExpression(jc, "n != null && n != 0", Boolean.FALSE); } /** * test some simple conditions */ public void testConditions() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Integer(2) ); jc.getVars().put("aFloat", new Float(1)); jc.getVars().put("aDouble", new Double(2)); jc.getVars().put("aChar", new Character('A')); jc.getVars().put("aBool", Boolean.TRUE); StringBuffer buffer = new StringBuffer("abc"); List list = new ArrayList(); List list2 = new LinkedList(); jc.getVars().put("aBuffer", buffer); jc.getVars().put("aList", list); jc.getVars().put("bList", list2); assertExpression(jc, "foo == 2", Boolean.TRUE); assertExpression(jc, "2 == 3", Boolean.FALSE); assertExpression(jc, "3 == foo", Boolean.FALSE); assertExpression(jc, "3 != foo", Boolean.TRUE); assertExpression(jc, "foo != 2", Boolean.FALSE); // test float and double equality assertExpression(jc, "aFloat eq aDouble", Boolean.FALSE); assertExpression(jc, "aFloat ne aDouble", Boolean.TRUE); assertExpression(jc, "aFloat == aDouble", Boolean.FALSE); assertExpression(jc, "aFloat != aDouble", Boolean.TRUE); // test number and character equality assertExpression(jc, "foo == aChar", Boolean.FALSE); assertExpression(jc, "foo != aChar", Boolean.TRUE); // test string and boolean assertExpression(jc, "aBool == 'true'", Boolean.TRUE); assertExpression(jc, "aBool == 'false'", Boolean.FALSE); assertExpression(jc, "aBool != 'false'", Boolean.TRUE); // test null and boolean assertExpression(jc, "aBool == notThere", Boolean.FALSE); assertExpression(jc, "aBool != notThere", Boolean.TRUE); // anything and string as a string comparison assertExpression(jc, "aBuffer == 'abc'", Boolean.TRUE); assertExpression(jc, "aBuffer != 'abc'", Boolean.FALSE); // arbitrary equals assertExpression(jc, "aList == bList", Boolean.TRUE); assertExpression(jc, "aList != bList", Boolean.FALSE); } /** * test some simple conditions */ public void testNotConditions() throws Exception { JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("x", Boolean.TRUE ); jc.getVars().put("foo", foo ); jc.getVars().put("bar", "true" ); assertExpression(jc, "!x", Boolean.FALSE); assertExpression(jc, "x", Boolean.TRUE); assertExpression(jc, "!bar", Boolean.FALSE); assertExpression(jc, "!foo.isSimple()", Boolean.FALSE); assertExpression(jc, "foo.isSimple()", Boolean.TRUE); assertExpression(jc, "!foo.simple", Boolean.FALSE); assertExpression(jc, "foo.simple", Boolean.TRUE); assertExpression(jc, "foo.getCheeseList().size() == 3", Boolean.TRUE); assertExpression(jc, "foo.cheeseList.size() == 3", Boolean.TRUE); jc.getVars().put("string", ""); assertExpression(jc, "not empty string", Boolean.FALSE); assertExpression(jc, "not(empty string)", Boolean.FALSE); assertExpression(jc, "not empty(string)", Boolean.FALSE); assertExpression(jc, "! empty string", Boolean.FALSE); assertExpression(jc, "!(empty string)", Boolean.FALSE); assertExpression(jc, "!empty(string)", Boolean.FALSE); } /** * GMJ : disabled - need to fix * * test some simple conditions */ public void testNotConditionsWithDots() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x.a", Boolean.TRUE ); jc.getVars().put("x.b", Boolean.FALSE ); assertExpression(jc, "x.a", Boolean.TRUE); assertExpression(jc, "!x.a", Boolean.FALSE); assertExpression(jc, "!x.b", Boolean.TRUE); } /** * test some simple conditions */ public void testComparisons() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "the quick and lazy fox" ); assertExpression(jc, "foo.indexOf('quick') > 0", Boolean.TRUE); assertExpression(jc, "foo.indexOf('bar') >= 0", Boolean.FALSE); assertExpression(jc, "foo.indexOf('bar') < 0", Boolean.TRUE); } /** * test some null conditions */ public void testNull() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("bar", new Integer(2) ); assertExpression(jc, "empty foo", Boolean.TRUE); assertExpression(jc, "bar == null", Boolean.FALSE); assertExpression(jc, "foo == null", Boolean.TRUE); assertExpression(jc, "bar != null", Boolean.TRUE); assertExpression(jc, "foo != null", Boolean.FALSE); assertExpression(jc, "empty(bar)", Boolean.FALSE); assertExpression(jc, "empty(foo)", Boolean.TRUE); } /** * test some blank strings */ public void testBlankStrings() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("bar", "" ); assertExpression(jc, "foo == ''", Boolean.FALSE); assertExpression(jc, "bar == ''", Boolean.TRUE); assertExpression(jc, "barnotexist == ''", Boolean.FALSE); assertExpression(jc, "empty bar", Boolean.TRUE); assertExpression(jc, "bar.length() == 0", Boolean.TRUE); assertExpression(jc, "size(bar) == 0", Boolean.TRUE); } /** * test some blank strings */ public void testLogicExpressions() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "abc" ); jc.getVars().put("bar", "def" ); assertExpression(jc, "foo == 'abc' || bar == 'abc'", Boolean.TRUE); assertExpression(jc, "foo == 'abc' or bar == 'abc'", Boolean.TRUE); assertExpression(jc, "foo == 'abc' && bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'abc' and bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'def' || bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'def' or bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'abc' && bar == 'def'", Boolean.TRUE); assertExpression(jc, "foo == 'abc' and bar == 'def'", Boolean.TRUE); } /** * test some simple double array lookups */ public void testDoubleArrays() throws Exception { JexlContext jc = JexlHelper.createContext(); Object[][] foo = new Object[2][2]; foo[0][0] = "one"; foo[0][1] = "two"; jc.getVars().put("foo", foo ); assertExpression(jc, "foo[0][1]", "two"); } /** * test variables with underscore names */ public void testVariableNames() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo_bar", "123" ); assertExpression(jc, "foo_bar", "123"); } /** * test the use of dot notation to lookup map entries */ public void testMapDot() throws Exception { Map foo = new HashMap(); foo.put( "bar", "123" ); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.bar", "123"); } /** * Tests string literals */ public void testStringLiterals() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "bar" ); assertExpression(jc, "foo == \"bar\"", Boolean.TRUE); assertExpression(jc, "foo == 'bar'", Boolean.TRUE); } /** * test the use of an int based property */ public void testIntProperty() throws Exception { Foo foo = new Foo(); // lets check the square function first.. assertEquals(4, foo.square(2)); assertEquals(4, foo.square(-2)); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.count", new Integer(5)); assertExpression(jc, "foo.square(2)", new Integer(4)); assertExpression(jc, "foo.square(-2)", new Integer(4)); } /** * test the -1 comparison bug */ public void testNegativeIntComparison() throws Exception { JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.count != -1", Boolean.TRUE); assertExpression(jc, "foo.count == 5", Boolean.TRUE); assertExpression(jc, "foo.count == -1", Boolean.FALSE); } public void testArrayProperty() throws Exception { Foo foo = new Foo(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.array[1]", GET_METHOD_ARRAY[1]); assertExpression(jc, "foo.array.1", GET_METHOD_ARRAY[1]); assertExpression(jc, "foo.array2[1][1]", GET_METHOD_ARRAY2[1][1]); //assertExpression(jc, "foo.array2.1.1", GET_METHOD_ARRAY2[1][1]); } /** * Attempts to recreate bug http://jira.werken.com/ViewIssue.jspa?key=JELLY-8 */ public void testCharAtBug() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "abcdef"); assertExpression(jc, "foo.substring(2,4)", "cd"); assertExpression(jc, "foo.charAt(2)", new Character('c')); try { assertExpression(jc, "foo.charAt(-2)", null); fail("this test should have thrown an exception" ); } catch (IndexOutOfBoundsException e) { // expected behaviour } catch (Exception e) { throw e; } } public void testEmptyDottedVariableName() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put( "this.is.a.test", ""); assertExpression(jc, "empty(this.is.a.test)", Boolean.TRUE); } public void testEmptySubListOfMap() throws Exception { JexlContext jc = JexlHelper.createContext(); Map m = Collections.singletonMap("aList", Collections.EMPTY_LIST); jc.getVars().put( "aMap", m ); assertExpression( jc, "empty( aMap.aList )", Boolean.TRUE ); } public void testCoercionWithComparisionOperators() throws Exception { JexlContext jc = JexlHelper.createContext(); assertExpression(jc, "'2' > 1", Boolean.TRUE); assertExpression(jc, "'2' >= 1", Boolean.TRUE); assertExpression(jc, "'2' >= 2", Boolean.TRUE); assertExpression(jc, "'2' < 1", Boolean.FALSE); assertExpression(jc, "'2' <= 1", Boolean.FALSE); assertExpression(jc, "'2' <= 2", Boolean.TRUE); assertExpression(jc, "2 > '1'", Boolean.TRUE); assertExpression(jc, "2 >= '1'", Boolean.TRUE); assertExpression(jc, "2 >= '2'", Boolean.TRUE); assertExpression(jc, "2 < '1'", Boolean.FALSE); assertExpression(jc, "2 <= '1'", Boolean.FALSE); assertExpression(jc, "2 <= '2'", Boolean.TRUE); } public void testResolver() throws Exception { /* * first, a simple override */ Expression expr = ExpressionFactory.createExpression("foo.bar"); expr.addPreResolver(new FlatResolver()); JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("foo.bar", "flat value"); jc.getVars().put("foo", foo ); Object o = expr.evaluate(jc); assertEquals("flat override", "flat value", o); /* * now, let the resolver not find it and have it drop to jexl */ expr = ExpressionFactory.createExpression("foo.bar.length()"); expr.addPreResolver(new FlatResolver()); o = expr.evaluate(jc); assertEquals("flat override 1", new Integer(GET_METHOD_STRING.length()), o); /* * now, let the resolver not find it and NOT drop to jexl */ expr = ExpressionFactory.createExpression("foo.bar.length()"); expr.addPreResolver(new FlatResolver(false)); o = expr.evaluate(jc); assertEquals("flat override 2", o, null); // now for a post resolver expr = ExpressionFactory.createExpression("foo.bar.baz"); Long result = new Long(1); jc.getVars().put("foo.bar.baz", result); expr.addPostResolver(new FlatResolver()); assertEquals("flat override", result, expr.evaluate(jc)); } /** * Test that 'and' only evaluates the second item if needed * @throws Exception if there are errors */ public void testBooleanShortCircuitAnd() throws Exception { // handle false for the left arg of 'and' Foo tester = new Foo(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("first", Boolean.FALSE); jc.getVars().put("foo", tester); Expression expr = ExpressionFactory.createExpression("first and foo.trueAndModify"); expr.evaluate(jc); assertTrue("Short circuit failure: rhs evaluated when lhs FALSE", !tester.getModified()); // handle true for the left arg of 'and' tester = new Foo(); jc.getVars().put("first", Boolean.TRUE); jc.getVars().put("foo", tester); expr.evaluate(jc); assertTrue("Short circuit failure: rhs not evaluated when lhs TRUE", tester.getModified()); } /** * Test that 'or' only evaluates the second item if needed * @throws Exception if there are errors */ public void testBooleanShortCircuitOr() throws Exception { // handle false for the left arg of 'or' Foo tester = new Foo(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("first", Boolean.FALSE); jc.getVars().put("foo", tester); Expression expr = ExpressionFactory.createExpression("first or foo.trueAndModify"); expr.evaluate(jc); assertTrue("Short circuit failure: rhs not evaluated when lhs FALSE", tester.getModified()); // handle true for the left arg of 'or' tester = new Foo(); jc.getVars().put("first", Boolean.TRUE); jc.getVars().put("foo", tester); expr.evaluate(jc); assertTrue("Short circuit failure: rhs evaluated when lhs TRUE", !tester.getModified()); } /** * Simple test of '+' as a string concatenation operator * @throws Exception */ public void testStringConcatenation() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("first", "Hello"); jc.getVars().put("second", "World"); assertExpression(jc, "first + ' ' + second", "Hello World"); } /** * Ensures static methods on objects can be called. */ public void testStaticMethodInvocation() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("aBool", Boolean.FALSE); assertExpression(jc, "aBool.valueOf('true')", Boolean.TRUE); } public void testStaticMethodInvocationOnClasses() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("Boolean", Boolean.class); assertExpression(jc, "Boolean.valueOf('true')", Boolean.TRUE); } public void testToString() throws Exception { String code = "abcd"; Expression expr = ExpressionFactory.createExpression(code); assertEquals("Bad expression value", code, expr.toString()); } /** * Make sure bad syntax throws ParseException * @throws Exception on errors */ public void testBadParse() throws Exception { try { assertExpression(JexlHelper.createContext(), "empty()", null); fail("Bad expression didn't throw ParseException"); } catch (ParseException pe) { // expected behaviour } } /** * Test the ## comment in a string * @throws Exception */ public void testComment() throws Exception { assertExpression(JexlHelper.createContext(), "## double or nothing\n 1 + 1", Long.valueOf("2")); } /** * Test assignment. * @throws Exception */ public void testAssignment() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("aString", "Hello"); Foo foo = new Foo(); jc.getVars().put("foo", foo); Parser parser = new Parser(new StringReader(";")); parser.parse(new StringReader("aString = 'World';")); assertExpression(jc, "hello = 'world'", "world"); assertEquals("hello variable not changed", "world", jc.getVars().get("hello")); assertExpression(jc, "result = 1 + 1", new Long(2)); assertEquals("result variable not changed", new Long(2), jc.getVars().get("result")); // todo: make sure properties can be assigned to, fall back to flat var if no property // assertExpression(jc, "foo.property1 = '99'", "99"); // assertEquals("property not set", "99", foo.getProperty1()); } public void testAntPropertiesWithMethods() throws Exception { JexlContext jc = JexlHelper.createContext(); String value = "Stinky Cheese"; jc.getVars().put("maven.bob.food", value); assertExpression(jc, "maven.bob.food.length()", new Integer(value.length())); assertExpression(jc, "empty(maven.bob.food)", Boolean.FALSE); assertExpression(jc, "size(maven.bob.food)", new Integer(value.length())); assertExpression(jc, "maven.bob.food + ' is good'", value + " is good"); // DG: Note the following ant properties don't work // String version = "1.0.3"; // jc.getVars().put("commons-logging", version); // assertExpression(jc, "commons-logging", version); } /** * Asserts that the given expression returns the given value when applied to the * given context */ protected void assertExpression(JexlContext jc, String expression, Object expected) throws Exception { Expression e = ExpressionFactory.createExpression(expression); Object actual = e.evaluate(jc); assertEquals(expression, expected, actual); } /** * Helps in debugging the testcases when working with it * */ public static void main(String[] args) throws Exception { JexlTest jt = new JexlTest("foo"); jt.testEmpty(); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/junit/AsserterTest.java100644 0 0 5044 10500374603 24522 0ustar 0 0 /* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl.junit; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.commons.jexl.Foo; /** * Simple testcases * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: AsserterTest.java 209171 2005-07-05 01:24:57Z dion $ */ public class AsserterTest extends TestCase { public static Test suite() { return new TestSuite(AsserterTest.class); } public static void main(String[] args) { TestRunner.run(suite()); } public AsserterTest(String testName) { super(testName); } public void testThis() throws Exception { Asserter asserter = new Asserter(new Foo()); asserter.assertExpression("this.get('abc')", "Repeat : abc"); try { asserter.assertExpression("this.count", "Wrong Value"); fail("This method should have thrown an assertion exception"); } catch (AssertionFailedError e) { // it worked! } } public void testVariable() throws Exception { Asserter asserter = new Asserter(); asserter.setVariable("foo", new Foo()); asserter.setVariable("person", "James"); asserter.assertExpression("person", "James"); asserter.assertExpression("size(person)", new Integer(5)); asserter.assertExpression("foo.getCount()", new Integer(5)); asserter.assertExpression("foo.count", new Integer(5)); try { asserter.assertExpression("bar.count", new Integer(5)); fail("This method should have thrown an assertion exception"); } catch (AssertionFailedError e) { // it worked! } } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/ParseFailuresTest.java100644 0 0 6505 10500374603 24351 0ustar 0 0 /* * Copyright 2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import junit.framework.TestCase; import org.apache.commons.jexl.parser.ParseException; /** * Tests for malformed expressions and scripts. * ({@link ExpressionFactory} and {@link ScriptFactory} should throw * {@link ParseException}s). * * @since 1.1 */ public class ParseFailuresTest extends TestCase { /** * Create the test. * * @param testName name of the test */ public ParseFailuresTest(String testName) { super(testName); } public void testMalformedExpression1() throws Exception { // this will throw a ParseException String badExpression = "eq"; try { Expression e = ExpressionFactory.createExpression(badExpression); fail("Parsing \"" + badExpression + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } public void testMalformedExpression2() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badExpression = "?"; try { Expression e = ExpressionFactory.createExpression(badExpression); fail("Parsing \"" + badExpression + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } public void testMalformedScript1() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badScript = "eq"; try { Script s = ScriptFactory.createScript(badScript); fail("Parsing \"" + badScript + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } public void testMalformedScript2() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badScript = "?"; try { Script s = ScriptFactory.createScript(badScript); fail("Parsing \"" + badScript + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } public void testMalformedScript3() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badScript = "foo=1;bar=2;a?b:c;"; try { Script s = ScriptFactory.createScript(badScript); fail("Parsing \"" + badScript + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/parser/ParserTest.java100644 0 0 2640 10500374603 24330 0ustar 0 0 package org.apache.commons.jexl.parser; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.framework.Test; import java.io.StringReader; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; /** * @since 1.0 * */ public class ParserTest extends TestCase { public static Test suite() { return new TestSuite(ParserTest.class); } public ParserTest(String testName) { super(testName); } /** * parse test : see if we can parse a little script */ public void testParse1() throws Exception { Parser parser = new Parser(new StringReader(";")); SimpleNode sn = parser.parse(new StringReader("foo = 1;")); JexlContext jc = JexlHelper.createContext(); sn.interpret(jc); } public void testParse2() throws Exception { Parser parser = new Parser(new StringReader(";")); JexlContext jc = JexlHelper.createContext(); SimpleNode sn = parser.parse(new StringReader("foo = \"bar\";")); sn.interpret(jc); sn = parser.parse(new StringReader("foo = 'bar';")); sn.interpret(jc); } public static void main(String[] args) throws Exception { ParserTest pt = new ParserTest("foo"); pt.testParse1(); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/ScriptFactoryTest.java100644 0 0 7131 10500374603 24374 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.io.File; import java.net.URL; import junit.framework.TestCase; /** * Tests for ScriptFactory * @since 1.1 */ public class ScriptFactoryTest extends TestCase { /** * Creates a new test case. * @param name the test case name. */ public ScriptFactoryTest(String name) { super(name); } /** * Ensure the factory can create a script from a String * @throws Exception on a parse error */ public void testCreateFromString() throws Exception { String code = ";"; assertNotNull("No script created", ScriptFactory.createScript(code)); } /** * Ensure the factory can create a script from a String * @throws Exception on a parse error */ public void testCreateFromSimpleString() throws Exception { String code = "(1 + 2) * 4"; assertNotNull("No script created", ScriptFactory.createScript(code)); } /** * Ensure the factory throws an NPE on an null String * @throws Exception on a parse error */ public void testCreateFromNullString() throws Exception { String code = null; try { assertNotNull("No script created", ScriptFactory.createScript(code)); fail("Null script created"); } catch (NullPointerException e) { // expected } } /** * Ensure the factory can create a script from a file. * @throws Exception on a parse error. */ public void testCreateFromFile() throws Exception { File testScript = new File("src/test-scripts/test1.jexl"); assertNotNull("No script created", ScriptFactory.createScript(testScript)); } /** * Ensure the factory throws npe on a null file. * @throws Exception on a parse error. */ public void testCreateFromNullFile() throws Exception { File testScript = null; try { assertNotNull("No script created", ScriptFactory.createScript(testScript)); fail("Null script created"); } catch (NullPointerException e) { // expected } } /** * Ensure the factory can create a script from a URL. * @throws Exception on a parse error. */ public void testCreateFromURL() throws Exception { URL testUrl = new File("src/test-scripts/test1.jexl").toURL(); assertNotNull("No script created", ScriptFactory.createScript(testUrl)); } /** * Ensure the factory throws an NPE on an null URL * @throws Exception on a parse error */ public void testCreateFromNullURL() throws Exception { URL code = null; try { assertNotNull("No script created", ScriptFactory.createScript(code)); fail("Null script created"); } catch (NullPointerException e) { // expected } } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/ScriptTest.java100644 0 0 4513 10500374603 23045 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import java.io.File; import java.net.URL; import junit.framework.TestCase; /** * Tests for Script * @since 1.1 */ public class ScriptTest extends TestCase { /** * Create a new test case. * @param name case name */ public ScriptTest(String name) { super(name); } /** * Test creating a script from a string. */ public void testSimpleScript() throws Exception { String code = "while (x < 10) x = x + 1;"; Script s = ScriptFactory.createScript(code); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); Object o = s.execute(jc); assertEquals("Result is wrong", new Long(10), o); assertEquals("getText is wrong", code, s.getText()); } public void testScriptFromFile() throws Exception { File testScript = new File("src/test-scripts/test1.jexl"); Script s = ScriptFactory.createScript(testScript); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("out", System.out); Object result = s.execute(jc); assertNotNull("No result", result); assertEquals("Wrong result", new Long(7), result); } public void testScriptFromURL() throws Exception { URL testUrl = new File("src/test-scripts/test1.jexl").toURL(); Script s = ScriptFactory.createScript(testUrl); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("out", System.out); Object result = s.execute(jc); assertNotNull("No result", result); assertEquals("Wrong result", new Long(7), result); } } commons-jexl-1.1-src/src/test/org/apache/commons/jexl/WhileTest.java100644 0 0 4140 10500374603 22645 0ustar 0 0 /* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jexl; import junit.framework.TestCase; /** * Tests for while statement. * @author Dion Gillard * @since 1.1 */ public class WhileTest extends TestCase { public WhileTest(String testName) { super(testName); } public void testSimpleWhileFalse() throws Exception { Expression e = ExpressionFactory.createExpression("while (false) ;"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is not null", o); } public void testWhileExecutesExpressionWhenLooping() throws Exception { Expression e = ExpressionFactory.createExpression("while (x < 10) x = x + 1;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(10), o); } public void testWhileWithBlock() throws Exception { Expression e = ExpressionFactory.createExpression("while (x < 10) { x = x + 1; y = y * 2; }"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); jc.getVars().put("y", new Integer(1)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(512), o); assertEquals("x is wrong", new Long(10), jc.getVars().get("x")); assertEquals("y is wrong", new Long(512), jc.getVars().get("y")); } } commons-jexl-1.1-src/src/test-scripts/test1.jexl100644 0 0 326 10500374603 17040 0ustar 0 0 ## ## This is a test script ## if (out != null) out.println('Starting test script'); x = 1; y = 2; result = x * y + 5; if (out != null) out.println("The result is " + result); ## return the result. result;commons-jexl-1.1-src/xdocs/building.xml100644 0 0 4210 10500374603 15334 0ustar 0 0 Building Commons JEXL Commons Documentation Team

Commons JEXL uses Maven or Ant as a build system. The source is here.

To build a jar file, change into JEXL's root directory (see source link above) and run "maven jar". The result will be in the "target" subdirectory.

To build the Javadocs, run "maven javadoc". The result will be in "target/docs/apidocs".

To build the full website, run "maven site". The result will be in "target/docs".

To build the site, you need Maven 1.0.2 and version 1.9.2 of the maven-xdoc-plugin installed.

To build a jar file, change into JEXL's root directory and run "ant jar". The result will be in the "target" subdirectory.

To build the Javadocs, run "ant javadoc". The result will be in "dist/docs".

commons-jexl-1.1-src/xdocs/changes.xml100644 0 0 5675 10500374603 15167 0ustar 0 0 Changes dIon Gillard Consistently throw ParseException in case of a parsing failure, not an Error. Allow for static methods to be called on classes and not just objects. Added Script and ScriptFactory to allow scripts to be executed from text, files or a URL. Added implementation for bitwise operators: and, complement, or, xor. Added implementation for the foreach statement. Added implementation for the while statement. Added implementation for block statements, e.g. curly braces containing multiple statements. Added implementation for the if statement. Unary minus was only working for integer values. Add @since tags to code so we can track API additions via javadoc Support assignment to variables 'abc'.substring(0,1+1) is empty (method matching problem) Support ant-style properties Fix string concatenation broken for variables Implement short circuit logic for boolean and/or Handle any size() method that returns an int Can't issue .size() on java.util.Set commons-jexl-1.1-src/xdocs/cvs-usage.xml100644 0 0 3044 10500374603 15440 0ustar 0 0 Source repository Commons Documentation Team

Jakarta Commons JEXL is hosted on the Apache subversion repository.

The project URL is:
http://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk

The best way to view the repository is via the subversion viewer.

The alternative is to use the native subversion display.

commons-jexl-1.1-src/xdocs/images/jexl-logo-white.png100644 0 0 26233 10500374603 20037 0ustar 0 0 ‰PNG  IHDRæS‹m{}bKGDÿÿÿ ½§“ pHYs  ÒÝ~ütIMEÔ0,ÏãVY IDATxœí]ipUUòÿ½$èÔÌ|P—â̇¿¢EdQ–DT”Áab‰ÈÈ8Ö` 8(¢5Žã P²¹ "‹J‚l"›ƒHdQš"‹£ ÙÈ‚ *ämçÿûÚ·oŸû^pA§^WÝzïÝw–>ÝýëîsÎ]ƃf/Þ̪. Íîï§ÔÕI´YׯžßÍåU+:<Ûˆ·¥µ+û?]}&Âów‘­ýÒ†üdH˜[·nu¢óÏ?999ÈÍÍEÛ¶m=Œz:ûæ·6Ø@ €­[·âðáÃX¾|¹ë¿ÜÜ\äææ"''ÇÕ¾ßm­¬¬Ä²eËpùå—#77×Ó^YY¶nÝŠ²²2gŒ………®¾m´bÅ lÛ¶ ‡vÕÍÍ͵*Nò+ù.++ÃòåËñÄO¨c_¾|9ÊÊÊœ>sssQTTäч&‡mÛ¶¹dMu³²²âצ_jŸäH¼@VV–ÓO<Ó‹z’MQQ‘£Kj“ìˆô………(**ŠÛŸŸ Iy@QQ.¿ürGæ÷ß?žxâ «óöûí|7qèÉ'Ÿ4YYY€ïQXXh>þøcÓÔÔd=B¡ …B&›H$b¢Ñ¨‰F£æ‰'žH¨¬¬,3räÈf÷‰DÌ’%KLQQ‘ÓÖ’%KL$1ápØ„B!³yóf“““cí;''Ç1O<ñ„ÉÍÍuÚ ^‰ßÇÜ·Ï{î¹ÇÓ߉'ÌÌ=÷Üã+gªK‡Æ+ç—ëòí·ßvñÏf6mÚdššš\ýiú¤±oÙ²ÅÜ{ï½®±¿ð Ž\þóŸÿ˜‘#GúÚÐÂ… =r±é‚Æwß}÷¹Ú(**2EEE®±:6”¨]’ܢѨ‰Åb&‹cŒ±sëÖ­®Áßwß}fË–-Ž>þøcSXXèø‚ ÌW_}å9¾þúkGÄèâÅ‹]}Ü{ï½fóæÍ& ™¦¦&óñÇ›Ç{L5Àxýâ*Ý»w7_~ù¥9~ü¸9~ü¸yóÍ7MÛ¶mªÛ¶m[óå—_zâ»´´ÔÜsÏ=Vç@¼~üñǾ„“&Mrñ;iÒ¤„ê0#FŒ°ò*u …Ì'Ÿ|â2ÒÜÜ\³dÉÇ^Hßïýû÷÷Õå¢E‹Laa¡Õ‘.7nܘƒ`æÏŸïÈåøñã¾ã#ž³²²ÌæÍ›]²©©ÉlÚ´É3®'N˜¯¿þÚiË~8U`¾øâ‹.:tÈÅHSS“Óq÷îÝ=ƒž7ožùâ‹/œãرc®Áýõ×fÊ”)V ðöIXýû÷÷ôSPP`ígĈ¦ÿþfÀ€ªb.\höïßïðß¶m[s÷Ýw›çŸÞÌ›7ÏÜu×]j½ &˜£Gš¹sç:çòóóMII‰™7ožSWì„ ÌgŸ}æ:>ÿüsóÅ_˜îÝ»›þýû«ò$E/\¸Ði·{÷îfâĉNŸÝºuSëíÞ½Û=zÔäçç;ã>|¸‹ß‚‚k]W’3éR¢°°Ðe+uIŸóçÏWׇ~¨ê³ÿþqu¹`Á—ãé¢mÛ¶æèÑ£Î!ÇG¶Êû¤ènï‡;Dͱq§&³˜”YYYN Åùꫯ̗_~iŽ;f&Nœèt›6mLcc£ihh0¦±±Ñ=zÔøóÏ?ï,÷0ÔþñãÇ%}þùçŽqñ#??ßéƒúùì³Ïœz¶HA@ïÖ­›Y·nùì³Ïœ6LCCƒùàƒԱ͙3Ç0yyy¦¢¢Â9rÄ9êêêL}}½Ù¹s§iÓ¦§./{äÈS__ïȉƒÔÆï]wÝeöìÙcŽ=êáwüøñžzwÞy§ÉËË3̸qãT^ëëëÍsÏ=§ÖÕÊ766:2þè£\9`ÀW ÌõyìØ1G—%%%ªl?øà>9`4Mý˜]»v92©¯¯7uuu¦®®ÎtíÚÕSoΜ9¾ã[¿~½S¶{÷îNôÓìôرc®òšC“ ç•àt-þlݺ=zô ŸøôÓOѦMc‹Å‹ÅœïôyøðatìØ’Š‹‹‘——àÛ…‚@ €ŠŠ ôéÓÇ)×½{w¼ùæ›ÎïoÒkç ¾èèܹ3ª««Õ¾ø‚DJJ RRRè\øÜsÏm!yÌÏÏÇܹsÕ±7ÅÅÅžñõë׳fÍr~ó1ÅÅÅ7nœ«ÞªU«pÙe—9¿‰Gâ755«V­Â!C<}Î;7Ýt“‡WÎo·nÝ<ò€Y³f¡_¿~¾üÞtÓM(//wÊdffbûöíž:œ×N:¡ªªÊ)³ÿ~gDò(¿3Ï>û¬‹Ï¼¼<»ø¢>€U6Ï=÷òòò\¶J<cPQQüü|W®CÞoìØ±xæ™gX°`€ÇF©OøóŸÿŒÕ«W£¾¾ÞÕ—”ÿ.@ U4Æ`àÀNC÷Þ{¯Êh4ŠX,†h4ŠH$‚H$‚p8Œp8ŒôôttéÒÅ#¨Ž;" ¹Žp8ŒGyÄUîÎ;ïtÚäG8F(rõ‡Aqúç?ÿ‰P(„¦¦&4559u©ÏP(”*ëtíÚÅÅÅN9ªË¿755áúë¯÷ô×¹sgL:'Ož´MMMªÃ:tè«}*ËùŽF£žzãÇG¿~ý\üJ^Ož<érzD=ôz÷î­òÈyèܹ³«^MM«}.£P(„3f¸@YPP€ôôt«>é ½Œ=™™™®>׬Yƒ²²2W_¼Ž&›qãÆáÆoTåAckß¾=222\õÊËËU]P_|åõÝwßuÆÂq@c‹D"…BŽóãö§É#:¸’N`Àœ:u**++F 0Æb1•ô¬Y³\ž>}:Z·níQƶmÛ\8åµd{tÐ`ù¹Ž;z”YSSƒÙ³g;ýpãùÜ)”‘‘áüO ኤïíÛ·÷B0ô%µ‘í©»víZ«±ŸˆÏÙ³g»ÊæååY(Feúöíëésܸq.ýq#‘ˆ§|ëÖ­¹4ÇQÖÖÖzÊð飯ªÂôéÓ]¶ÉÇIã"ǨÉA“ð¥e?iÀ)¤.[¶ÌÅt·nÝ\ˆ–(ç žwÞyزe ªªª‘‘c Âá°g¯Q¦„—]v™GÐZºL¨$c B¡K.@iiiÎaÓÆ¯ ˜äÑ90äœÇLê—ø¥²Ü`‰(rq9ÅÓg‡‘‘ÚÚZW[ååå¸îºë<¼ÚdCÑÔÌ@  f"œ_Ì´´4ôîÝ“'Ov•;v,V¯^Q£F¡S§Nê³³³‡]ú• ¤þx¿3iðÎ;ï¸:oÛ¶­ JNé­IØr2L¿ëêê¦3/øŒ©©©Î§mÌü))).o/brprçÀ·.7!l†Ku‰¨Žp*ú”…Îq^©½Ž;zÚÛ±c®¹æ—.RRR\¼QËI²áýh“ë‚dB™KË–-qÛm·aÁ‚®:0`:wîŒ'Ÿ|Á`Ð5FmÑ*55Õ3 7Di°mÛ6WÇ”~‘ðüX›°ÊºtŽƒ÷ý÷ß÷…R^"ài \xééé8r䈫½êêj\tÑEžz~““÷/êñìË€”šššªÕ•ãKKKsÎÙ¢‚œ«.øXµº4‘Ž„!9[]âä¿{÷nOY[öõ¶œžžîi«¶¶Ö ï7Ñl‚Û¨‚¬ëZtùFÄûÈ‘#Q[[‹uëÖyêîØ±½{÷ÆàÁƒqë­·" :ÿÙ¦4ä ø¡ñ–fŒq­>‘Pm+OÒå²6'Ê™mÄ•®åêR¨|€:uÂo¼áá› šG­oZ哈÷«Õ%CãÆÎÛ%~µˆÉ# —œ“ÙdÅÊû&^5gÀ§Ò‘Äb1g~k««Z#Š˜r*#³‰@ €N:y¢ÉAÌ/•åÑ’“d£Ù¢\WÐÒʉ'"== .TǽhÑ"¬[··Ür  äÉÖ´È-Ì<½V‡SKÃ2bÊÕ%™Çks¹o#iݺujû2*hi‰FdÄ7_ ”D†®­˜Ùú•}qi‹cš¡óº<…–}Ûø•KöÚ‚G<^mumüjë ½ú꫞-2[úÍÁf#Î+ß>“F}íGs„Úøxò9r$JJJÔèuuu˜>}: PUUåÁŠäCK_IWÀ7Û%òϪª*kÄÔ&Ø$`>g¡ tjjª5òhÂ×€L5l@ƒžhOíH¢èª¹¹ýH¦l‰Ô•% %oÚœ X<«Ñ¢™ŸÑR}îL4Ç|¹´ýk)_ΗféééGK‡&›£áNÀ¤d{ÑhÙÙÙX»v-î»ï>k;õõõ>|8Ö¯_¯â…g-rŽÉIG €—_~Ù3Ç´EK2_ö竌iii¸ñÆÕ~Ö­[§z)MÀÔÍËfgg{ŒÝ¦Lndš"ãªÆG¢@–@‘É67•Æ#WlrÑæuß•ß+®¸ÂS®´´TÍ~ø4HÚŒMŸ´,#™_ª.39>­96jËšgOÑhƒ ªU«0hÐ U^õõõ˜5kjjjT矈CL1Æ °°ÐóGqq±šbi“ ˜@¹k×.¤¥¥¡E‹hÑ¢ÒÒÒˆ?~M5QCCƒ%üæX²Ý×_ÝÕNÇŽ‘‘‘a•M66Gåç”l‹—ÆLš4 +V¬ðm¿uëÖ=z4~øaOÛ›6mR3ÁxóNà›ˆ™““£Þñ>räHTWW{@£Í…hP;vìÀðáÃ1{öl0ùEÔD»wïÆîÝ»] ±1Kýh{h×]wêýüÒ?E°«\äâå1thÉO¼#‰Üœ'¹|¯&ç•oU]xá…hÕª•§üK/½¤ÎÏlsoMŸ×_½‡'­%Ù€Ãùµ­qð5M†~ø¡Ú®‹7¢´´6lÀÔ©Sqà 7`Ê”)€™3g"33ÓêÁÚ´iƒ§Ÿ~Úóߣ>ê|— 2üܼy󜋧333‹ïýÀá'tÍèdäÔÈ~ý& ÞD(‘þx9nTòüéï}÷ÝçIiŸþy444xÕäQ[[ëæôéÓq饗ZÇ•(Z[]M’–/_Žºº:5Øpp=zÔU¯GžÕ]¿´–;-—›,((Àœ9sTæ€S9óË/¿Œ‰'âÑGÅØ±c±dÉçÒ¸©S§¢OŸ>q÷ûöí‹ýë_®s{÷îŤI“œß2jcðúë¯; 33Ë—/Gff¦jx\xR`D~¡ÿä ¯ÔËÑd6C8räˆ/1jŸ~ÄÇÐÐРòk3ðxŽ2[¹V­ZaâĉpŽ5 ¼YòÖ[ouÊϘ1}ûöUçr\—Ô&'m £tÏž=Ípj…uÆŒž¨I‘’€ùÒK/9u®¸â ל“g¶¬Ó3ÇäLåçç»îÌO„‚Á &OžŒk¯½Võšbúôéƒ ¸Âÿ–-[pÇw`õêÕ.¥–––â/ù þñ8u£òÒ¥K‘‘‘¡.îpp¦¦¦z.Ò§¾}#] À[o½å©[WW‡ÒÒÒ¸véÒ¥žº»wïV/èç$ç5<·åÙ¢|ii©§î† | ÎiünذÁ—×@ €V­ZaÒ¤I¸üòËó>|8,X€ýû÷8¥Ë={öàé§ŸF¿~ýpäÈdddàé§ŸÆ7Þh%ç¿ÿýo«V­Š›únܸQuxš¼4*--ÅwÜ]»v¹ø¡‹hžyæçQ W]u~øa§‘1î‡ø-Âá°¡½>ºr£©© Ÿ|ò î¾ûn|ðÁ¾ bРAÈÊÊÂYg…³Î:ËÙ·$`HÆø… ¡PóçÏÇ’%KâFŠ:à@—.]oEá7I‡Ãa¬_¿uuuØ´i>úè#µ½óÎ;_|1zôèáZe¼ýöÛjÔ€öíÛãâ‹/F»víœ4 8uwаyóf« ƒÁ zöì‰víÚ¡]»v8÷ÜsœzœÌþýû}ëfgg£gÏž8÷Üsñÿ÷8çœs+£Ó¾}û0wî\Œ6 ƒ¸í¶Û0dÈÇVÈ0érJÒçÎ;±{÷n¬\¹Ò*›óÎ;=zô@»víÑØØˆƒâwÞÁ–-[¬¼´oßW]uzôèáŒ-àñÇGcc#‚Á RRR§§§;7]c°~ýzgL7ß|3 àà‰oZ´h³Î: ¿øÅ/\ÇO rê@®•#º“ûĉøôÓOQ^^Ž7ß|Ó‰N­ZµB»víгgO¤¥¥9}öÙ® (Ä“ÒÈ´þB¡vî܉]»v¹ :%%×\s :uê„óÏ?ß|jS^Ò …0fÌÏj.ÿ”~B^BG&--ÍašÚ&ó¼_mâÊÙ@´ 9^jjªkLäd¤# kAùUPüŠ'ž=p§$ŸcCuµëŒ‰ø¢“ò¾½ÚŠxåuiœÚR=É—äIã%gJcå¼òËëH®ÔÜØ‰8Ÿèàãä}Ê…Û&w’œ7Ù'Ɉœï‹ú!Û“v-ƒ Ÿ;jÊH;$y 5`¦ÙVš8èä£/\¹p à0¡ ‹§´rþFçyyÞ•Ó¼b,s)“—çcà`ãž’§ò\¡ȶù¤¶ÈoAů®ü~óñiuµ¶m¿å8´ß~¼ÊŹI/)#«tŽrœ2E–Ó!Î+Ï­v<ó°YÊ÷ŸÙ¶š¨M™ÎJ-{±íùÚÆÂù%Jc#Ò.Á“ L5é<¥ÌÜÆ‹¼Œ¶à£)S’œ›Hƒ³Úãç%@¸Ò¸!HÃ’•;ÀuðsÜ‘È,ƒxæ"W 5ï-Ó|.W9'æòâÆJýÈi‚œ?K]p=nEê‘Ú$ûãºæ¶ªE'.7©3Þ­®Ì:¤ÃçAGÊ]S”äŸÆ…¬EÌ-Z¨ PTã—³yl9y–†Ošµy¯/•+IòB©çIz>?¥Èù)ñ&So>?ç Ušc‘‹~©¡ä•êhJ溕Ñ%žçui¬ZD•c•LFM›.Ɉ¤ü¨íh4ê²éœåZ ˜4ͲéB[gñã•GO锸=J`J‡šÆ™’)‹D;ª¶:ÈSi(rµQ „öô p™ÂpAi©õ%‡L94`ÊH ûá·Õ劑u¥áóÔŠˆ"­–ÚIpqjR.Õ—ýrÝʱj™E¼tVÎ¥yôá€×ô)ù§v#‘ˆ‹?0¸,9°è?éø¥.¤ƒ•)/' N[ÖÈåm‹š®9&)œƒ³E‹`¤¦¦ª¨d”`Ú!=+åú|©™~ótˆÈ–ëKã·EDj›{)m¿‰œŒL£9¸å‚õÅ•(ërÒœæ8¨L4EZZšÇ kààõøXej¥•3ѺZ*ÌÍÉs;úÔtIe¸<øøù¦KÑi|š.¤\©¾L @ÞŽ-SЂ—c?Ò{r¦e˜O˜š‘ðÎýRšËðv¥°¸@¥W†T¨…dêMÆJuø—4­.'w<šò$ï”zIgÅû’ –ÎÈ–…ð±r“ñÏÚÞ°œcÊúr¾)Xê’ÿæ2àmsy8i||n*ÇÇÛ#]ÊCf/¼®Ô''-BÒy>.¼´9º+•å†EÄ…AùU RY2“©¬ô Ò³’Ép):HcÒ”éJ.$ž6S_¸´èEmð=ÛÊ£­.Õ—u¥Aò±ÊºÜx?Òé‘ñѸej)‰¬KZs"rœÚüKFÍqãÆ¡ºº}ûöE¿~ý\ À” ”6#çõd3~ú ²é‚ëAœGàÔSãŸ}öY :]ºtñdxÒVwF%ç®®T–£š#[k”çLéä" 7<ò9PÈðmiü´¥°˜\‰¼?M)Üð¥2¥‘sÙq^è;•ñ««É[3pIXšñiNŽêJ^¥Ã´9HÍ!pYqÞéàÔ»fRSS×'ʨ"å/Ïñq‘ÅoK“©_ªÍÇEŸååå5jÞ{ï=§n‘+ÉšN9yzì.¯È…“’â^ÙâLj©ÍƒÛÒ,Íx¨Ù¶˜$ Œ~Àäž–Gú_³$É—4jõ傋öÉËhuü²j’_[DÑêqÞlz•N—@IôÊ+¯`À€ÖñH@J§ÁÇ%AÉÇ'e¤9-?=J‡¿jÕ*Œ5Êõ BàÛE?)/Þ——ÌP¸ìÒxÃZää‘þ'ƒÖ¢™f”šâ4ÃãmSÙx‘B¶¥)‚“t>™má ” ±ñæç8¶qIÙð:ü3^Ü€©ž6Ïk.¿²o-SѨmÛ¶.cÎÊÊr?~i¶f‹~ÎNã-Q=Òqùå—ã£>ÂŒ3ðÐCydáL- Kgàz£4gT~òkBˆ7 ›òüŒÝOhš"5áKïHä§H­]´(ÂûLÄÐe]ɳƿ¯§ËosêjýÒwmn œ’÷áÇѫW/TUU¡  óæÍóØ”lKÚ ß¶’ùtuO.|<<@cð«_ýÊ)?oÞ<äçç» 'î\heyÛ@À19C|àÒÈ(—ˆ¡Ä󨼜 ¤ñH¢$j¢$?Gß5`øÄ6~íS«ãW_ã_#¿±Çã·9u3Äh IDATé»ÇÃ' ûßüæ78xð  ˆ”~rû¢>¸½IçÎ3+)Ÿxº”dÓ…Ÿe6¢µ/£&“þãÑžï[IÚ¦E5­>}jÊò’ ¤~”HÛÚxÛšRl¿› , L[=¿vNW²^<~­œ¼_È£‹¤,¸N´y=•ósðÍÑesäÂëhé·ì›O$Ï4~Hj—¾[)™‘ßmƒÓêÛÎi ”Fáçá]÷`‰ŒÁ×Óá§¹õN‡ü ¶¹õOG6I]jà’†-m…¯­ÿDíD‹x‰”—Ÿ’x St4ü<Šrò&gŠ:µ'^]ÛïDÿã}~ßí5ô‰¶ý}Öû®ôCó›h9%åæ>'CæÑE.üÈ(Ý 5×Aj ÔÚ m8¹•Hã¡I×kót–'!`ý˜l«û] û»òócD¼Ÿ#5Ç©jÓY†Ï½´sZß?†~%'_äáÎ(øöÓÔ~³€©1ùs§ï+EN’Nš>|Ó¦MC›6mð׿þ€÷¢ 1+++ñÞ{ïáå—_v››ëR/‡FYY™¯¾ŠŠŠ\¿ËÊÊPYYi-ËçÁ890åcEŒÜ9Ñøä‹ïâO’’ô}See%¦NŠiÓ¦8õã;ï¼Ó1V¹Ñ‹ÅPSSƒââb<óÌ3èÖ­²²²PYY‰íÛ·cÅŠ€œœ,^¼Øõr,jë©§žÂ¶mÛ\|deeá±ÇsÝïKu–-[æ´Km9Ò³ÿËxˆèœ ˜Úå­6«û˜IJÒ÷EÆTVVbàÀ(++sýWPP€¹sçzž­JTSSƒüü|Àܹs‘››ëôöíÛqÛm·9.++ ¥¥¥êk>þøÇ?båÊ•Îï`Ñ¢E.9ýò—¿,\¸………žu~üú׿vþ›={6úôéãyý ¿›„?ª’Ư#÷¿Ë8IIú(++ /¾ø">ýôÓ„ÊcP]]üü|TWWcíÚµèÚµ«ëbünݺ¹F]YY‰Áƒ«¯!˜7ož °+W®Ä¡C‡<¯Æ‹D"xê©§óçÏGAA:g¤CF\1µ§åÉ×jÑÒÙ.:]a')IÍ¡¬¬,dee!''ÇóŸÜS6Æ`Μ9¨®®ÆÐ¡C‘™™é%zzºë5Û·oÇòåË=oÖ ‡Ãž7ÄõîÝÛóÏC‡aæÌ™ÈÏÏG^^žúM¿w·òUXmeVÛJ‘ã'J3I?*É—$ËÔ0‹¡ººÚy‡N¿~ý\`äs¸H$‚›nºÉÕÞÊ•+Õ×̃AŒ7Î)WUU…Ûo¿ÝUî†nÀe—]†ââb×st5€ÊgRÑXl@”çmsK¢äâO’~pÒ®ÆÑÊá®Y³Æ9_UU…êêjgÁD®²–——»~¯Y³¡PHÝï¾ãŽ;ðî»ï:ï?Y½z5:wC‡bذa0Æ`ôèÑ…Bž=RÛ];¶1HàÑê«í6FII`&錒Œ*ÑhÎÿÇov›¡PÈipïs>üðÃ(//w^å8~üx¬Y³µµµX¶lZµjåÔç€Lœ2çä{¬¶y%?—f’Îi ŒÅbxõÕW2ô |žÆ¯²EÌ””´jÕ Ó¦MÃÀÿÞÿ}<õÔShÕªšššœòÚm‹ÚÅ~÷½Úd QrŽ™¤3Jr.&çm|ŽGï·áïü.z7Nvv6xàW?¯¼òŠ«]zìK¾¦ÝoL¶s~ilrU6I?*Ù¶䢎4öŠŠ  4°qÐøün"‘®½öZW?o¼ñ^}õUW›òHdñÇÍ¡$0“tFIn/ð—S§ÒLµÈ¨­žÊïÑh÷ß?:vìˆôôt§¯|UUUž>x4æ Ô@(ÉvMV”<ðŽ9‚É“'£¤¤ÄÅÏСC]íÙÀÎç´?%™¤li_4‰ÅbÈÎÎvÊÔÕÕyÀé–iÓ¦Y·,Œ1X´hÖ¯_’’¤§§# bäÈ‘®þÆŒ÷‚D÷]( Ì$Q’àŒF£èÕ«—«ÌôéÓ±nÝ:PäBÌ /¼€ììlϼŽ@²aÃL:S¦LAff¦“f<¿ûÝïœò7nDii©ç’:íÒ¼æR¢€M3Ig”´¨Ù«W/´nÝÚUnìØ±X²d‰gÎHdž 0sæLÜ|óÍàÙ{lhhÀÔ©Sñ·¿ý }úôq=+%%÷Þ{/‚Á Óߣ>Šºº:€2…M¦²IúŸ'™nÆb1õ‚gžy·Ür fÍš…ÒÒR”––bÙ²e¸ûî»1nÜ8Ü|ó̓žýÇÔÔT 2pûí·»žsLàÌÈÈÀˆ#\ýM˜0Á“f˹«6–$é'Cøàƒ8räþþ÷¿{Þ|ûžÌk¯½K–,Áž={{÷îÅìÙ³1lØ0(éš^Nµµµ®qHjμ31“ô“¥ž={bÔ¨QqË]uÕU=z´ëò·@ €úúz<øàƒX¿~=àƒ>@]]çUtìÙ³õõõ®¶_zé%£®®Î5kjjðøã»ÊΛ7;wît~'²b£äÒIúA‰GÁh4Š?üáÎMËyyy˜1c†s• ]i‡]󹺺:¬\¹{÷îÅÞ½{¶¯¼òJ 0íÛ·wÒRþf¹GyÄó¾‘@ €!C† sçή§’’ìܹSÝb!8p :tè€+VàÃ?´^&hŒÁäÉ“‰DœßÄ_‹-œ›¤Ï>ûl× Ó®·€ýÊIR’N—‚Á † @¿‚ˆÎóÿ`Ê”)ž·ÌI Ñóvn¿ývußR>ƒn¹å´hÑÂó6h¹'ËŸªGc‘c³¥·I`&錑| ˆ|Þ¬ö\Yú®-¾hwwØÚ¥öèa_|¡ˆ×µ]ác[™µmÕhcô£$0“tƨK—.¼‘C¯vG‰|ÿ_’v§ ï‡?ˆY{ÁýÖ@åwA:w&~/^Ò¾'™¤3F]»võ(ò åòÞF-*ò²‰\@Îûâ¯+¾¿½L{U¡_›D|‹FÞ>Æë%™¤3BݺuC›6mÔûy#"£¥ÈÆ÷y-2iÆÏÏÉHpÞËÉk}}^àÛ§ÆÓ'O•å… É9f’ÎUVVºæ’Û·opêÊ"-µ”Ä&¯âàÔ¶Bl7;ó¶ø9¨RSSy&ïGÛná¼ÒÜ•——oU—W'qJ3I?(õèч¬X±•••˜?>ºuë†p8ì*k‹”šñÊ^Q9Ú2ÑÀÉ·Nø‘ƒ’G=zS•Óø’ÎDGKÍqÈHžf’~Pª¬¬Äoû[äææ¢¬¬ .D~~¾JÛŠ)ßÔ¢ ¿¾žêó=AÚßä)¤|A‘Öž¼üN¾âÀ/eÖxJIIqí³ú-%™¤ŒŒ1ÎûA ±hÑ"õfhVðÙæeò¶.¾rJe$8eô”¼Ò9™*óm‘xÛ0T†Jž88y 튜?á+ ;¼³ó$ýä‰1ßxç·mÑÍÏ|cŸ_-CßÈ×úà}qðÅKýxÖªm½øm£Pâ‹Æâç4ŸöK…ßÀ·M^Ûû?Hܰi>ÇSNíÊmËD¶É£”La5pʽKú䀴]@à·}¢ñ#·O~®©,Ô|óE2Šþ,I‹8€tŽG<>O´EMþÉܶH¤2ZòKíâ‘6ŽÁ.À$"î“ ü‘Õl‹=ümGÛ?´EL¿ãtøwÁ‚_»Úxµçäªl’ÎÙ"–ô˜~àäíÈï@ ´Kò´~³Ö¿m«ä§>ÇLÒÿÑœ¾kÑR–‘Àä¿©L¼>µÔ5‘ˆéz[„N„l‘;1“ô£“Jú.畼Žmå2ÞÊ*oƒÊïÍ!?p6”Zyí|˜IúQ‰§qòøþ>Éo!êÿªŠ)ÝjIEND®B`‚commons-jexl-1.1-src/xdocs/images/jexl-logo-white.xcf100644 0 0 50023 10500374603 20025 0ustar 0 0 gimp xcf fileæSBBK/ gimp-commentCreated with The GIMP¦¯å% N0>'jexlÿ     ˜$JO>'c>'s r r rüªU0ü8ª8þªÿÿþU-ú8ÆÿÿUÿþª+ýUâÿÿþUþâÿÿþ+üqÿÿþUûâÿª/ÿþU8ÿþU8ÿþU8ÿþU8ÿþU8ÿþUüqýUªªýq8þUUþ8UUÿþUúÿÿªùÿƪÆÿÿýÆüUÆÿÿýâUý8ªÿÿýÆUÿþUýÆÿÿþªûââ8ù8âÿÿâþªÿÿþªÿþUÿþUÿþªûâÿþÿÿþÆþâÿÿþüqÿUÿþUûÆÿÿªüÿþªÿÿþUþÿÿþâüâªÿþUûªÿÿªûÿÿ8þUÿÿþªþqÿÿþªý⪠ÿþUûªÿÿªüqÿÿUUþÿÿþªÿÿúqªâ ÿþUûªÿÿªþªÿ ÿýâÿÿüÆâ ÿþUûªÿÿªÿþ8ÿÿþU ÿþUûªÿÿªÿþqÿÿþª ÿþUûªÿÿªÿþ8þÿÿþU ÿþUûªÿÿªÿþqÆþâÿÿþ ÿþUûªÿÿªûâÿÿâ þ8ûªâÿÿþâ ÿþUûªÿÿªþªÿÿþqþÆùqÿqÿÿþªÿþUûªÿÿªþUÿÿþUýqüUÿUþªÿÿþUÿþUûªÿÿªþâÿÿþqüUÿüâqýâÿÿþÿþUûªÿÿªþUÿÿ÷âUUqÆÿâþUÿÿþÆÿþUûªÿÿªþUÿÿþªüªÿqþÆÿÿþþÿÿþqûªÿÿªþUÿÿþªùªÿÿªý8âÿÿýýªÿÿýâ8ûªÿÿªüÆÿÿýª8ªþ8þqªªü8qªªûªÿÿª8ûªÿÿ8ûªÿÿU8ûªÿÿ8üªÿÆ5þüâÿ85ùâUÿU6úÿâªâU7ªþU9\EDrop-Shadow#2Ì     ‘KY\EqÙ\E¹ÉR7þ2/üú þ ÷÷ ÷  ÷þê üõ õ ýè  üç  ûæ  úô õ û ç   ú õ !!ö ú õ  ""÷        ú ê  "##!  ü ûã !#$$# ýûë "%&&%" úúüê  $'))(&# ù "#$$ý#"!!"#ô"! ë #'*,,+*'%#!!ó#$&')*+,,+*)((ý)*++ø*)'&$"!  þ!ò  %*-00û.,*(''ø(*+-/0233ü20/..î/0123321/-+)'%$#$ë "(-1455420/..ø/124679::û987544û578:;;õ9752/-*('&ì %+159::98655ø689;<>?@@û?=<:99î:<>@ABBA?<952/,*(Æ  '.49=?@?>=<;;<=?@ABCDEEDCB@>=<<>@BEGHIHFC@<73/,+ì ")18=ADEDDCBBúCDEEFGGúFECA@>>î?BEHKMNNLIEA<72.,ð #+3:@EHIIHIJøIHGFDB@>>î@CFJMPRRQNJE@:50-ð $,5=<=?BFJORUVURNIC=72.ï %-6>EJNPQQRñSRQPNMKIGEC@><::î=@EJOSVXXURLF@940î %.7?FLPRSTTUVÞUTROMJGEB@=:8767:>BHMRVYYXTOIB<61Æ %.7@GMQSUVVWWXYYXVTPMJFC@=:754347;@FLQVXZYVQKE>83ê %.7@GMQTVWWXYZZÞYWUQMIEA>:74211248=CIOTWYYWSMGA:6Æ %.7@GMQTVWWXYZ[[ZYVRNIEA<9520../26;@FLQUWXWSOIC=8é %.7@GMQTUVWXYZ[[ßYWSOJE@<841.--.038=CINRUVUSOJD?:Æ %.7?FLPSTUUVWXZ[[YWTOKFA<730-,+,.26;@EJNQSSROKFA<Ú %-6?FKOQRRSSTVWYYXWTPKFA<830-++î-038EJMOOPÛRTUVVUSPKGB=830-+**,.148=ADHJLLJHEA=ð $-5=DHKLLKÚLMOQRSRQNJFA<73/,*))*+.148;?BDFGGEB?<ñ $,5@AAü?<:ì $,4;@DFFECA@@üBCEGGâEC?;73/+(&%$%&')*-/2479:;;:86Ù #+39>BCCA><:99:<=?@@?=:73/+'%#!!"ñ$%'(*-/1344321Ú #*17<964212356787530-)&# ð!"$&(*+,--,*Ø ")059;<:740-+**+,-.//-,)&# ÷ "$%%þ$ä "(.368752.*'$#"#$%&&õ%$" øþØ  &,03431-)%!öè $),//.+($ ÷   ÷ç "&)**)&#ú   û  ç "$%%$!  ù   æ  !   ç   ç  ç   ö ö &÷  õ 'ùö)üú+03i«  üþü ûùù  ö ø õ ø õ ê  ê  é "$%$" é  $(*+*'# é$)-010-(# é"(.25651-'  é%,169:950*# é"(/5:=>=93,% è$+18=@A?;6.' è!'-3:?BCA=70(  è $)/5;@CDC?91)! è#&+06BEFEA:3*" è)+.38>BFGEA:3*" è*+/38>BEFEA;3*" è+,/38>BEFEA;3*" ,ê/38=BEFEA;3*" -ê/38=BEFEA:3*" -ê/38=BEFEA:3*" è/.048=BEFEA:3*" 0ê149>BEFE@:3*" è2135:>CEFEA:3*" è5347:?CEFD@:2*" è7568;?BEEC?92*! è977981)! è:889:5.& è98779;=>=;72+$ þ755ì689:973.(" þ422í45542/*% ý/.--î.//.-*%  é)(''(())(&$  ý#"!!"ñ!  ýñ þò ó   õ þ ÷     ó@@@@ŒŒŒŒ."×commonsÿ     ‰×¥$õ%×ÁÆÄ#k€€€ý8qªªüUý8Uªªýq8üq8ýqâÿÿýª ýqâÿÿüâ úUªÿÿUõ8âÿÿ8ªÿÿþUôUâÿÿ8qâÿÿþUüqªÿÿþUúUÿÿÆþÆÿÿþUþqÿÿþUþªÿÿþªüªªÿÿüUÆûUÿÿâþqÿÿþâþUÿÿþUþªÿÿþªþqÿÿùªÿÆ8ÿÿþþÿÿþUþ8ÿÿþÆ þâÿÿþUÿþªûâÿÿþÆÿÿþþÆÿÿþU þ8ÿÿþâÿþÆþqÿÿþ8úâÿÿUþ8ÿÿ þâÿÿþqÿþªþÆÿÿ þþªÿÿþÆ þÿÿþÆÿûªÿÿþÆÿþª þ8ÿÿÿûªUÿÿþªþÿÿþª ÿþ8ÿûªÿÿþªþUÿÿþª þâÿÿþUÿûªªÿÿþªþUÿÿþª þªÿÿþUÿûªªÿÿþâþUÿÿ þªÿÿþUÿûªªÿÿþUÿÿ þªÿÿþ8ÿûªªÿÿþUÿþU þªÿÿÿûªUÿÿþÆ þ8þâÿÿþ þªÿÿþÆÿûª8ÿÿþ8 ýUâþÿÿþÆ ÿþqÿþªþâÿÿýâ ü8ÿ8þ8ÿÿþ8 þÿÿþÿþªþqÿÿýªü8âÆþÆÿÿþ þqÿÿþÿþªþâÿÿýâ8ûqÿÿþÿÿþûâÿÿâÿþªþUÿÿýâUUúâÿÿUþUÿÿþÆúqÿÿâÿþªþUÿ ÿþUþUÿÿþªúUÿÿâþÿÿþªþUÿ ÿýâU ý8âÿÿôâqUÆÿÿÆþqÿÿþýÆÿÿý ýqâÿÿýÆ8üUqÆÿÿýâªýUªªýUý8qªªýU ª€€€ù8qªª8ùUªª8 ý8ùUªªqùUª8ÆÿÿýÆýqâÿÿýÆúqÆÿÿýqâÿÿþýÿÿþÿÿþÆý8âÿÿþâü8ÆÿÿýÆÿÿþqþqÿÿúâUUÿÿùqUÿÿªUUýâÿÿþqüƪÆÿÿöUâÿÆqUUÆÿÿùªÿâUUþ8þÿÿúâUÿªýâÿÿþâþÆÿÿûªÿþqÿÿûªÿq þÿÿþªþqÿÿþ8þUÿÿþUþâÿÿþU þ8ÿÿþÆþ8ÿÿþUþUÿÿþqþÿÿþq ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU þÿÿþâÿþÆþqÿÿþUþqÿÿþ þqÿÿþUþqÿÿþþÆÿÿþÆþÆÿÿýâøU8qÆÿÿ÷ªU88qÆÿÿ÷âU8UâÿÿüÆUüUâÿÿóâUUª8qª ªûqqª ªýq8ª ª ªü8ª€€€ªýqüUªªýUü88ýqªªþUÿþ ý8Æÿÿýª8 õ8âÿÿUÿÿýâUÿþ ùÆÿÿÆUýUÆÿÿþªüUªâÿÿûU8âÿÿûUªÿÿþú8âÿÿªþUÿÿýâªÿUøÿâUUâÿÿþâþUÿÿþúâÿÿªþUÿÿýâþªÿÿûâÿªþÆÿÿþUþÆÿÿþâþâÿÿþþÿÿþªþUÿÿþUþ8ÿÿþªþÿÿþqÿÿþª þâÿÿþ8þUÿÿþqþâÿÿþâþUÿÿþUþâÿÿþU þÿÿþÆþUÿÿþUþªÿÿþUÿÿþUþUÿÿþ þ8ÿÿþþUÿÿþUþªÿÿþUÿÿþUþªÿÿ þâÿÿþUþUÿÿþUþªÿÿþUÿÿþUþÆÿÿ þªÿÿþþUÿÿþUþªÿÿþUÿÿþUÿ þÿÿþªþUÿÿþUþªÿÿþUÿÿþUÿ þUÿÿþªþUÿÿþUþªÿÿþUÿÿþUÿþU þUÿÿþªþUÿÿþUþªÿÿþUÿÿþUÿþU þUÿÿþþUÿÿþUþªÿÿþUÿÿþUþªÿÿþª þUÿÿþUþUÿÿþUþªÿÿþUÿÿþUþÿÿþâ þUÿÿþþUÿÿþUþªÿÿþUÿÿþUþ8ÿÿþ þªÿÿþÆþUÿÿþUþªÿÿþUÿÿþUþâÿÿþ þÆÿÿþqþUÿÿþUþªÿÿþUÿÿþUþqÿÿþâ þÿÿþâþUÿÿþUþªÿÿþUÿÿþUþÆÿÿþqþÿÿþ8þUÿÿþUþªÿÿþUÿÿþUýâÿÿþþÿÿþUþUÿÿþUþªÿÿþUÿÿþqýâÿÿýâúâÿÿUþqÿÿþUþâÿÿûÆÿÿþÆýªÿÿõ88ÿÿâUþâÿÿþÆþUÿÿüqâÿÿûÆqUý8Æÿÿýâqü8qâÿÿ÷âUUªÿÿ ªþ8ýUªªýq8 þqª ªþ8ªªVVV ýUªªúU óÿÿ⪪ÆÿÿªÆÿûÆÿâ8ý8Æÿÿûªÿÿ8üâÿÿû8ÿÿÆü8ÿÿûÿÿªýªÿûªÿÿâýUÿþªÿÿþqþÿþqÿÿþqþ8þÿÿýÆ8þÿÿýÆ þªÿÿý þÿÿýâq ý8âÿÿýâ þqÿÿýâU ýÿÿýâ ýªÿÿþýªqþUÿÿþ⪠þÿÿýªÿþÿÿüªÿqÿþÆûªÿâþÿÿþqûªÿÿªûÿÿªþªÿÿýÆ8öÿÿªÆqøªÆªªÿÿ⪪ÿýâqªþ8ý8ø8UªªUk 5õ8 Drop-ShadowÌ     ÿÿÿúÿÿÿú9%µõ8%ÑNN$õ8%í0=:êEÁU  þþþþ øúùù ô  í     ù  ò ÷ ø ø ×  øî ÷ôøí  !#$%%÷$# ó!"##$%%ù$" Ð  "$&')*+,,+*'%"!#$&'())*+,,ú*(&#!é !$&(*+-.0122ç1.,)&#! !#$'(*+,--./02344ú31.,)×  #'),-/01346787642/,)(''(*,./11223û568:;;û9752ß !&*-/12334679:;<;9742/..è0245677665668:=?ABCB@=:ð "',024566Ù78:<=>>=;97544579;<==<:9878:>á=;:99:<>ABCCB@=;988:=@EIMOPONKâ &-38;==<:8655679;<=>==å>@BEGIIHFC?;9779<@FKPSUVTRÅ $+29=@AA>;853223579:;<==?ADGKMOOMJE@;7556:?EKQVZ[ZXé  (08>CEED@<830..Ü024689;=@CGLPSTSQLGA;63237=CKRX\__]à $,5=CGJIGB=72.+))*,.1369<@EJOTWXWTOHA:40/04:AJRY^abaè '09AHLNMID>71+(%%Ý'),/26:@FLRW[\[WQIA93.,-17?HQY_cddà  )3=ELPRPLF?70*%"!!"$'*.38?FMTZ^_^YSJA92-*+/5=FOX_dfeà ",6@HOTUSOIA81*$!!#'+06>ENU\`a`[TKB91,))-3;DNW^cffà #-8BKSWYWRLC;2+% !$(.55-'" #'-471,)&%&'*.3:AJRZ_bc`ZSJA93/-/28@HOUY[[à !+6ALV]bdd`[TME>83/,*)*+.38?GOV\`a_ZTLC<610149@FMRUWWã (3>IS[aeec_ZSLE?:52/--â/27=DKRX\]\YSME>94336:?EJOQRRà %/:EOX_ceeb^XRLFA<741/./149?FMSWYYWSMF@;7557;?CGKLMLÅ !+5@JS[`dec`\WQLFA<741/./15:@FLQTUSPLGB=9778;>ADFGGFÏ &0:DMU\`bba]YTOID?:51.-,.04:?EJMOOMJFA=:88÷:<>@AA@?Ä !*3=FNUZ]_^\YUPJE?:50-*))+.27=AEHIHFC@=:87789:;;:98Ð $-5>FMRVYYXVRNIC>83.*'%$%(+059=@BBA?=:8755ü421Å &-5=DINPRQPMID?:4/*%" !$(,048:;;:875321100/.,+*Ø %,3:?CFHIHEB>94/*%! $(,/133ò10/.-,+*('%$#Ö $*059<>?><:62.)$  #&)+,,ò+*)('&%#" È !&+.134431.*&"!#$%%$$#"! É !$')**)'%" ò   õ ö ö Ú   õ ô é   ö  ö  ÷ ø øù "    þü      ú  ô      ø ø   ë  üø  ÷ ó ûöø  öî !!û"#$$%%û$#"!  !þ"##ø!ö !!ð"#$%!$&'))*û+,-.//õ.-,*))()*+,,ì*(%!"$&())**ú+,-.÷ #&*-/12334ü57899ú8764211ü23455í31-*&" #'*-01233í4567'%%&(+/369;<==<<ó=>@ACCDCB@><::ý;=>>ì=:62.)&$$%'+/37:;<=<<ñ=>@/--.037<@CEFFþEDDûFGIKMMÞKIGECAABCDFGFEC?:51-+*,.27<@CEFFEDDEFH86558;@DILNOOMLKJJLNPSUVVTROMJHGGIJLMNMKGB=841125:?DILNONMKJJKLN@>==?CHLQTVWVTRPOOPRUX[\]\YVSPMLLMOQSTTRNID?:778;@FKPTVVUSQOO€ÅQSHEDDFJNSX[]][YVSRQRUX\_aba_\XTQONOQTVXXWTPJE@=<=@EKQWZ\\ZXUSQQSVOLKJLOTY]`ba_\XUSRSUY^adfec_[VRPOPRUX[\[YUOJEA@ADJPV[_``^ZWTRRTWUSQPQTY]adedb^YURQRUY^bfhgea\WSONOQUY\^^\XSNHECDHMSY_bcb`\WTQQSV[XUU€;X\`dggfc^YTPOPSW]bfhhfb\WRNLMPTX\_`_[VQLHFGJOU\aded`[WRPOQT_\YXY[^bfhhfb]WRNLMPU[`ehhfb\VPLJKNRW\_a`]YSNJHHKPW]befd`[UPMLNRb_\[[]`dgiifb\UPKIJMRY_dggea[TNJHHKPU[_ba_ZUPKIJLQW]beec_YSNJIKOca^\\^adgiheaZTMIGGJPV]befd`YSLHEFINTZ_ab`\VQLJJMRX]beeb^WQKHGHLda_]]^adghhe`YRKGDEHMT[`dec^XQKFCDGLRY^ab`\WQMJJMRW]bdda\VOIFDFJda_]]^adghgd^XPJEBCFLRY_cdb]WPIDBBEKQX^aba]XRNKKMRW]adc`[UNHDBDHc`^\\^`cfgfc^WOICAAEJQX^bca\VOHCAADJPW]aba]XSNKKMRW]acc`ZTMFBABG`^\[[]_cegfc]VNHC@@DJQX^aba\UNHB@@DIPW]aba^YSOLLNRW]acc_ZSLFB@BF][YXY[^befeb\UNGB?@CIPW]ab`\UNGB@@CIPW]aba^YSOLLNRW\`cb_YRKEA@AEZXVVWY]`deea\UNGB?@CIPW]ab`[UNGB@@CIOW]aba^YTOLLNRW\`bb_YRKEA?AEUTRRTW[_bdda[UMGB?@CIPW\`a`[UNGB@@CIOV\`ba^YTOMLNRW\`ba^YRKEA?AEPONNPTX]acb_[TMFB?@CHOV\_`_ZTMGB@@CHOV\`a`]YTPMMNRW\_a`]XQJEA?AEJIIJLPUZ^``^YSLFA??CHNU[^_^YTMGB@@CHNU[_`_\XSOMLNRV[^`_\WQJD@?ADD€2EHMRW[^^\WQKEA>?BGMSY\]\XRLFA??BGMSY]^][WRNLLMQUY]^]ZUOIC@>@D>=>@CHMSWZZXTNHC?==@EKQVYZXUOJD@>>AEKQVY[ZXTPLJIKNRVY[ZWRLFA>=>B778:>CHNRUUTPKE@=;;>BHMRUVTQLGB><<>CHMRUWVTPLIGGHKOSUVVSOID?<;CHLOPNKGB>:88;>CHLOPPNKHECCDFJMOPPMID?;878;))+.27BFHIHEA=96446:>BFHJIGEB?>>?ADGIIÂGC?:64347"#$'+059=?@?<952/..037;>@A@>:731//147;>@AA@=;9878:=?AAí?<841/./1!$(-1466×41.+)((*,/2578752/,*))*-035788753100134688È630-*)()+!%(+-.-+)'$#""#%(*-./.,*(%$##$&(+-.//.-+*))ü+,.//ú-+)&$""î$!#$%$#! ë #$%&%$" !#$&&õ%$#"!!"#$%&&ú%#!î óû÷úõ õûûî ü  û õ û  ó                õ ü 9 þ,  ú   ô û üþþ     ù ÷  þ  ù ÷ üþö õ ú  é ö  õ ùõ%%û$#"!  ü!""##ö"   óë !"#//õ.,+*)(()*+,,ç+)&# !"#$%%ù$#!ô"$')+,,899õ875321122455Ç42/+'" "$%&'()*+,--,+*(&#"!!"$'*.13566BCDCCA?=;::ü;<=>>å<84/*&" "%')*+,-./012344Ê20.,*))*-037;=?@@JLMMLKIFDBAABCEFGFDA=83.)&%%&(*,.01122Ã34689;<<;975321358=AEGIJJQSUVUTQNLIHGHIKMNNLJE@;61.,,-/2456766è5679<>ABCCB@><::;>AFJNQSSÚVY[\\[XUROMLLMORSTSQMHC>964468:;==<;988‰9;>BEHJKJIGECBCFINRVY[[ZZ]`bba^ZVRPNNPRUWYYWTOJEA><=>@ACCB@>;9889;?CHLOQQPOMKJKMQUY]`aa_[_cefeb^YUQOOQSWZ\]\ZVQLHFDEFGII€ùGD@=9778;?DIOSVWWVTRQRTW[_cefebZ_dghgd`ZUQONPSV[^``^[WSOMLLMOPONKGB=86458=CIPUZ\]\ZYWWY\_cghigdY^cghhe`ZUPMLNQUZ^acb_\XUSRSTUVURNIC=74236;AIPW\`aa`^\\]`cfikjhdW]bfhhe`ZTOKJLOTY_bdec`][YXYZ[[ZVQJC<61/028?GOW^bdedb``acehklkhcT[`eggd_XRMIHIMRX^cfgfda_^^€=`a`^ZTLD<50--055.*(*.5>HQZaeggfeddegijjhc]LSZ_bb_ZSLFA@AFLS[bgijjhggÂijkkid]TJ@70+)+/5>GPX_ceedcbbdfhiigb\LSY_bb_YSLEA@AELS[afijihffåhijjid^ULB92-+,/5=FNV\`bba``Ãbdghhfb\KRY^aa^YRKEA?AEKSZafhihfeddeghigd^VMD<50-.16=EMTY]^^]]…^`ceggea[KRY^aa^YRKEA@AEKSZ`eghfdbaabdefeb^WOF>830037=DKQVXZYYXYZ]`cefd`ZKQX]``]XRKEA@AEKRY_dffdb_^]^_abb`\WPHA:63358>CINRTTÂUWZ]addc_ZJQW\__\WQKEA@AEJQX^bcca^[YXYZ\]^]ZUOIC=86569=BGJMNONNÃPRVZ^aba^XIOUZ]]ZVPJDA?@DIPV[_``]ZWTSRSUWXXVSNIC>:878:=@DFHIHHÛJMRV[^_^[WGMRWYYWSMHB?>?BGMSX[\[XUQNLLìNPQRQOLGC?;9889;>@ABBAÂBDHLQVY[ZXSDJOSUUSOJE@=<=@DJOSVWVSOKHEDEFHIKKJGDA>;97789:;<<;::Ê<>BGLPTVVSO@EIMOOMJE@<989<@EIMPPOLHD@><<=?ABCCB@>;976556ý5433’57;@EJMOOMJ;?CGHIGD@;85457;?CFHIGDA=9654568:;<;:9754221100/.-,+,.049>BFHHFC48?@><-14677641.+*))+.13677530,)&%$$%'(*+,,Ú+*)('&%$"!  "&*.256764&)+-./.,)'%##é$&)+-..,*(%" "#$%%â$#"! #&),-.-+!#$%%¢#" !#$%%$" !#$%$#ä ûýú  û î ú û   þù û   ð  ü      þ  ú ô üþ   ! ˜ ˜ ˜×*   þþ    ù÷÷ ú     öö ù ô ì ñ þ#$$%ì$" ñ -.Ù-,)&"  678ö753/+'"ø!#$%&&ï%$#! @?ê@AA@?<84/*%" !#%(*,--í,+*(&# ýIHGGþHIIÙGEA<71,)&%&'*-/1344321/-*'# ýQPNNÖOPPOMJE?94/-,,.1479:;::8641.*&! æWUSRRSTUVVTQLF@;632247;>@AAì?=;851-(# ü\YVUUÖWYZ[ZWRMGA<978:=ADFHHGEB?<840*% Ð_[XVUVX[]^^\XRLFA><=?BFJLNNMKHD@<72,'! Ð_[WUTUX[^`a_\VPJEB@ACGKNQSSRPMID@:5/(" Ð_ZVSRSVZ^aba^YTMHDCCFINRUWXWURNID>81*$ Ï^XSPOQTX]acc`\VPJFDEGKPTXZ\[YWSNHB<4-& Ï\VQNMNRV\`cca]WQKGEEGKPUY\^^][WSMG@91)" ÏZTNKJKOTZ_bcb^XRLGEDFJOTY]`aa_\XSLE=5-% ÏYRLIGIMSY^bcb^XRLGDCDHMRW\_bcb`\XRKC:1)  ÎWPJGFGLQX^bcb^XRKFBABEJOUZ^acdc`\WPH?6-$ ÎVOIEDFJPW]acb^XQKEA?@BFKQV[_bddc`[UMD;1( ÎUNHDCEJPV]acb^XQJD@==?CGMRW\`bdcb^XQH?5+" ÎUNHDCEIPV\acb^XQJD?<;;:;=@EINSX\_aa_[UMD:0& ÎTMGDCEIOV\`bb^XQJD>;99;>AEJNSW[]^]ZUNE;1( ÎSMGDCEIOU[`ba^XQJD>;98:<>BFJNRVYZZXSMD;1( ÎRLGCCDINUZ_a`]WQJD>;989::8789:@CFIJJIE@:2*" ÎJEA?>?CHMRUWVSOJD?;75445678:<>@BCCB?:4-& êEA=;:BFHJIGC?;630/..è/0123455430,'" ê95311247;>@AA?<840.+*))*+ë,--..-+)%! ë1.,**+-025787630-*'%$$%&î'&%$! ü)'%$$ð&(*-./.-+(&#! ð é! !"$%&%$#!ñ üñò õøó þ  ù ù    ô þ       û  þ  øz=,d Backgroundÿ     ÿÿÿÿN×,dN÷OïOûP,dO+OIOYOiOyO‰O¯O¿OÏOßÿÿÿùÿûúôÿþÿ:ÿý Åÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ&ÿüþýüÿ>ÿýþýÿ>ÿüþÿüÿQÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ0ÿ0ÿ0ÿ0ÿ–2K% commons-jexl-1.1-src/xdocs/index.xml100644 0 0 15035 10500374603 14675 0ustar 0 0 Commons JEXL Overview

Java Expression Language (JEXL) is an expression language engine which can be embedded in applications and frameworks. JEXL is inspired by Jakarta Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and JavaServer Pages version 2.0 (JSP). While inspired by JSTL EL, it must be noted that JEXL is not a compatible implementation of EL as defined in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of these specifications, see the Commons EL project.

JEXL attempts to bring some of the lessons learned by the Velocity community about expression languages in templating to a wider audience. Commons Jelly needed Velocity-ish method access, it just had to have it.

When evaluating expressions, JEXL merges an Expression with a JexlContext. An Expression is created using ExpressionFactory.createExpression(), passing a String containing valid JEXL syntax. A JexlContext is created using JexlHelper.createContext(), and variables are put into a map exposed through the getVars() method on JexlContext. The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo:

While JEXL is similar to the expression language defined in JSTL, it has improved upon the syntax in a few areas:

  • Support for invocation of any accessible method (see example above).
  • Added a general size() method, which works on:
    • String - returns length
    • Map - returns number of keys
    • List - returns number of elements.
  • Optional syntax for the 'empty' function : empty(obj)
  • Misc : '+' has been overloaded to be use as a String concatenation operator

JEXL 1.0 has been released. See the releases page for information on obtaining releases.

JEXL is not a product of the Java Community Process (JCP), but it provides a similar expression syntax. For more information about JSP 2.0 EL and JSTL 1.1 EL:

Jakarta Velocity implements a similar expression language.

In particular the References section of the User Guide has some good information on properties and method which correlate directly to JEXL.

commons-jexl-1.1-src/xdocs/issue-tracking.xml100644 0 0 7030 10500374603 16472 0ustar 0 0 Issue tracking Commons Documentation Team

Commons JEXL uses ASF JIRA for tracking issues. Issues for Commons JEXL are tracked at http://issues.apache.org/jira/browse/JEXL

To create a new issue you will need to sign up for a new account, unless you had previously used the Commons product in Bugzilla in which case your username is your email address and you will need to use the Forgot Password page to get a new password.

Bugs and enhancements should be filed under the "Commons JEXL" project in JIRA. If you would like to report a bug, or raise an enhancement request with Commons JEXL please do the following:

  1. Search existing bugs. If you find your issue listed then please add a comment with your details.
  2. Search the mailing list archive. You may find your issue or idea has already been discussed.
  3. Decide if your issue is a bug or an enhancement.
  4. Submit either a bug report or enhancement request.

Please also remember these points:

  • The more information you provide, the better we can help you
  • Test cases are vital, particularly for any proposed enhancements
  • Patches containing new files must contain the ASL v2.0 header at the top of every new file
  • A test class for Foo.java must be named FooTest.java

You may also find these links useful:

commons-jexl-1.1-src/xdocs/navigation.xml100644 0 0 3270 10500374603 15703 0ustar 0 0 Commons JEXL &commons; commons-jexl-1.1-src/xdocs/reference/examples.xml100644 0 0 21715 10500374603 17344 0ustar 0 0 Commons JEXL Examples

In this reference you will find the following topics to help with your use of JEXL.

You can find two sample programs in JEXL's CVS repository:

As well, JEXL's Unit Tests provide handy examples of expressions. The test code also contains a simple class that evaluates its command line arguments as JEXL expressions when run.

To evaluate expressions using JEXL, you need two things:

The easiest way of obtaining a a context is to use the JexlHelper.createContext() method. This creates a context which is simply an extension of a HashMap

Expressions are created using the ExpressionFactory.createExpression(String) method.

Once you have your expression, you can then use use the evaluate to execute it and obtain a result.

Here's a typical scenario:

// Create an expression object for our calculation String calculateTax = taxManager.getTaxCalc(); //e.g. "((G1 + G2 + G3) * 0.1) + G4"; Expression e = ExpressionFactory.createExpression( calculateTax ); // populate the context JexlContext context = JexlHelper.createContext(); context.getVars().put("G1", businessObject.getTotalSales()); context.getVars().put("G2", taxManager.getTaxCredit(businessObject.getYear())); context.getVars().put("G3", businessObject.getIntercompanyPayments()); context.getVars().put("G4", -taxManager.getAllowances()); // ... // work it out Float result = (Float)e.evaluate(context);

Often you have the objects and values that are needed in the context available elsewhere, and instead of creating the default context and populating it manually in the code, it may be simpler to create a context implementation of your own.

The JexlContext interface is very simple with only two methods, one to get the variables of the context as a Map and another to set the variables of the context from a Map.

Here's a simple context that wraps the JVM's system properties: JexlContext context = new JexlContext() { public Map getVars() { return System.getProperties(); } public void setVars(Map map) { } };

JEXL allows you to add custom expression resolvers that will get called with before or after expression evaluation.

If pre-resolvers is added to an expression, any value it returns will be used instead of that normally provided by JEXL. If JEXL evaluates an expression to null post-resolvers of an expression are called in turn in an attempt to get a value.

Expression resolvers are called in the order that they are added.

Most valid arithmetic expressions in Java are also valid in Jexl.

1 + 2 12.0 - 5.2 6 * 12 + 5 / 2.6 12 % 2 6 div 4 -12 + 77.2 x * 1.1 + y

Arithmetic expressions can use variables. null is treated as a zero for arithmetic.

JEXL allows you to call any method on a Java object using the same syntax. If you have a string in the context under the name aString, you could call it's length method like this: aString.length() aString.substring(6)

Often the values you want to pass to a method are other variables or expressions. If you have a number in the context, named i, you could use it in a method call: aString.substring(i)

JEXL provides a shorthand syntax to access methods that follow the JavaBean naming convention for properties, i.e. setters and getters.

If you have some object foo in the context and it has a method getBar(), you can call that method using the following syntax: foo.bar

Since java.lang.Object has a getClass() method that returns a java.lang.Class object, and the class has a getName() method, the following is a shorthand for obtaining the class name of an object foo in the context: foo.class.name

Array elements can be accessed using either square brackets or a dotted index notation, e.g. the following are equivalent arr[0] arr.0 The same holds true for lists.

For a map, the syntax is very similar, except the 'index' is an object, e.g. the following are equivalent. aMap['key'] aMap.get('key') Please note that the index does not have to be a string, and that the string usage above is just one possible option.

commons-jexl-1.1-src/xdocs/reference/index.xml100644 0 0 2131 10500374603 16604 0ustar 0 0 Commons JEXL Reference

The JEXL Reference documentation is made up of the following:

commons-jexl-1.1-src/xdocs/reference/syntax.xml100644 0 0 31701 10500374603 17050 0ustar 0 0 Commons JEXL Syntax

This reference is split up into the following sections:

  1. Language Elements
  2. Literals
  3. Functions
  4. Operators
  5. Conditional Statements

For more technical information about the JEXL Grammar, you can find the JavaCC grammar for JEXL here: Parser.jj

ItemDescription
Comments Specified using ## and extend to the end of line, e.g. ## This is a comment
Identifiers / variables Must start with a-z, A-Z, _ or $. Can then be followed by 0-9, a-z, A-Z, _ or $. e.g.
  • Valid: var1,_a99,$1
  • Invalid: 9v,!a99,1$

JEXL also supports ant-style variables, e.g. my.dotted.var is a valid variable name.

NOTE: JEXL does not support variables with hyphens in them, e.g. commons-logging is not a valid variable, but instead is treated as a subtraction of the variable logging from the variable commons

Scripts A script in Jexl is made up of zero or more statements. Scripts can be read from a String, File or URL.
Statements A statement can be the empty statement, the semicolon (;) , block, assignment or an expression. Statements are optionally terminated with a semicolon.
Block A block is simply multiple statements inside curly braces ({, }).
ItemDescription
Integer Literals 1 or more digits from 0 to 9
Floating point Literals 1 or more digits from 0 to 9, followed by a decimal point and then one or more digits from 0 to 9.
String literals Can start and end with either ' or ", e.g. "Hello world" and 'Hello world' are equivalent.
Boolean literals The literals true and false can be used, e.g. val1 == true
Null literal The null value is represented as in java using the literal null, e.g. val1 == null
FunctionDescription
empty Returns true if the expression following is either:
  1. null
  2. An empty string
  3. An array of length zero
  4. A collection of size zero
  5. An empty map
empty(var1)
size Returns the information about the expression:
  1. Length of an array
  2. Size of a List
  3. Size of a Map
  4. Size of a Set
  5. Length of a string
size("Hello") returns 5.
OperatorDescription
Boolean and The usual && operator can be used as well as the word and, e.g. cond1 and cond2 and cond1 && cond2 are equivalent
Boolean or The usual || operator can be used as well as the word or, e.g. cond1 or cond2 and cond1 || cond2 are equivalent
Boolean not The usual ! operator can be used as well as the word not, e.g. !cond1 and not cond1 are equivalent
Bitwise and The usual & operator is used, e.g. 33 & 4, 0010 0001 & 0000 0100 = 0.
Bitwise or The usual | operator is used, e.g. 33 | 4, 0010 0001 | 0000 0100 = 0010 0101 = 37.
Bitwise xor The usual ^ operator is used, e.g. 33 ^ 4, 0010 0001 ^ 0000 0100 = 0010 0100 = 37.
Bitwise complement The usual ~ operator is used, e.g. ~33, ~0010 0001 = 1101 1110 = -34.
Equality The usual == operator can be used as well as the abbreviation eq. For example val1 == val2 and val1 eq val2 are equivalent.
  1. null is only ever equal to null, that is if you compare null to any non-null value, the result is false.
  2. Equality uses the java equals method
Inequality The usual != operator can be used as well as the abbreviation ne. For example val1 != val2 and val1 ne val2 are equivalent.
Less Than The usual < operator can be used as well as the abbreviation lt. For example val1 < val2 and val1 lt val2 are equivalent.
Less Than Or Equal To The usual <= operator can be used as well as the abbreviation le. For example val1 <= val2 and val1 le val2 are equivalent.
Greater Than The usual > operator can be used as well as the abbreviation gt. For example val1 > val2 and val1 gt val2 are equivalent.
Greater Than Or Equal To The usual >= operator can be used as well as the abbreviation ge. For example val1 >= val2 and val1 ge val2 are equivalent.
Addition The usual + operator is used. For example val1 + val2
Subtraction The usual - operator is used. For example val1 - val2
Multiplication The usual * operator is used. For example val1 * val2
Division The usual / operator is used. For example val1 / val2
Integer Division The div operator is used. For example 4 div 3 gives 1.
Modulus (or remainder) The % operator is used. An alternative is the mod operator. For example 5 mod 2 gives 1 and is equivalent to 5 % 2
Negation The unary - operator is used. For example -12
Array access Array elements may be accessed using either square brackets or a dotted numeral, e.g. arr1[0] and arr1.0 are equivalent
OperatorDescription
if Classic, if/else statement, e.g. if ((x * 2) == 5) {y = 1;} else {y = 2;}
foreach Loop through items of an Array, Collection, Map, Iterator or Enumeration, e.g. foreach (item in list) { x = x + item; } Where item and list are variables.
while Loop until a condition is satisfied, e.g. while (x lt 10) { x = x + 2; }
commons-jexl-1.1-src/xdocs/releases.xml100644 0 0 3770 10500374603 15354 0ustar 0 0 Downloads

Latest Stable Release

Nightly Builds

commons-jexl-1.1-src/xdocs/style/maven.css100644 0 0 3170 10500374603 16001 0ustar 0 0 body { background: #fff; color: #000; } .app h3 { color: #fff; background-color: #036; } .app h4 { color: #fff; background-color: #888; } .a td { background: #ddd; color: #000; } .b td { background: #efefef; color: #000; } .app th { background-color: #bbb; color: #fff; } div#banner { border-top: 1px solid #369; border-bottom: 1px solid #003; } #banner, #banner td { background: #036; color: #fff; } #leftcol { background: #eee; color: #000; border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; border-top: 1px solid #fff; } #navcolumn { background: #eee; color: #000; border-right: none; border-bottom: none; border-top: none; } #breadcrumbs { background-color: #ddd; color: #000; border-top: 1px solid #fff; border-bottom: 1px solid #aaa; } #source { background-color: #fff; color: #000; border-right: 1px solid #888; border-left: 1px solid #888; border-top: 1px solid #888; border-bottom: 1px solid #888; margin-right: 7px; margin-left: 7px; margin-top: 1em; } #source pre { margin-right: 7px; margin-left: 7px; } a[name]:hover, #leftcol a[name]:hover { color: inherit !important; } a:link, #breadcrumbs a:visited, #navcolumn a:visited, .app a:visited, .tasknav a:visited { color: blue; } a:active, a:hover, #leftcol a:active, #leftcol a:hover { color: #f30 !important; } a:link.selfref, a:visited.selfref { color: #555 !important; } h3, h4 { margin-top: 1em; margin-bottom: 0; } img.handle { border: 0; padding-right: 2px; } #navcolumn div div { background-image: none; background-repeat: no-repeat; } #navcolumn div div { padding-left: 10px; } commons-jexl-1.1-src/xdocs/style/print.css100644 0 0 250 10500374603 16003 0ustar 0 0 #banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks { display: none; } body.docs div.docs { margin: 0 !important; border: none !important } commons-jexl-1.1-src/xdocs/style/project.css100644 0 0 101 10500374603 16310 0ustar 0 0 @import url("http://jakarta.apache.org/style/jakarta-maven.css");commons-jexl-1.1-src/xdocs/style/tigris.css100644 0 0 27324 10500374603 16223 0ustar 0 0 /* $Id: tigris.css 155421 2005-02-26 13:07:10Z dirkv $ This file defines basic default formatting for HTML conforming to Tigris application style. To extend or override these rules for your instance, edit inst.css instead of this file. */ /* colors, backgrounds, borders, link indication */ body { background: #fff; color: #000; } .app h3, .app h4, .tabs td, .tabs th, .functnbar { background-image: url(../images/nw_maj_rond.gif); background-repeat: no-repeat; } .functnbar, .functnbar2 { background-color: #aaa; } .functnbar2, .functnbar3 { background-color: #aaa; background-image: url(../images/sw_maj_rond.gif); background-repeat: no-repeat; background-position: bottom left; } .functnbar3 { background-color: #ddd; background-image: url(../images/sw_med_rond.gif); } .functnbar, .functnbar2, .functnbar3 { color: #000; } .functnbar a, .functnbar2 a, .functnbar3 a { color: #000; text-decoration: underline; } #navcolumn .body div, body.docs #toc li li { background-image: url(../images/strich.gif); background-repeat: no-repeat; background-position: .5em .5em; } #searchbox .body div, #navcolumn .body .heading { background-image: none; } a:link, #navcolumn a:visited, .app a:visited, .tasknav a:visited { color: blue; } a:link.selfref, a:visited.selfref { color: #555 !important; text-decoration: none; } a:active, a:hover, #leftcol a:active, #leftcol a:hover { color: #f30 !important; } #leftcol a, #breadcrumbs a { text-decoration: none; } .app h3, .app h4 { color: #fff; } .app h3 { background-color: #333; } .app h3 a:link, .app h3 a:visited, .app h4 a:link, .app h4 a:visited { color: #fff !important; text-decoration: underline; } .app h4 { background-color: #888; } .a td { background: #ddd; } .b td { background: #efefef; } table, th, td { border: none; } div.colbar { background: #eee; border-color: #999 #EEE #EEE #999; border-width: 1px; border-style: solid; } .toolgroup { background: #efefef; } .toolgroup .label { border-bottom: 1px solid #666; border-right: 1px solid #666; background: #ddd; color: #555; } .toolgroup .body { border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; } #breadcrumbs { border-top: 1px solid #fff; background-color: #ccc; } #main { border-top: 1px solid #999; } #rightcol div.www, #rightcol div.help { border: 1px solid #ddd; } body.docs div.docs { background-color: #fff; border-left: 1px solid #ddd; border-top: 1px solid #ddd; } #helptext .label { background-image: url(../images/icon_help_sml.gif); background-repeat: no-repeat; background-position: 97%; } body.docs { background: #eee url(../images/help_logo.gif) top right no-repeat !important; } .docs h3, .docs h4 { border-top: solid 1px #000; } #apphead h2 em { color: #777; } .app th { background-color: #bbb; } .tabs th { border-right: 1px solid #333; background-color: #ddd; color: #fff; border-left: 1px solid #fff; } .tabs td { background-color: #999; border-bottom: 1px solid #fff; border-right: 1px solid #fff; border-left: 1px solid #fff; } .tabs { border-bottom: 6px #ddd solid; } .tabs th, .tabs th a:link, .tabs th a:visited { color: #555; } .tabs td, .tabs td a:link, .tabs td a:visited { color: #fff; } .tabs a { text-decoration: none; } .axial th { background-color: #ddd; color: black; } .alert { background-color: #ff9; } .expandedwaste { background: url(../images/icon_arrowwaste2_sml.gif) no-repeat; } .collapsedwaste { background: url(../images/icon_arrowwaste1_sml.gif) no-repeat; } .filebrowse .expanded, .filebrowse-alt .expanded { background-image: url(../images/icon_arrowfolderopen2_sml.gif); background-repeat: no-repeat; } .filebrowse .collapsed, .filebrowse-alt .collapsed { background-image: url(../images/icon_arrowfolderclosed1_sml.gif); background-repeat: no-repeat; } .filebrowse .leafnode, .filebrowse-alt .leafnode { background-image: url(../images/icon_folder_sml.gif); background-repeat: no-repeat; } .filebrowse .leaf, .filebrowse-alt .leaf { background-image: url(../images/icon_doc_sml.gif); background-repeat: no-repeat; } .sortup { background: url(../images/icon_sortup.gif) no-repeat; } .sortdown { background: url(../images/icon_sortdown.gif) no-repeat; } .collapsedwaste { background: url(../images/icon_arrowwaste1_sml.gif) no-repeat; } body .grid td { border-top: 1px solid #ccc; border-left: 1px solid #ccc; background-color: transparent; } .confirm { color: #090; } .info { color: #069; } .errormessage, .warningmessage, .donemessage, .infomessage { border-top: 5px solid #900; border-left: 1px solid #900; background-image: url(../images/icon_error_lrg.gif); background-repeat: no-repeat; background-position: 5px 1.33em; } .warningmessage { background-image: url(../images/icon_warning_lrg.gif); border-color: #c60; } .donemessage { background-image: url(../images/icon_success_lrg.gif); border-color: #090; } .infomessage { background-image: url(../images/icon_info_lrg.gif); border-color: #069; } .docinfo { background: url(../images/icon_doc_lrg.gif) no-repeat; } .dirinfo { background: url(../images/icon_folder_lrg.gif) no-repeat; } .memberinfo { background: url(../images/icon_members_lrg.gif) no-repeat; } .usergroupinfo { background: url(../images/icon_usergroups_lrg.gif) no-repeat; } .errormark, .warningmark, .donemark, .infomark { background: url(../images/icon_error_sml.gif) no-repeat; } .warningmark { background-image: url(../images/icon_warning_sml.gif); } .donemark { background-image: url(../images/icon_success_sml.gif); } .infomark { background-image: url(../images/icon_info_sml.gif); } .cvsdiff, .cvsblame { background-color: #ccc; } .cvsdiffadd { background-color: #afa; } .cvsdiffremove { background-color: #faa; } .cvsdiffchanges1 { background-color: #ff7; } .cvsdiffchanges2 { background-color: #ff7; } li.selection ul a { background: #fff; } .band1 { color: #fff; background-color: #663; } .band2 { color: #fff; background-color: #66C; } .band3 { background-color: #C99; } .band4 { background-color: #CFF; } .band5 { color: #fff; background-color: #336; } .band6 { color: #fff; background-color: #966; } .band7 { background-color: #9CC; } .band8 { background-color: #FFC; } .band9 { color: #fff; background-color: #633; } .band10 { color: #fff; background-color: #699; } .band11 { background-color: #CC9; } .band12 { background-color: #CCF; } .band13 { color: #fff; background-color: #366; } .band14 { color: #fff; background-color: #996; } .band15 { background-color: #99C; } .band16 { background-color: #FCC; } .app .helplink, #helptext .helplink { cursor: help; } .legend th, .bars th { background-color: #fff; } /* font and text properties, exclusive of link indication, alignment, text-indent */ body, th, td, input, select { font-family: Verdana, Helvetica, Arial, sans-serif; } code, pre { font-family: 'Andale Mono', Courier, monospace; } body, .app h3, .app h4, #rightcol h3, pre, code, #apphead h2 small, h4, th, td { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } small, div#footer, div#login, div.tabs th, div.tabs td, input, select, .paginate, .functnbar, .functnbar2, .functnbar3, #breadcrumbs, .courtesylinks, #rightcol div.help, .colbar, .tasknav, body.docs div#toc, #leftcol, .legend, .bars { font-size: xx-small; voice-family: "\"}\""; voice-family: inherit; font-size: x-small; } .tabs td, .tabs th, dt, .tasknav .selfref, #login .username, .selection { font-weight: bold; } li.selection ul { font-weight: normal; } #apphead h2 em { font-style: normal; } #banner h1 { font-size: 1.25em; } /* box properties (exclusive of borders), positioning, alignments, list types, text-indent */ #bodycol h2 { margin-top: .3em; margin-bottom: .5em; } p, ul, ol, dl, .bars table { margin-top: .67em; margin-bottom: .67em; } h3, h4 { margin-bottom: 0; } form { margin: 0; } #bodycol { padding-left: 12px; padding-right: 12px; width: 100%; voice-family: "\"}\""; voice-family: inherit; width: auto; } html>body #bodycol { width: auto; } .docs { line-height: 1.4; } ol ol { list-style-type: lower-alpha; } ol ol ol { list-style-type: lower-roman; } .app h3, .app h4 { padding: 5px; margin-right: 2px; margin-left: 2px; } .app td, .app th { padding: 2px 3px; } .h3 p, .h4 p, .h3 dt, .h4 dt { margin-right: 7px; margin-left: 7px; } .tasknav { margin-bottom: 1.33em; } div.colbar { padding: 3px; margin: 2px 2px 0; } .tabs { margin-top: .67em; margin-right: 2px; margin-left: 2px; padding-left: 8px; } .tabs td, .tabs th { padding: 3px 9px; } #rightcol div.www, #rightcol div.help { padding: 0 .5em; } body.docs #toc { position: absolute; top: 15px; left: 0px; width: 120px; padding: 0 20px 0 0; } body.docs #toc ul, #toc ol { margin-left: 0; padding-left: 0; } body.docs #toc li { margin-top: 7px; padding-left: 10px; list-style-type: none; } body.docs div.docs { margin: 61px 0 0 150px; padding: 1em 2em 1em 1em !important; } .docs p+p { text-indent: 5%; margin-top: -.67em; } .docs h3, .docs h4 { margin-bottom: .1em; padding-top: .3em; } .functnbar, .functnbar2, .functnbar3 { padding: 5px; margin: .67em 2px; } .functnbar3 { margin-top: 0; } body { padding: 1em; } body.composite, body.docs { margin: 0; padding: 0; } th, td { text-align: left; vertical-align: top; } .right { text-align: right !important; } .center { text-align: center !important; } .axial th, .axial th .strut { text-align: right; } .app .axial td th { text-align: left; } body .stb { margin-top: 1em; text-indent: 0; } body .mtb { margin-top: 2em; text-indent: 0; } .courtesylinks { margin-top: 1em; padding-top: 1em; } dd { margin-bottom: .67em; } .toolgroup { margin-bottom: 6px; } .toolgroup .body { padding: 4px 4px 4px 0; } .toolgroup .label { padding: 4px; } .toolgroup .body div { padding-bottom: .3em; padding-left: 1em; } .toolgroup .body div div { margin-top: .3em; padding-bottom: 0; } .tier1 { margin-left: 0; } .tier2 { margin-left: 1.5em; } .tier3 { margin-left: 3em; } .tier4 { margin-left: 4.5em; } .tier5 { margin-left: 6em; } .tier6 { margin-left: 7.5em; } .tier7 { margin-left: 9em; } .tier8 { margin-left: 10.5em; } .tier9 { margin-left: 12em; } .tier10 { margin-left: 13.5em; } .filebrowse .expanded, .filebrowse .collapsed { padding-left: 34px; } .filebrowse .leafnode, .filebrowse .leaf { padding-left: 20px; } .messagechild { padding-left: 34px; } .filebrowse-alt .expanded, .filebrowse-alt .collapsed, .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .expandedwaste, .collapsedwaste, .sortup, .sortdown { /* hide from macie5\*/ float: left; /* resume */ display: inline-block; height: 15px; width: 34px; padding-left: 0 !important; } .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .sortup, .sortdown { width: 20px; } .filebrowse ul, .filebrowse-alt ul { list-style-type: none; padding-left: 0; margin-left: 0; } .filebrowse ul ul, .filebrowse-alt ul ul { margin-left: 1.5em; margin-top: 0; padding-top: .67em; } .filebrowse li, .filebrowse-alt li { margin-bottom: .67em; } td.filebrowse h3 { margin-top: 0; } .errormessage, .warningmessage, .donemessage, .infomessage, .docinfo, .dirinfo, .memberinfo, .usergroupinfo { margin: .67em 0; padding: .33em 0 .67em 42px; min-height: 32px; } .errormark, .warningmark, .donemark, .infomark { padding-left: 20px; min-height: 15px; } .alt { display: none; } #banner h1 { margin: 0; } #leftcol { width: 14em; } .axial th, .axial th .strut, #leftcol .strut { width: 12em; } #breadcrumbs { padding: 2px 8px; } .app h3, .app h4, .bars { clear: both; } .legend { float: right; } .legend th, .bars th { text-align: right; padding-left: 1em; } .bars table { table-layout: fixed; } .bars th { width: 12em; } #projectdocumentlist td.filebrowse-alt { padding-right: .75em; } commons-jexl-1.1-src/xdocs/xdoc.xsl100644 0 0 4032 10500374603 14504 0ustar 0 0

				
			
n_info_sml.gif); } .cvsdiff, .cvsblame { background-color: #ccc; } .cvsdiffadd { background-color: #afa; } .cvsdiffremove { background-color: #faa; } .cvsdiffchanges1 { background-color: #ff7; } .cvsdiffchanges2 { background-color: #ff7; } li.selection ul a { background: #fff; } .band1 { color: #fff; background-color: #663; } .band2 { color: #fff; background-color: #66C; } .band3 { background-color: #C99; } .band4 { background-color: #CFF; } .band5 { color: #fff; background-color: #336; } .band6 { color: #fff; background-color: #966; } .band7 { background-color: #9CC; } .band8 { background-color: #FFC; } .band9 { color: #fff; background-color: #633; } .band10 { color: #fff; background-color: #699; } .band11 { background-color: #CC9; } .band12 { background-color: #CCF; } .band13 { color: #fff; background-color: #366; } .band14 { color: #fff; background-color: #996; } .band15 { background-color: #99C; } .band16 { background-color: #FCC; } .app .helplink, #helptext .helplink { cursor: help; } .legend th, .bars th { background-color: #fff; } /* font and text properties, exclusive of link indication, alignment, text-indent */ body, th, td, input, select { font-family: Verdana, Helvetica, Arial, sans-serif; } code, pre { font-family: 'Andale Mono', Courier, monospace; } body, .app h3, .app h4, #rightcol h3, pre, code, #apphead h2 small, h4, th, td { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } small, div#footer, div#login, div.tabs th, div.tabs td, input, select, .paginate, .functnbar, .functnbar2, .functnbar3, #breadcrumbs, .courtesylinks, #rightcol div.help, .colbar, .tasknav, body.docs div#toc, #leftcol, .legend, .bars { font-size: xx-small; voice-family: "\"}\""; voice-family: inherit; font-size: x-small; } .tabs td, .tabs th, dt, .tasknav .selfref, #login .username, .selection { font-weight: bold; } li.selection ul { font-weight: normal; } #apphead h2 em { font-style: normal; } #banner h1 { font-size: 1.25em; } /* box properties (exclusive of borders), positioning, alignments, list types, text-indent */ #bodycol h2 { margin-top: .3em; margin-bottom: .5em; } p, ul, ol, dl, .bars table { margin-top: .67em; margin-bottom: .67em; } h3, h4 { margin-bottom: 0; } form { margin: 0; } #bodycol { padding-left: 12px; padding-right: 12px; width: 100%; voice-family: "\"}\""; voice-family: inherit; width: auto; } html>body #bodycol { width: auto; } .docs { line-height: 1.4; } ol ol { list-style-type: lower-alpha; } ol ol ol { list-style-type: lower-roman; } .app h3, .app h4 { padding: 5px; margin-right: 2px; margin-left: 2px; } .app td, .app th { padding: 2px 3px; } .h3 p, .h4 p, .h3 dt, .h4 dt { margin-right: 7px; margin-left: 7px; } .tasknav { margin-bottom: 1.33em; } div.colbar { padding: 3px; margin: 2px 2px 0; } .tabs { margin-top: .67em; margin-right: 2px; margin-left: 2px; padding-left: 8px; } .tabs td, .tabs th { padding: 3px 9px; } #rightcol div.www, #rightcol div.help { padding: 0 .5em; } body.docs #toc { position: absolute; top: 15px; left: 0px; width: 120px; padding: 0 20px 0 0; } body.docs #toc ul, #toc ol { margin-left: 0; padding-left: 0; } body.docs #toc li { margin-top: 7px; padding-left: 10px; list-style-type: none; } body.docs div.docs { margin: 61px 0 0 150px; padding: 1em 2em 1em 1em !important; } .docs p+p { text-indent: 5%; margin-top: -.67em; } .docs h3, .docs h4 { margin-bottom: .1em; padding-top: .3em; } .functnbar, .functnbar2, .functnbar3 { padding: 5px; margin: .67em 2px; } .functnbar3 { margin-top: 0; } body { padding: 1em; } body.composite, body.docs { margin: 0; padding: 0; } th, td { text-align: left; vertical-align: top; } .right { text-align: right !important; } .center { text-align: center !important; } .axial th, .axial th .strut { text-align: right; } .app .axial td th { text-align: left; } body .stb { margin-top: 1em; text-indent: 0; } body .mtb { margin-top: 2em; text-indent: 0; } .courtesylinks { margin-top: 1em; padding-top: 1em; } dd { margin-bottom: .67em; } .toolgroup { margin-bottom: 6px; } .toolgroup .body { padding: 4px 4px 4px 0; } .toolgroup .label { padding: 4px; } .toolgroup .body div { padding-bottom: .3em; padding-left: 1em; } .toolgroup .body div div { margin-top: .3em; padding-bottom: 0; } .tier1 { margin-left: 0; } .tier2 { margin-left: 1.5em; } .tier3 { margin-left: 3em; } .tier4 { margin-left: 4.5em; } .tier5 { margin-left: 6em; } .tier6 { margin-left: 7.5em; } .tier7 { margin-left: 9em; } .tier8 { margin-left: 10.5em; } .tier9 { margin-left: 12em; } .tier10 { margin-left: 13.5em; } .filebrowse .expanded, .filebrowse .collapsed { padding-left: 34px; } .filebrowse .leafnode, .filebrowse .leaf { padding-left: 20px; } .messagechild { padding-left: 34px; } .filebrowse-alt .expanded, .filebrowse-alt .collapsed, .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .expandedwaste, .collapsedwaste, .sortup, .sortdown { /* hide from macie5\*/ float: left; /* resume */ display: inline-block; height: 15px; width: 34px; padding-left: 0 !important; } .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .sortup, .sortdown { width: 20px; } .filebrowse ul, .filebrowse-alt ul { list-style-type: none; padding-left: 0; margin-left: 0; } .filebrowse ul ul, .filebrowse-alt ul ul { margin-left: 1.5em; margin-top: 0; padding-top: .67em; } .filebrowse li, .filebrowse-alt li { margin-bottom: .67em; } td.filebrowse h3 { margin-top: 0; } .errormessage, .warningmessage, .donemessage, .infomessage, .docinfo, .dirinfo, .memberinfo, .usergroupinfo { margin: .67em 0; padding: .33em 0 .67em 42px; min-height: 32px; } .errormark, .warningmark, .donemark, .infomark { padding-left: 20px; min-height: 15px; } .alt { display: none; } #banner h1 { margin: 0; } #leftcol { width: 14em; } .axial th, .axial th .strut, #leftcol .strut { width: 12em; } #breadcrumbs { padding: 2px 8px; } .app h3, .app h4, .bars { clear: both; } .legend { float: right; } .legend th, .bars th { text-align: right; padding-left: 1em; } .bars table { table-layout: fixed; } .bars th { width: 12em; } #projectdocumentlist td.filebrowse-alt { padding-right: .75em; } commons-jexl-1.1-src/xdocs/xdoc.xsl100644 0 0 4032 10500374603 14504 0ustar 0 0