[jboss-svn-commits] JBL Code SVN: r15981 - in labs/jbossbuild/maven-build-test/trunk: module1 and 30 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 22 11:28:58 EDT 2007


Author: pgier
Date: 2007-10-22 11:28:58 -0400 (Mon, 22 Oct 2007)
New Revision: 15981

Added:
   labs/jbossbuild/maven-build-test/trunk/module1/pom-alt.xml
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/EJBQLParser.jj
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/plugins/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/plugins/junk/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/plugins/junk/JBossQLParser.jj
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/JBossQLParser.jjt
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/cmp/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/cmp/ejbql/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/cmp/ejbql/EJBQLParser.jjt
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/test/
   labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/test/EJBQLParser.jjt
   labs/jbossbuild/maven-build-test/trunk/module1/src/site/
   labs/jbossbuild/maven-build-test/trunk/module1/src/site/site.xml
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTeller.java
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTellerTestCase.java
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/PropertiesTestCase.java
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/module1/
   labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/module1/junk.properties
   labs/jbossbuild/maven-build-test/trunk/pom-alt.xml
Modified:
   labs/jbossbuild/maven-build-test/trunk/
   labs/jbossbuild/maven-build-test/trunk/module1/pom.xml
   labs/jbossbuild/maven-build-test/trunk/module2/module2-2/pom.xml
   labs/jbossbuild/maven-build-test/trunk/pom.xml
   labs/jbossbuild/maven-build-test/trunk/src/site/site.xml
Log:
Committing to do some release testing


Property changes on: labs/jbossbuild/maven-build-test/trunk
___________________________________________________________________
Name: svn:ignore
   - .classpath
.project
junk

   + .classpath
.project
junk
target
bin


Added: labs/jbossbuild/maven-build-test/trunk/module1/pom-alt.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/pom-alt.xml	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/pom-alt.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,175 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.maven.test</groupId>
+    <artifactId>maven-build-test-parent</artifactId>
+    <version>1.0.6-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.maven.test</groupId>
+  <artifactId>maven-build-test-module1</artifactId>
+  <name>Maven Build Test Module 1 Alternate</name>
+  <description>A project to test the release and packaging features of maven</description>
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/trunk/module1</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/trunk/module1</developerConnection>
+    <url>http://fisheye.jboss.org/repos/jbossbuild/trunk/maven-build-test-module1</url>
+  </scm>
+  <issueManagement>
+    <url>http://jira.jboss.org</url>
+  </issueManagement>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>never</forkMode>
+          
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              
+            </goals>
+            <phase>deploy</phase>
+            <configuration>
+              
+              
+            </configuration>
+          </execution>
+          
+        </executions>
+ 
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources1</id>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources2</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources3</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      
+        <!--<plugin>
+          <groupId>org.jboss.maven.plugins</groupId>
+          <artifactId>maven-jboss-deploy-plugin</artifactId>
+          <version>1.3-SNAPSHOT</version>
+          <executions>
+            <execution>
+              <goals>
+                <goal>jboss-deploy</goal>
+              </goals>
+            </execution>
+          </executions>
+          <configuration>
+            <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
+          </configuration>
+        </plugin>-->
+      <!--<plugin>
+        <groupId>org.apache.maven.plugins</groupId>        
+        <artifactId>maven-release-plugin</artifactId>
+        <version>2.0-beta-5</version>          
+        <configuration>
+          <tagBase>https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/tags</tagBase>
+        </configuration>
+      </plugin>-->
+    </plugins>
+  </build>
+  <repositories>
+    <repository>
+      <id>jboss</id>
+      <name>JBoss Repository</name>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>jboss-snapshots</id>
+      <name>JBoss Snapshot Repository</name>
+      <url>http://snapshots.jboss.org/maven2/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+  <dependencies>
+    <!--<dependency>
+      <groupId>jboss.maven-test</groupId>
+      <artifactId>maven-build-test-module2</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>-->
+    <dependency>
+      <groupId>antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>${antlrVersion}</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-settings</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+  <!--<distributionManagement>
+    <relocation>
+      <groupId>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+      <message>This file has been relocated based on maven recommendations here: http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html</message>
+    </relocation>
+  </distributionManagement>-->
+  <distributionManagement>
+    <repository>
+      <!-- Copy the distribution jar file to a local checkout of the maven repository 
+        -  This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+      <id>repository.jboss.org</id>
+      <url>file://${maven.repository.root}</url>
+    </repository>
+  </distributionManagement>
+  <properties>
+    <antlrVersion>2.7.5</antlrVersion>
+    
+  </properties>
+</project>


Property changes on: labs/jbossbuild/maven-build-test/trunk/module1/pom-alt.xml
___________________________________________________________________
Name: svn:executable
   + *

Modified: labs/jbossbuild/maven-build-test/trunk/module1/pom.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/pom.xml	2007-10-22 13:46:07 UTC (rev 15980)
+++ labs/jbossbuild/maven-build-test/trunk/module1/pom.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -19,6 +19,107 @@
   </issueManagement>
   <build>
     <plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>javacc-maven-plugin</artifactId>
+				<version>2.2-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<id>jjtree-jbossql</id>
+						<goals>
+							<goal>jjtree</goal>
+						</goals>
+						<phase>generate-sources</phase>
+						<configuration>
+							<sourceDirectory>${project.basedir}/src/main/stuff</sourceDirectory>
+							<!--<nodePackage>goofy</nodePackage>-->
+							<includes>
+								<include>**/JBossQLParser.jjt</include>
+                        <include>**/EJBQLParser.jjt</include>
+							</includes>
+							<staleMillis>0</staleMillis>
+						</configuration>
+					</execution>
+					<execution>
+						<id>jjtree-ejbql</id>
+						<goals>
+							<goal>jjtree</goal>
+						</goals>
+						<phase>generate-sources</phase>
+						<configuration>
+							<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+							<nodePackage>org.jboss.ejb.plugins.cmp.ejbql</nodePackage>
+							<includes>
+								<include>**/EJBQLParser.jjt</include>
+							</includes>
+							<staleMillis>1000000000</staleMillis>
+						</configuration>
+					</execution>
+					<execution>
+						<id>javacc</id>
+						<goals>
+							<goal>javacc</goal>
+						</goals>
+						<phase>generate-sources</phase>
+						<configuration>
+							<sourceDirectory>${basedir}/target/generated-sources/jjtree</sourceDirectory>
+							<staleMillis>0</staleMillis>
+						</configuration>						
+					</execution>
+				</executions>
+			</plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>never</forkMode>
+          
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources1</id>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources2</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources3</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+            <configuration>
+              <classifier>jdk14</classifier>
+              
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      
         <!--<plugin>
           <groupId>org.jboss.maven.plugins</groupId>
           <artifactId>maven-jboss-deploy-plugin</artifactId>
@@ -44,27 +145,6 @@
       </plugin>-->
     </plugins>
   </build>
-  <repositories>
-    <repository>
-      <id>jboss</id>
-      <name>JBoss Repository</name>
-      <url>http://repository.jboss.org/maven2/</url>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-    <repository>
-      <id>jboss-snapshots</id>
-      <name>JBoss Snapshot Repository</name>
-      <url>http://snapshots.jboss.org/maven2/</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
   <dependencies>
     <!--<dependency>
       <groupId>jboss.maven-test</groupId>
@@ -72,12 +152,30 @@
       <version>1.0-SNAPSHOT</version>
     </dependency>-->
     <dependency>
-      <groupId>antlr</groupId>
+      <groupId>org.antlr</groupId>
       <artifactId>antlr</artifactId>
-      <version>${antlrVersion}</version>
-      <optional>true</optional>
+      <version>3.0</version>
     </dependency>
-    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-settings</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.6</version>
+    </dependency>
   </dependencies>
   <!--<distributionManagement>
     <relocation>
@@ -94,8 +192,50 @@
       <url>file://${maven.repository.root}</url>
     </repository>
   </distributionManagement>
+  <profiles>
+    <profile>
+      <id>default-jdk</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+        
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-dependency</artifactId>
+          <version>2.0.0-SNAPSHOT</version>
+        </dependency>
+      </dependencies>
+    </profile>
+    <profile>
+      <id>jdk14</id>
+      <activation>
+        <property>
+          <name>jdk14-compat</name>
+        </property>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.jboss.microcontainer-jdk14</groupId>
+          <artifactId>jboss-dependency-jdk14</artifactId>
+          <version>2.0.0-SNAPSHOT</version>
+        </dependency>
+      </dependencies>
+    </profile>
+    
+  </profiles>
   <properties>
     <antlrVersion>2.7.5</antlrVersion>
     
   </properties>
+   <pluginRepositories>
+      <pluginRepository>
+         <id>codehaus</id>
+         <url>http://snapshots.repository.codehaus.org/</url>
+         <releases>
+            <enabled>false</enabled>
+         </releases>
+      </pluginRepository>
+      
+   </pluginRepositories>
 </project>

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/EJBQLParser.jj
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/EJBQLParser.jj	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/EJBQLParser.jj	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,2787 @@
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. /home/pgier/projects/maven-build-test/module1/target/generated-sources/jjtree/org/jboss/ejb/plugins/cmp/ejbql/EJBQLParser.jj */
+/*@egen*//*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+ 
+options {                                          
+   
+   JAVA_UNICODE_ESCAPE = true;
+   STATIC = false;
+
+   CHOICE_AMBIGUITY_CHECK = 5;
+   OTHER_AMBIGUITY_CHECK = 5;
+
+   LOOKAHEAD = 1;
+   DEBUG_PARSER = false;
+   DEBUG_LOOKAHEAD = false;
+   DEBUG_TOKEN_MANAGER = false;
+   ERROR_REPORTING = true;
+   UNICODE_INPUT = false;
+   IGNORE_CASE = false;
+   USER_TOKEN_MANAGER = false;
+   USER_CHAR_STREAM = false;
+   BUILD_PARSER = true;
+   BUILD_TOKEN_MANAGER = true;
+   SANITY_CHECK = true;
+   FORCE_LA_CHECK = false;
+}
+
+PARSER_BEGIN(EJBQLParser)
+package org.jboss.somepackage;
+
+import java.io.CharArrayReader;
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.ejb.plugins.cmp.bridge.EntityBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.FieldBridge;
+
+/**
+ * This class parses EJB-QL into an abstract syntax tree.
+ *
+ * @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version $Revision: 44170 $
+ */                            
+public class EJBQLParser/*@bgen(jjtree)*/implements EJBQLParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
+  protected JJTEJBQLParserState jjtree = new JJTEJBQLParserState();
+
+/*@egen*/
+   private Catalog catalog;
+   private Class[] argumentTypes;
+   private IdentifierManager idManager;
+   private boolean selectDistinct;
+   private String selectPath;
+
+   public ASTEJBQL parse(Catalog catalog, Class[] argumentTypes, String ejbql)
+         throws ParseException {
+
+      this.catalog = catalog;
+      token_source.catalog = catalog;
+      this.argumentTypes = argumentTypes;
+      token_source.argumentTypes = argumentTypes;
+      idManager = new IdentifierManager(catalog);
+      token_source.idManager = idManager;
+
+      String lowerCase = ejbql.toLowerCase();
+      int fromBeginIndex = indexOf(lowerCase, "from");
+      if(fromBeginIndex < 0) {
+         throw new ParseException("FROM not found");
+      }
+
+      int fromEndIndex = indexOf(lowerCase, "where");
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOfOrderBy(lowerCase);
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = ejbql.length();
+      }
+
+      // just the from clause
+      char[] from = ejbql.toCharArray();
+      clear(from, 0, fromBeginIndex);
+      clear(from, fromEndIndex, from.length);
+
+      // everything except for the from clause
+      char[] sansFrom = ejbql.toCharArray();
+      clear(sansFrom, fromBeginIndex + 4, fromEndIndex);
+
+      // From clause
+      ReInit(new CharArrayReader(from));
+      ASTFrom fromNode = ParseFromClause();
+
+      // Everything else
+      ReInit(new CharArrayReader(sansFrom));
+      ASTEJBQL ejbqlNode = EJBQL();
+
+      // replace the dummy from clause in the EJBQL 
+      // node with the real from node
+      ejbqlNode.jjtAddChild(fromNode, 1);
+
+      return ejbqlNode;
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word)
+   {
+      return indexOf(ql, word, 0);
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * starting with startInd position or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word, int startInd)
+   {
+      int i = ql.indexOf(word, startInd);
+      if(i < 0)
+      {
+         return -1;
+      }
+
+      int qlLength = ql.length();
+      int wordLength = word.length();
+      while(i >= 0)
+      {
+         int endInd = i + wordLength;
+         if((i == 0 || Character.isWhitespace(ql.charAt(i - 1))) &&
+            (endInd == qlLength || endInd < qlLength && Character.isWhitespace(ql.charAt(endInd))))
+         {
+            break;
+         }
+
+         i = ql.indexOf(word, i + 1);
+      }
+      return i;
+   }
+
+   private static final int indexOfOrderBy(String ql)
+   {
+      int orderInd = indexOf(ql, "order", 0);
+      int byInd = -1;
+      while(orderInd > 0)
+      {
+         if(byInd < orderInd)
+         {
+            byInd = indexOf(ql, "by", orderInd + 5);
+         }
+
+         if(byInd > 0)
+         {
+            int i = byInd - 1;
+            while(i >= orderInd + 5 && Character.isWhitespace(ql.charAt(i--)));
+            if(i == orderInd + 4)
+            {
+               break;
+            }
+            else
+            {
+               orderInd = indexOf(ql, "order", orderInd + 5);
+            }
+         }
+         else
+         {
+            orderInd = -1;
+         }
+      }
+      return orderInd;
+   }
+
+   private final void clear(char[] c, int beginIndex, int endIndex) {
+      for(int i=beginIndex; i < endIndex; i++) {
+         if(c[i]!='\r' && c[i]!='\n' && c[i]!='\t') {
+            c[i] = ' ';
+         }
+      }
+   }
+
+   private final void initPathNode(ASTPath pathNode, String path, int type) {
+      pathNode.pathList = idManager.getPathList(path);
+      pathNode.fieldList = idManager.getFieldList(path);
+      pathNode.type = type;
+   }
+
+   private final void initParameterNode(
+         ASTParameter parameterNode,
+         String number,
+         int type) {
+         
+      parameterNode.number = Integer.parseInt(number);
+      parameterNode.type = type;
+   }
+}
+
+PARSER_END(EJBQLParser)
+
+ASTEJBQL EJBQL()        :
+{/*@bgen(jjtree) EJBQL */
+  ASTEJBQL jjtn000 = new ASTEJBQL(JJTEJBQL);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EJBQL */
+   try {
+/*@egen*/
+   SelectClause() FromKeyword() [WhereClause()] [OrderByClause()] <EOF>/*@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*/
+}
+
+ASTOrderBy OrderByClause()          :
+{/*@bgen(jjtree) OrderBy */
+  ASTOrderBy jjtn000 = new ASTOrderBy(JJTORDERBY);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) OrderBy */
+   try {
+/*@egen*/
+   <ORDER> <BY> OrderByPathExpression() ( <COMMA> OrderByPathExpression() ) */*@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 OrderByPathExpression()              :
+{/*@bgen(jjtree) OrderByPath */
+  ASTOrderByPath jjtn000 = new ASTOrderByPath(JJTORDERBYPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) OrderByPath */
+   try {
+/*@egen*/
+   ( NumericValuedPath() | StringValuedPath() | DatetimeValuedPath() )
+      [<ASC> | <DESC> { jjtn000.ascending=false; } ]/*@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 FromKeyword()       :
+{/*@bgen(jjtree) From */
+  ASTFrom jjtn000 = new ASTFrom(JJTFROM);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) From */
+   try {
+/*@egen*/
+   <FROM>/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+ASTFrom ParseFromClause()       :
+{ ASTFrom node; }
+{
+   node = FromClause() <EOF>
+   { return node; }
+}
+
+ASTFrom FromClause()       :
+{/*@bgen(jjtree) From */
+  ASTFrom jjtn000 = new ASTFrom(JJTFROM);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) From */
+   try {
+/*@egen*/
+   (
+      <FROM> IdentificationVariableDeclaration() 
+         ( <COMMA> IdentificationVariableDeclaration() )*
+   )/*@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 IdentificationVariableDeclaration()       :
+{}
+{
+   (CollectionMemberDeclaration() | RangeVariableDeclaration())
+}
+
+void CollectionMemberDeclaration() :
+{/*@bgen(jjtree) CollectionMemberDeclaration */
+   ASTCollectionMemberDeclaration jjtn000 = new ASTCollectionMemberDeclaration(JJTCOLLECTIONMEMBERDECLARATION);
+   boolean jjtc000 = true;
+   jjtree.openNodeScope(jjtn000);
+/*@egen*/
+   Token path;
+   Token id;
+}
+{/*@bgen(jjtree) CollectionMemberDeclaration */
+   try {
+/*@egen*/
+   ( <IN> <LPAREN> path=CollectionValuedPath() <RPAREN>
+      [<AS>] id=Identifier() )/*@bgen(jjtree)*/
+      {
+        jjtree.closeNodeScope(jjtn000, true);
+        jjtc000 = false;
+      }
+/*@egen*/
+      { idManager.declareCollectionMember(id.image, path.image); }/*@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 RangeVariableDeclaration() :
+{/*@bgen(jjtree) RangeVariableDeclaration */
+   ASTRangeVariableDeclaration jjtn000 = new ASTRangeVariableDeclaration(JJTRANGEVARIABLEDECLARATION);
+   boolean jjtc000 = true;
+   jjtree.openNodeScope(jjtn000);
+/*@egen*/
+   Token schema;
+   Token id;
+}
+{/*@bgen(jjtree) RangeVariableDeclaration */
+   try {
+/*@egen*/
+   ( schema=AbstractSchema() [<AS>] id=Identifier() )/*@bgen(jjtree)*/
+      {
+        jjtree.closeNodeScope(jjtn000, true);
+        jjtc000 = false;
+      }
+/*@egen*/
+      { idManager.declareRangeVariable(id.image, schema.image); }/*@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*/
+}
+
+ASTSelect SelectClause()         :
+{/*@bgen(jjtree) Select */
+  ASTSelect jjtn000 = new ASTSelect(JJTSELECT);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Select */
+   try {
+/*@egen*/
+   (
+      <SELECT> [<DISTINCT> { jjtn000.distinct=true; }] 
+      ( 
+         <OBJECT> <LPAREN> IdentificationVariable() <RPAREN> |
+         SelectExpression()
+      )
+   )/*@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 SelectExpression()       :
+{}
+{
+   SingleValuedPath() | AggregateSelectExpression()
+}
+
+ASTWhere WhereClause()        :
+{/*@bgen(jjtree) Where */
+  ASTWhere jjtn000 = new ASTWhere(JJTWHERE);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Where */
+   try {
+/*@egen*/
+   <WHERE> WhereExpression()/*@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*/
+}
+
+//
+// ASTWhereExpression and ASTWhereConditionalTerm mimic
+// ConditionalExpression and ConditionalTerm.
+// They are added to support joins per WhereConditionalTerm.
+//
+void WhereExpression()       :
+{}
+{/*@bgen(jjtree) #Or(> 1) */
+   {
+     ASTOr jjtn001 = new ASTOr(JJTOR);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      WhereConditionalTerm() ( <OR> WhereConditionalTerm() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+ASTWhereConditionalTerm WhereConditionalTerm()                       :
+{/*@bgen(jjtree) WhereConditionalTerm */
+  ASTWhereConditionalTerm jjtn000 = new ASTWhereConditionalTerm(JJTWHERECONDITIONALTERM);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) WhereConditionalTerm */
+   try {
+/*@egen*//*@bgen(jjtree) #And(> 1) */
+   {
+     ASTAnd jjtn001 = new ASTAnd(JJTAND);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*//*@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 ConditionalExpression()       :
+{}
+{/*@bgen(jjtree) #Or(> 1) */
+   {
+     ASTOr jjtn001 = new ASTOr(JJTOR);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ConditionalTerm() ( <OR> ConditionalTerm() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ConditionalTerm()       :
+{}
+{/*@bgen(jjtree) #And(> 1) */
+   {
+     ASTAnd jjtn001 = new ASTAnd(JJTAND);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+   
+void ConditionalFactor()       :
+{ boolean not = false; }
+{/*@bgen(jjtree) #Not( not) */
+   {
+     ASTNot jjtn001 = new ASTNot(JJTNOT);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      [<NOT>{ not=true; }] ConditionalTest()
+   )/*@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,  not);
+     }
+   }
+/*@egen*/
+}
+
+void ConditionalTest()       :
+{}
+{
+   ConditionalPrimary()
+}
+
+void ConditionalPrimary()       :
+{}
+{
+   LOOKAHEAD(<LPAREN> ConditionalExpression() <RPAREN>)/*@bgen(jjtree) ConditionalParenthetical */
+      {
+        ASTConditionalParenthetical jjtn001 = new ASTConditionalParenthetical(JJTCONDITIONALPARENTHETICAL);
+        boolean jjtc001 = true;
+        jjtree.openNodeScope(jjtn001);
+      }
+      try {
+/*@egen*/
+      (<LPAREN> ConditionalExpression() <RPAREN>)/*@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, true);
+        }
+      }
+/*@egen*/ 
+|
+   SimpleCondExpression()
+}
+
+void SimpleCondExpression()       :
+{}
+{
+   EmptyCollectionComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IS })
+      NullComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==MEMBER || getToken(3).kind==MEMBER })
+      CollectionMemberExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==LIKE || getToken(3).kind==LIKE })
+      LikeExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IN || getToken(3).kind==IN })
+      InExpression()
+| 
+   ComparisonExpression()
+}
+
+void BetweenExpression()          :
+{/*@bgen(jjtree) Between */
+  ASTBetween jjtn000 = new ASTBetween(JJTBETWEEN);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Between */
+   try {
+/*@egen*/
+   ArithmeticExpression() [<NOT> { jjtn000.not=true; } ] <BETWEEN> 
+      ArithmeticExpression() <AND> ArithmeticExpression()/*@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 InExpression()     :
+{/*@bgen(jjtree) In */
+  ASTIn jjtn000 = new ASTIn(JJTIN);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) In */
+   try {
+/*@egen*/
+   (StringExpression() [<NOT> { jjtn000.not=true; } ] <IN>
+      <LPAREN> StringExpression() ( <COMMA> StringExpression() )* <RPAREN>)
+|
+   (ArithmeticPrimary() [<NOT> { jjtn000.not=true; } ] <IN>
+      <LPAREN>  ArithmeticPrimary() ( <COMMA> ArithmeticPrimary() )* <RPAREN>)/*@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 LikeExpression()       :
+{/*@bgen(jjtree) Like */
+  ASTLike jjtn000 = new ASTLike(JJTLIKE);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Like */
+   try {
+/*@egen*/
+   StringValuedPath() [<NOT> { jjtn000.not=true; } ] <LIKE>
+      StringExpression() [<ESCAPE> (StringLiteral() | NumericValuedParameter())]/*@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 NullComparisonExpression()                 :
+{/*@bgen(jjtree) NullComparison */
+  ASTNullComparison jjtn000 = new ASTNullComparison(JJTNULLCOMPARISON);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) NullComparison */
+   try {
+/*@egen*/
+   (
+      SingleValuedPath() |
+      NumericValuedParameter() |
+      EntityValuedParameter() |
+      StringValuedParameter() |
+      DatetimeValuedParameter() |
+      BooleanValuedParameter()
+   )
+   <IS> [<NOT> { jjtn000.not=true; } ] <NULL>/*@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 EmptyCollectionComparisonExpression()          :
+{/*@bgen(jjtree) IsEmpty */
+  ASTIsEmpty jjtn000 = new ASTIsEmpty(JJTISEMPTY);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) IsEmpty */
+   try {
+/*@egen*/
+   CollectionValuedPath() <IS> [<NOT> { jjtn000.not=true; } ] <EMPTY>/*@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 CollectionMemberExpression()           :
+{/*@bgen(jjtree) MemberOf */
+  ASTMemberOf jjtn000 = new ASTMemberOf(JJTMEMBEROF);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberOf */
+   try {
+/*@egen*/
+   (EntityValuedPath() |
+         IdentificationVariable() |
+         EntityValuedParameter())
+      [<NOT> { jjtn000.not=true; } ] <MEMBER> [<OF>] CollectionValuedPath()/*@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 ComparisonExpression()       :
+{}
+{/*@bgen(jjtree) StringComparison */
+   {
+     ASTStringComparison jjtn001 = new ASTStringComparison(JJTSTRINGCOMPARISON);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      StringValue() 
+      (
+         <EQ> { jjtn001.opp="="; } |
+         <GT> { jjtn001.opp=">"; } |
+         <GE> { jjtn001.opp=">="; } |
+         <LT> { jjtn001.opp="<"; } |
+         <LE> { jjtn001.opp="<="; } |
+         <NE> { jjtn001.opp="<>"; }
+      )
+      StringExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) BooleanComparison */
+   {
+     ASTBooleanComparison jjtn002 = new ASTBooleanComparison(JJTBOOLEANCOMPARISON);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      BooleanValue()
+      [
+         ( 
+            <EQ> { jjtn002.opp="="; } |
+            <NE> { jjtn002.opp="<>"; }
+         ) BooleanExpression()
+      ]
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) DatetimeComparison */
+   {
+     ASTDatetimeComparison jjtn003 = new ASTDatetimeComparison(JJTDATETIMECOMPARISON);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      DatetimeValue()
+      (
+         <EQ> { jjtn003.opp="="; } |
+         <GT> { jjtn003.opp=">"; } |
+         <LT> { jjtn003.opp="<"; } |
+         <NE> { jjtn003.opp="<>"; } |
+         <GE> { jjtn003.opp=">="; } |
+         <LE> { jjtn003.opp="<="; }
+      )
+      DatetimeExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) EntityComparison */
+   {
+     ASTEntityComparison jjtn004 = new ASTEntityComparison(JJTENTITYCOMPARISON);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      EntityBeanValue()
+      (
+         <EQ> { jjtn004.opp="="; } |
+         <NE> { jjtn004.opp="<>"; }
+      )
+      EntityBeanExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+   LOOKAHEAD(ArithmeticValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )/*@bgen(jjtree) ArithmeticComparison */
+   {
+     ASTArithmeticComparison jjtn005 = new ASTArithmeticComparison(JJTARITHMETICCOMPARISON);
+     boolean jjtc005 = true;
+     jjtree.openNodeScope(jjtn005);
+   }
+   try {
+/*@egen*/
+   ( 
+      ArithmeticValue()
+      (
+         <EQ> { jjtn005.opp="="; } |
+         <GT> { jjtn005.opp=">"; } |
+         <GE> { jjtn005.opp=">="; } |
+         <LT> { jjtn005.opp="<"; } |
+         <LE> { jjtn005.opp="<="; } |
+         <NE> { jjtn005.opp="<>"; } 
+      )
+      SingleValueDesignator()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+   BetweenExpression() 
+}
+
+void ArithmeticValue()       :
+{}
+{
+   NumericValuedPath() | FunctionsReturningNumerics()
+}
+
+void SingleValueDesignator()       :
+{}
+{
+   ScalarExpression()
+}
+
+void ScalarExpression()       :
+{}
+{
+   ArithmeticExpression()
+}
+
+void ArithmeticExpression()       :
+{}
+{/*@bgen(jjtree) #PlusMinus(> 1) */
+   {
+     ASTPlusMinus jjtn001 = new ASTPlusMinus(JJTPLUSMINUS);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ArithmeticTerm()
+      (
+         (
+            <PLUS> { jjtn001.addOpp("+"); } |
+            <MINUS> { jjtn001.addOpp("-"); }
+         ) ArithmeticTerm()
+      )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ArithmeticTerm()       :
+{}
+{/*@bgen(jjtree) #MultDiv(> 1) */
+   {
+     ASTMultDiv jjtn001 = new ASTMultDiv(JJTMULTDIV);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ArithmeticFactor() 
+      (
+         (
+            <MULT> { jjtn001.addOpp("*"); } |
+            <DIV> { jjtn001.addOpp("/"); }
+         ) ArithmeticFactor()
+      )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ArithmeticFactor()       :
+{ boolean negation = false; }
+{/*@bgen(jjtree) #Negation( negation) */
+   {
+     ASTNegation jjtn001 = new ASTNegation(JJTNEGATION);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      [<PLUS>|<MINUS>{negation=true;}] ArithmeticPrimary()
+   )/*@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,  negation);
+     }
+   }
+/*@egen*/
+}
+
+void ArithmeticPrimary()       :
+{}
+{
+   NumericValuedPath() |
+   NumericLiteral() |/*@bgen(jjtree) ArithmeticParenthetical */
+   {
+     ASTArithmeticParenthetical jjtn001 = new ASTArithmeticParenthetical(JJTARITHMETICPARENTHETICAL);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (<LPAREN> ArithmeticExpression() <RPAREN>)/*@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, true);
+     }
+   }
+/*@egen*/ |
+   NumericValuedParameter() |
+   FunctionsReturningNumerics()
+}
+
+void StringValue()       :
+{}
+{
+   StringValuedPath() | FunctionsReturningStrings()
+}
+
+void StringExpression()       :
+{}
+{
+   StringPrimary() | StringValuedParameter() 
+}
+
+void StringPrimary()       :
+{}
+{
+   StringValuedPath() |
+   StringLiteral() |/*@bgen(jjtree) StringParenthetical */
+   {
+     ASTStringParenthetical jjtn001 = new ASTStringParenthetical(JJTSTRINGPARENTHETICAL);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/ 
+   (<LPAREN> StringExpression() <RPAREN>)/*@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, true);
+     }
+   }
+/*@egen*/ |
+   FunctionsReturningStrings()
+}
+
+void DatetimeValue()       :
+{}
+{
+   DatetimeValuedPath() 
+}
+
+void DatetimeExpression()       :
+{}
+{
+   DatetimeValue() | DatetimeValuedParameter() 
+}
+
+void BooleanValue()       :
+{}
+{
+   BooleanValuedPath() 
+}
+
+void BooleanExpression()       :
+{}
+{
+   BooleanValue() | BooleanValuedParameter() | BooleanLiteral()
+}
+
+void EntityBeanValue()       :
+{}
+{
+   EntityValuedPath() | IdentificationVariable()
+}
+
+void EntityBeanExpression()       :
+{}
+{
+   EntityBeanValue() | EntityValuedParameter() 
+}
+
+void FunctionsReturningStrings()       :
+{}
+{/*@bgen(jjtree) Concat */
+   {
+     ASTConcat jjtn001 = new ASTConcat(JJTCONCAT);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      <CONCAT> <LPAREN> StringExpression() <COMMA> StringExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Substring */
+   {
+     ASTSubstring jjtn002 = new ASTSubstring(JJTSUBSTRING);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      <SUBSTRING> <LPAREN> 
+         StringExpression() <COMMA>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+}
+
+void FunctionsReturningNumerics()       :
+{}
+{/*@bgen(jjtree) Length */
+   {
+     ASTLength jjtn001 = new ASTLength(JJTLENGTH);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      <LENGTH> <LPAREN> StringExpression() <RPAREN> 
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Locate */
+   {
+     ASTLocate jjtn002 = new ASTLocate(JJTLOCATE);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      <LOCATE> <LPAREN> 
+            StringExpression() <COMMA> StringExpression()
+            [ <COMMA> ArithmeticExpression()] <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Abs */
+   {
+     ASTAbs jjtn003 = new ASTAbs(JJTABS);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      <ABS> <LPAREN> ArithmeticExpression() <RPAREN> 
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Sqrt */
+   {
+     ASTSqrt jjtn004 = new ASTSqrt(JJTSQRT);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      <SQRT> <LPAREN> ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Mod */
+   {
+     ASTMod jjtn005 = new ASTMod(JJTMOD);
+     boolean jjtc005 = true;
+     jjtree.openNodeScope(jjtn005);
+   }
+   try {
+/*@egen*/
+   (
+      <MOD> <LPAREN> ArithmeticExpression() <COMMA> ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+}
+
+Token CollectionValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<COLLECTION_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { 
+      initPathNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE); 
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+Token IdentificationVariable()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<IDENTIFICATION_VARIABLE>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { 
+      t.image = t.image.toLowerCase();
+      initPathNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE); 
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+Token AbstractSchema()                 :
+{/*@bgen(jjtree) AbstractSchema */
+  ASTAbstractSchema jjtn000 = new ASTAbstractSchema(JJTABSTRACTSCHEMA);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) AbstractSchema */
+   try {
+/*@egen*/
+   t=<ABSTRACT_SCHEMA>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { 
+      jjtn000.abstractSchemaName = t.image;
+      jjtn000.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t; 
+   }
+   |
+   t=<ORDER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   {
+      jjtn000.abstractSchemaName = t.image;
+      jjtn000.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+Token Identifier()             :
+{/*@bgen(jjtree) Identifier */
+  ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Identifier */
+   try {
+/*@egen*/
+   t=<IDENTIFIER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { 
+      t.image = t.image.toLowerCase();
+      jjtn000.identifier = t.image;
+      return t; 
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void SingleValuedPath()       :
+{}
+{
+   NumericValuedPath()
+|  StringValuedPath()
+|  DatetimeValuedPath()
+|  BooleanValuedPath()
+|  EntityValuedPath()
+|  ValueClassValuedPath()
+}
+
+void NumericValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<NUMERIC_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initPathNode(jjtn000, t.image, EJBQLTypes.NUMERIC_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void StringValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<STRING_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initPathNode(jjtn000, t.image, EJBQLTypes.STRING_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void DatetimeValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<DATETIME_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initPathNode(jjtn000, t.image, EJBQLTypes.DATETIME_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void BooleanValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<BOOLEAN_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initPathNode(jjtn000, t.image, EJBQLTypes.BOOLEAN_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void EntityValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<ENTITY_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initPathNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void ValueClassValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<VALUE_CLASS_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initPathNode(jjtn000, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void NumericValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<NUMERIC_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.NUMERIC_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void StringValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<STRING_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.STRING_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void DatetimeValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<DATETIME_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.DATETIME_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void BooleanValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<BOOLEAN_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.BOOLEAN_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void EntityValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<ENTITY_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void ValueClassValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<VALUE_CLASS_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void NumericLiteral()       :
+{ Token t; }
+{/*@bgen(jjtree) ExactNumericLiteral */
+   {
+     ASTExactNumericLiteral jjtn001 = new ASTExactNumericLiteral(JJTEXACTNUMERICLITERAL);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      t=<INTEGER_LITERAL>/*@bgen(jjtree)*/
+                          {
+                            jjtree.closeNodeScope(jjtn001, true);
+                            jjtc001 = false;
+                          }
+/*@egen*/ { jjtn001.setValue(t.image); }
+   )/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc001) {
+       jjtree.closeNodeScope(jjtn001, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) ApproximateNumericLiteral */
+   {
+     ASTApproximateNumericLiteral jjtn002 = new ASTApproximateNumericLiteral(JJTAPPROXIMATENUMERICLITERAL);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/ 
+   (
+      t=<FLOATING_POINT_LITERAL>/*@bgen(jjtree)*/
+                                 {
+                                   jjtree.closeNodeScope(jjtn002, true);
+                                   jjtc002 = false;
+                                 }
+/*@egen*/ { jjtn002.setValue(t.image); }
+   )/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc002) {
+       jjtree.closeNodeScope(jjtn002, true);
+     }
+   }
+/*@egen*/
+}
+
+void StringLiteral()                :
+{/*@bgen(jjtree) StringLiteral */
+  ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) StringLiteral */
+   try {
+/*@egen*/
+   t=<STRING_LITERAL>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/ 
+   { jjtn000.value=t.image; }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void BooleanLiteral()                 :
+{/*@bgen(jjtree) BooleanLiteral */
+  ASTBooleanLiteral jjtn000 = new ASTBooleanLiteral(JJTBOOLEANLITERAL);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) BooleanLiteral */
+   try {
+/*@egen*/
+   <TRUE>/*@bgen(jjtree)*/
+          {
+            jjtree.closeNodeScope(jjtn000, true);
+            jjtc000 = false;
+          }
+/*@egen*/ { jjtn000.value=true; } | <FALSE>/*@bgen(jjtree)*/
+                                            {
+                                              jjtree.closeNodeScope(jjtn000, true);
+                                              jjtc000 = false;
+                                            }
+/*@egen*/ { jjtn000.value=false; }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/ 
+}
+
+void AggregateSelectExpression()      :
+{}
+{/*@bgen(jjtree) Avg */
+   {
+     ASTAvg jjtn001 = new ASTAvg(JJTAVG);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      <AVG> <LPAREN> [<DISTINCT> {jjtn001.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Max */
+   {
+     ASTMax jjtn002 = new ASTMax(JJTMAX);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      <MAX> <LPAREN> [<DISTINCT> {jjtn002.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Min */
+   {
+     ASTMin jjtn003 = new ASTMin(JJTMIN);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      <MIN> <LPAREN> [<DISTINCT> {jjtn003.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Sum */
+   {
+     ASTSum jjtn004 = new ASTSum(JJTSUM);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      <SUM> <LPAREN> [<DISTINCT> {jjtn004.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Count */
+   {
+     ASTCount jjtn005 = new ASTCount(JJTCOUNT);
+     boolean jjtc005 = true;
+     jjtree.openNodeScope(jjtn005);
+   }
+   try {
+/*@egen*/
+   (
+      <COUNT> <LPAREN> [<DISTINCT> {jjtn005.distinct="DISTINCT";}]
+      (
+         SingleValuedPath() | EntityBeanValue()
+      )
+      <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+}
+
+/////////////////////////
+//  Tokens
+/////////////////////////
+
+TOKEN_MGR_DECLS :
+{
+   public Catalog catalog;
+   public Class[] argumentTypes;
+   public IdentifierManager idManager;
+
+   // used for navigation building
+   private List pathList;
+   private List fieldList;
+   private String path;
+
+   private void resetPath() {
+      path = "";
+      pathList = new ArrayList();
+      fieldList = new ArrayList();
+   }
+   
+   private void throwUnknownPath(
+         String reason,
+         String fieldName) {
+
+      throw new UnknownPathException(
+            reason,
+            path,
+            fieldName,
+            input_stream.getEndLine(),
+            input_stream.getEndColumn());
+   }
+   
+   private void addPath(String nav) {
+      String fieldName = nav.substring(0, nav.length()-1);
+      if(fieldList.size() > 0) {
+         FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+         if(field == null) {
+            throwUnknownPath("Unknown cmr field in path", fieldName);
+         }
+         if(!(field instanceof CMRFieldBridge)) {
+            throwUnknownPath("In path field is not a cmr field", fieldName);
+         }
+
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(!cmrField.isSingleValued()) {
+            throwUnknownPath("In path cmr field is collection valued",
+                  fieldName);
+         }
+         fieldList.add(cmrField);
+      } else {
+         EntityBridge entityBridge = idManager.getEntity(fieldName);
+         if(entityBridge == null) {
+            throwUnknownPath("Unknown initial identifier", fieldName);
+         }
+         fieldList.add(entityBridge);
+      }
+      pathList.add(path + fieldName);
+      path += nav;
+   }
+
+   private EntityBridge getCurrentSchema() {
+      Object lastElement = fieldList.get(fieldList.size()-1);
+      if(lastElement instanceof EntityBridge) {
+         return (EntityBridge)lastElement;
+      } else if(lastElement instanceof CMRFieldBridge) {
+         return ((CMRFieldBridge)lastElement).getRelatedEntity();
+      }
+      // should never happen
+      throw new IllegalStateException("Unknown path element type: " +
+            lastElement);
+   }
+}
+
+<DEFAULT> SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* RESERVED WORDS */
+{
+   < ABS: "ABS" >
+|  < AND: "AND" >
+|  < AS: "AS" >
+|  < BETWEEN: "BETWEEN" >
+|  < CONCAT: "CONCAT" >
+|  < DISTINCT: "DISTINCT" >
+|  < EMPTY: "EMPTY" >
+|  < ESCAPE: "ESCAPE" >
+|  < FROM: "FROM" >
+|  < IN: "IN" >
+|  < IS: "IS" >
+|  < LENGTH: "LENGTH" >
+|  < LIKE: "LIKE" >
+|  < LOCATE: "LOCATE" >
+|  < NOT: "NOT" >
+|  < NULL: "NULL" >
+|  < OBJECT: "OBJECT" >
+|  < OF: "OF " >
+|  < OR: "OR" >
+|  < SELECT: "SELECT" >
+|  < SUBSTRING: "SUBSTRING" >
+|  < SQRT: "SQRT" >
+|  < UNKNOWN: "UNKNOWN" >
+|  < WHERE: "WHERE" >
+|  < MEMBER: "MEMBER" >
+
+// EJB QL 2.1 tokens
+
+|  < ORDER: "ORDER" >
+|  < BY: "BY" >
+|  < ASC: "ASC" >
+|  < DESC: "DESC" >
+|  < COUNT: "COUNT" >
+|  < MAX: "MAX" >
+|  < MIN: "MIN" >
+|  < AVG: "AVG" >
+|  < SUM: "SUM" >
+|  < MOD: "MOD" >
+}
+
+<DEFAULT> TOKEN : /* SEPARATORS */
+{
+  < LPAREN: "(" >
+| < RPAREN: ")" >
+| < COMMA: "," >
+| < DOT: "." >
+}
+
+<DEFAULT> TOKEN : /* OPERATORS */
+{
+  < GT: ">" >
+| < LT: "<" >
+| < EQ: "=" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "<>" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < MULT: "*" >
+| < DIV: "/" >
+}
+
+<DEFAULT> TOKEN : /* String Literal */
+{
+   < STRING_LITERAL: "'" (~["'"])* ( "''" (~["'"])* )* "'" >
+}
+
+<DEFAULT> TOKEN : /* Numeric Literal */
+{
+   < INTEGER_LITERAL:
+      <DECIMAL_LITERAL> (["l","L"])?
+      | <HEX_LITERAL> (["l","L"])?
+      | <OCTAL_LITERAL> (["l","L"])?
+   >
+|
+   < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+   < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+   < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+   < FLOATING_POINT_LITERAL:
+      (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+   >
+|
+   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* Boolean Literal */
+{
+   < FALSE: "FALSE" >
+|  < TRUE: "TRUE" >
+}
+
+<DEFAULT> TOKEN : /* IDENTIFIERS */
+{
+   < IDENTIFIER: <NAME> >
+   {
+      if(catalog.getEntityByAbstractSchemaName(matchedToken.image) != null) {
+         matchedToken.kind = ABSTRACT_SCHEMA;
+      } else if(idManager.getEntity(matchedToken.image.toLowerCase()) != null) {
+         matchedToken.kind = IDENTIFICATION_VARIABLE;
+         matchedToken.image = matchedToken.image.toLowerCase();
+
+         List pathList = new ArrayList();
+         pathList.add(matchedToken.image);
+         List fieldList = new ArrayList();
+         fieldList.add(idManager.getEntity(matchedToken.image));
+         idManager.registerPath(matchedToken.image, pathList, fieldList);
+      }
+   }
+|
+   < ABSTRACT_SCHEMA: [] >
+|
+   < IDENTIFICATION_VARIABLE: [] >
+|
+   < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+   < #LETTER:
+      [
+       "$",
+       "A"-"Z",
+       "_",
+       "a"-"z",
+       "\u00c0"-"\u00d6",
+       "\u00d8"-"\u00f6",
+       "\u00f8"-"\u00ff",
+       "\u0100"-"\u1fff",
+       "\u3040"-"\u318f",
+       "\u3300"-"\u337f",
+       "\u3400"-"\u3d2d",
+       "\u4e00"-"\u9fff",
+       "\uf900"-"\ufaff"
+      ]
+   >
+|
+   < #DIGIT:
+      [
+       "0"-"9",
+       "\u0660"-"\u0669",
+       "\u06f0"-"\u06f9",
+       "\u0966"-"\u096f",
+       "\u09e6"-"\u09ef",
+       "\u0a66"-"\u0a6f",
+       "\u0ae6"-"\u0aef",
+       "\u0b66"-"\u0b6f",
+       "\u0be7"-"\u0bef",
+       "\u0c66"-"\u0c6f",
+       "\u0ce6"-"\u0cef",
+       "\u0d66"-"\u0d6f",
+       "\u0e50"-"\u0e59",
+       "\u0ed0"-"\u0ed9",
+       "\u1040"-"\u1049"
+      ]
+   >
+}
+
+<DEFAULT> TOKEN : /* PARAMETERS */
+{
+   < UNKNOWN_PARAMETER: "?" <INTEGER_LITERAL> >
+   {
+      int n = EJBQLTypes.UNKNOWN_TYPE;
+      try { 
+         n = Integer.parseInt(matchedToken.image.substring(1, lengthOfMatch));
+      } catch(Exception e) { /* Should never come here. */ }
+      
+      matchedToken.image = "" + n;
+
+      // zero base the index
+      n--;   
+      
+      if(n < argumentTypes.length) {
+         switch(EJBQLTypes.getEJBQLType(argumentTypes[n])) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PARAMETER;
+               break;
+         }
+      }
+   }
+|  < NUMERIC_VALUED_PARAMETER: [] >
+|  < STRING_VALUED_PARAMETER: [] >
+|  < DATETIME_VALUED_PARAMETER: [] >
+|  < BOOLEAN_VALUED_PARAMETER: [] >
+|  < ENTITY_VALUED_PARAMETER: [] >
+|  < VALUE_CLASS_VALUED_PARAMETER: [] >
+}
+
+/**
+ * WARNING: Be careful here. If look ahead is to high in the from clause, it
+ * is possible that the identification varible is not registered before it
+ * is used here.
+ */
+<DEFAULT> SPECIAL_TOKEN :  /* Navigation */
+{
+   < <NAME> <DOT> > { 
+      resetPath();
+      addPath(matchedToken.image.toLowerCase()); 
+   } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> SPECIAL_TOKEN :
+{
+   < <NAME> <DOT> > { addPath(matchedToken.image); } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> TOKEN :
+{
+   < PART: <NAME> > {
+      String fieldName = matchedToken.image;
+      matchedToken.image = path + fieldName;
+
+      FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+      if(field == null) {
+         throwUnknownPath("Unknown terminal field", fieldName);
+      }
+      if(field instanceof CMPFieldBridge) {
+         CMPFieldBridge cmpField = (CMPFieldBridge)field;
+         switch(EJBQLTypes.getEJBQLType(cmpField.getFieldType())) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PATH;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PATH;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PATH;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PATH;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PATH;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PATH;
+               break;
+            default:
+               throwUnknownPath("Unknown cmp field type", fieldName);
+         }
+      } else {
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(cmrField.isSingleValued()) {
+            matchedToken.kind = ENTITY_VALUED_PATH;
+         } else {
+            matchedToken.kind = COLLECTION_VALUED_PATH;
+         }
+      }
+      pathList.add(matchedToken.image);
+      fieldList.add(field);
+      idManager.registerPath(matchedToken.image, pathList, fieldList);
+      resetPath();
+   } : DEFAULT
+|  < NUMERIC_VALUED_PATH: [] >
+|  < STRING_VALUED_PATH: [] >
+|  < DATETIME_VALUED_PATH: [] >
+|  < BOOLEAN_VALUED_PATH: [] >
+|  < ENTITY_VALUED_PATH: [] >
+|  < VALUE_CLASS_VALUED_PATH: [] >
+|  < UNKNOWN_PATH: [] >
+|  < COLLECTION_VALUED_PATH: [] >
+}  
+
+

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/plugins/junk/JBossQLParser.jj
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/plugins/junk/JBossQLParser.jj	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/main/javacc-stuff/org/jboss/ejb/plugins/junk/JBossQLParser.jj	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,2994 @@
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. /home/pgier/projects/maven-build-test/module1/target/generated-sources/jjtree/org/jboss/ejb/plugins/cmp/ejbql/JBossQLParser.jj */
+/*@egen*//*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+ 
+options {                                                           
+
+   JAVA_UNICODE_ESCAPE = true;
+   STATIC = false;
+
+   CHOICE_AMBIGUITY_CHECK = 5;
+   OTHER_AMBIGUITY_CHECK = 5;
+
+   LOOKAHEAD = 1;
+   DEBUG_PARSER = false;
+   DEBUG_LOOKAHEAD = false;
+   DEBUG_TOKEN_MANAGER = false;
+   ERROR_REPORTING = true;
+   UNICODE_INPUT = false;
+   IGNORE_CASE = false;
+   USER_TOKEN_MANAGER = false;
+   USER_CHAR_STREAM = false;
+   BUILD_PARSER = true;
+   BUILD_TOKEN_MANAGER = true;
+   SANITY_CHECK = true;
+   FORCE_LA_CHECK = false;
+}
+
+PARSER_BEGIN(JBossQLParser)
+package org.jboss.ejb.plugins.cmp.ejbql;
+
+import java.io.CharArrayReader;
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.ejb.plugins.cmp.bridge.EntityBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.FieldBridge;
+
+/**
+ * This class parses JBossQL into an abstract syntax tree.
+ *
+ * @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
+ * @author <a href="mailto:alex at jboss.org">Alex Loubyansky</a>
+ * @version $Revision: 44170 $
+ */
+public class JBossQLParser/*@bgen(jjtree)*/implements JBossQLParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
+  protected JJTJBossQLParserState jjtree = new JJTJBossQLParserState();
+
+/*@egen*/
+   private Catalog catalog;
+   private Class[] argumentTypes;
+   private IdentifierManager idManager;
+   private boolean selectDistinct;
+   private String selectPath;
+
+   public ASTEJBQL parse(Catalog catalog, Class[] argumentTypes, String ejbql)
+         throws ParseException {
+
+      this.catalog = catalog;
+      token_source.catalog = catalog;
+      this.argumentTypes = argumentTypes;
+      token_source.argumentTypes = argumentTypes;
+      idManager = new IdentifierManager(catalog);
+      token_source.idManager = idManager;
+
+      String lowerCase = ejbql.toLowerCase();
+      int fromBeginIndex = indexOf(lowerCase, "from");
+      if(fromBeginIndex < 0) {
+         throw new ParseException("FROM not found");
+      }
+
+      int fromEndIndex = indexOf(lowerCase, "where");
+      ///////////////////// CHANGED //////////////////////////////
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOfOrderBy(lowerCase);
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOf(lowerCase, "offset");
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOf(lowerCase, "limit");
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = ejbql.length();
+      }
+      ////////////////////////////////////////////////////////////
+
+      // just the from clause
+      char[] from = ejbql.toCharArray();
+      clear(from, 0, fromBeginIndex);
+      clear(from, fromEndIndex, from.length);
+
+      // everything except for the from clause
+      char[] sansFrom = ejbql.toCharArray();
+      clear(sansFrom, fromBeginIndex + 4, fromEndIndex);
+
+      // From clause
+      ReInit(new CharArrayReader(from));
+      ASTFrom fromNode = ParseFromClause();
+
+      // Everything else
+      ReInit(new CharArrayReader(sansFrom));
+      ASTEJBQL ejbqlNode = EJBQL();
+
+      // replace the dummy from clause in the EJBQL
+      // node with the real from node
+      ejbqlNode.jjtAddChild(fromNode, 1);
+
+      return ejbqlNode;
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word)
+   {
+      return indexOf(ql, word, 0);
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * starting with startInd position or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word, int startInd)
+   {
+      int i = ql.indexOf(word, startInd);
+      if(i < 0)
+      {
+         return -1;
+      }
+
+      int qlLength = ql.length();
+      int wordLength = word.length();
+      while(i >= 0)
+      {
+         int endInd = i + wordLength;
+         if((i == 0 || Character.isWhitespace(ql.charAt(i - 1))) &&
+            (endInd == qlLength || endInd < qlLength && Character.isWhitespace(ql.charAt(endInd))))
+         {
+            break;
+         }
+
+         i = ql.indexOf(word, i + 1);
+      }
+      return i;
+   }
+
+   private static final int indexOfOrderBy(String ql)
+   {
+      int orderInd = indexOf(ql, "order", 0);
+      int byInd = -1;
+      while(orderInd > 0)
+      {
+         if(byInd < orderInd)
+         {
+            byInd = indexOf(ql, "by", orderInd + 5);
+         }
+
+         if(byInd > 0)
+         {
+            int i = byInd - 1;
+            while(i >= orderInd + 5 && Character.isWhitespace(ql.charAt(i--)));
+            if(i == orderInd + 4)
+            {
+               break;
+            }
+            else
+            {
+               orderInd = indexOf(ql, "order", orderInd + 5);
+            }
+         }
+         else
+         {
+            orderInd = -1;
+         }
+      }
+      return orderInd;
+   }
+
+   private final void clear(char[] c, int beginIndex, int endIndex) {
+      for(int i=beginIndex; i < endIndex; i++) {
+         if(c[i]!='\r' && c[i]!='\n' && c[i]!='\t') {
+            c[i] = ' ';
+         }
+      }
+   }
+
+   private final void initPathNode(ASTPath pathNode, String path, int type) {
+      pathNode.pathList = idManager.getPathList(path);
+      pathNode.fieldList = idManager.getFieldList(path);
+      pathNode.type = type;
+   }
+
+   private final void initParameterNode(
+         ASTParameter parameterNode,
+         String number,
+         int type) {
+
+      parameterNode.number = Integer.parseInt(number);
+      parameterNode.type = type;
+   }
+}
+
+PARSER_END(JBossQLParser)
+
+////////////////////// New or changed elements /////////////////////////////
+
+ASTEJBQL EJBQL()        :
+{/*@bgen(jjtree) EJBQL */
+  ASTEJBQL jjtn000 = new ASTEJBQL(JJTEJBQL);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EJBQL */
+   try {
+/*@egen*/
+   SelectClause() FromKeyword() [WhereClause()] [OrderByClause()] [LimitClause()] <EOF>/*@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*/
+}
+
+ASTOrderBy OrderByClause()          :
+{/*@bgen(jjtree) OrderBy */
+  ASTOrderBy jjtn000 = new ASTOrderBy(JJTORDERBY);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) OrderBy */
+   try {
+/*@egen*/
+   <ORDER> <BY> OrderByPathExpression() ( <COMMA> OrderByPathExpression() ) */*@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 OrderByPathExpression()              :
+{/*@bgen(jjtree) OrderByPath */
+  ASTOrderByPath jjtn000 = new ASTOrderByPath(JJTORDERBYPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) OrderByPath */
+   try {
+/*@egen*/
+   ( NumericValuedPath() | StringValuedPath() | DatetimeValuedPath() | ValueClassExpression())
+      [<ASC> | <DESC> { jjtn000.ascending=false; } ]/*@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 LimitClause()              :
+{/*@bgen(jjtree) LimitOffset */
+  ASTLimitOffset jjtn000 = new ASTLimitOffset(JJTLIMITOFFSET);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) LimitOffset */
+     try {
+/*@egen*/
+     <OFFSET> ArithmeticValue() { jjtn000.hasOffset = true; } [<LIMIT> ArithmeticValue() { jjtn000.hasLimit = true; }]
+   | <LIMIT> ArithmeticValue()/*@bgen(jjtree)*/
+                               {
+                                 jjtree.closeNodeScope(jjtn000, true);
+                                 jjtc000 = false;
+                               }
+/*@egen*/ { jjtn000.hasLimit = true; }/*@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 FromKeyword()       :
+{/*@bgen(jjtree) From */
+  ASTFrom jjtn000 = new ASTFrom(JJTFROM);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) From */
+   try {
+/*@egen*/
+   <FROM>/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+ASTFrom ParseFromClause()       :
+{ ASTFrom node; }
+{
+   node = FromClause() <EOF>
+   { return node; }
+}
+
+ASTFrom FromClause()       :
+{/*@bgen(jjtree) From */
+  ASTFrom jjtn000 = new ASTFrom(JJTFROM);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) From */
+   try {
+/*@egen*/
+   (
+      <FROM> IdentificationVariableDeclaration()
+         ( <COMMA> IdentificationVariableDeclaration() )*
+   )/*@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 IdentificationVariableDeclaration()       :
+{}
+{
+   (CollectionMemberDeclaration() | RangeVariableDeclaration())
+}
+
+void CollectionMemberDeclaration() :
+{/*@bgen(jjtree) CollectionMemberDeclaration */
+   ASTCollectionMemberDeclaration jjtn000 = new ASTCollectionMemberDeclaration(JJTCOLLECTIONMEMBERDECLARATION);
+   boolean jjtc000 = true;
+   jjtree.openNodeScope(jjtn000);
+/*@egen*/
+   Token path;
+   Token id;
+}
+{/*@bgen(jjtree) CollectionMemberDeclaration */
+   try {
+/*@egen*/
+   ( <IN> <LPAREN> path=CollectionValuedPath() <RPAREN>
+      [<AS>] id=Identifier() )/*@bgen(jjtree)*/
+      {
+        jjtree.closeNodeScope(jjtn000, true);
+        jjtc000 = false;
+      }
+/*@egen*/
+      { idManager.declareCollectionMember(id.image, path.image); }/*@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 RangeVariableDeclaration() :
+{/*@bgen(jjtree) RangeVariableDeclaration */
+   ASTRangeVariableDeclaration jjtn000 = new ASTRangeVariableDeclaration(JJTRANGEVARIABLEDECLARATION);
+   boolean jjtc000 = true;
+   jjtree.openNodeScope(jjtn000);
+/*@egen*/
+   Token schema;
+   Token id;
+}
+{/*@bgen(jjtree) RangeVariableDeclaration */
+   try {
+/*@egen*/
+   ( schema=AbstractSchema() [<AS>] id=Identifier() )/*@bgen(jjtree)*/
+      {
+        jjtree.closeNodeScope(jjtn000, true);
+        jjtc000 = false;
+      }
+/*@egen*/
+      { idManager.declareRangeVariable(id.image, schema.image); }/*@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*/
+}
+
+ASTSelect SelectClause()         :
+{/*@bgen(jjtree) Select */
+  ASTSelect jjtn000 = new ASTSelect(JJTSELECT);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Select */
+   try {
+/*@egen*/
+   (
+      <SELECT> [<DISTINCT> { jjtn000.distinct=true; }]
+      (
+         <OBJECT> <LPAREN> IdentificationVariable() <RPAREN> |
+         SingleValuedPath() |
+         FunctionsAllowedInSelect()
+      )
+   )/*@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*/
+}
+
+ASTWhere WhereClause()        :
+{/*@bgen(jjtree) Where */
+  ASTWhere jjtn000 = new ASTWhere(JJTWHERE);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Where */
+   try {
+/*@egen*/
+   <WHERE> WhereExpression()/*@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*/
+}
+
+//
+// ASTWhereExpression and ASTWhereConditionalTerm mimic
+// ConditionalExpression and ConditionalTerm.
+// They are added to support joins per WhereConditionalTerm.
+//
+void WhereExpression()       :
+{}
+{/*@bgen(jjtree) #Or(> 1) */
+   {
+     ASTOr jjtn001 = new ASTOr(JJTOR);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      WhereConditionalTerm() ( <OR> WhereConditionalTerm() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+ASTWhereConditionalTerm WhereConditionalTerm()                       :
+{/*@bgen(jjtree) WhereConditionalTerm */
+  ASTWhereConditionalTerm jjtn000 = new ASTWhereConditionalTerm(JJTWHERECONDITIONALTERM);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) WhereConditionalTerm */
+   try {
+/*@egen*//*@bgen(jjtree) #And(> 1) */
+   {
+     ASTAnd jjtn001 = new ASTAnd(JJTAND);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*//*@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 ConditionalExpression()       :
+{}
+{/*@bgen(jjtree) #Or(> 1) */
+   {
+     ASTOr jjtn001 = new ASTOr(JJTOR);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ConditionalTerm() ( <OR> ConditionalTerm() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ConditionalTerm()       :
+{}
+{/*@bgen(jjtree) #And(> 1) */
+   {
+     ASTAnd jjtn001 = new ASTAnd(JJTAND);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ConditionalFactor()       :
+{ boolean not = false; }
+{/*@bgen(jjtree) #Not( not) */
+   {
+     ASTNot jjtn001 = new ASTNot(JJTNOT);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      [<NOT>{ not=true; }] ConditionalTest()
+   )/*@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,  not);
+     }
+   }
+/*@egen*/
+}
+
+void ConditionalTest()       :
+{}
+{
+   ConditionalPrimary()
+}
+
+void ConditionalPrimary()       :
+{}
+{
+   LOOKAHEAD(<LPAREN> ConditionalExpression() <RPAREN>)/*@bgen(jjtree) ConditionalParenthetical */
+      {
+        ASTConditionalParenthetical jjtn001 = new ASTConditionalParenthetical(JJTCONDITIONALPARENTHETICAL);
+        boolean jjtc001 = true;
+        jjtree.openNodeScope(jjtn001);
+      }
+      try {
+/*@egen*/
+      (<LPAREN> ConditionalExpression() <RPAREN>)/*@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, true);
+        }
+      }
+/*@egen*/
+|
+   SimpleCondExpression()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+
+void FunctionsAllowedInSelect()       :
+{}
+{
+   FunctionsReturningNumerics() |
+   FunctionsReturningStrings()
+}
+
+void SimpleCondExpression()       :
+{}
+{
+   EmptyCollectionComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IS })
+      NullComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==MEMBER || getToken(3).kind==MEMBER })
+      CollectionMemberExpression()
+|
+   LOOKAHEAD(StringValue() [<NOT>] <LIKE>)
+      LikeExpression()
+|
+   LOOKAHEAD((StringValue() | ArithmeticValue() | DatetimeValue()) [<NOT>] <IN>)
+      InExpression()
+|
+   ComparisonExpression()
+}
+
+void BetweenExpression()          :
+{/*@bgen(jjtree) Between */
+  ASTBetween jjtn000 = new ASTBetween(JJTBETWEEN);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Between */
+   try {
+/*@egen*/
+   (ArithmeticExpression() [<NOT> { jjtn000.not=true; } ] <BETWEEN>
+      ArithmeticExpression() <AND> ArithmeticExpression())
+|
+   (DatetimeValue() [<NOT> { jjtn000.not=true; } ] <BETWEEN>
+      DatetimeValue() <AND> DatetimeValue())
+|
+   (StringValue() [<NOT> { jjtn000.not=true; } ] <BETWEEN>
+      StringValue() <AND> StringValue())/*@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 InExpression()     :
+{/*@bgen(jjtree) In */
+  ASTIn jjtn000 = new ASTIn(JJTIN);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) In */
+   try {
+/*@egen*/
+   (StringExpression() [<NOT> { jjtn000.not=true; } ] <IN>
+      <LPAREN> StringExpression() ( <COMMA> StringExpression() )* <RPAREN>)
+|
+   (ArithmeticPrimary() [<NOT> { jjtn000.not=true; } ] <IN>
+      <LPAREN>  ArithmeticPrimary() ( <COMMA> ArithmeticPrimary() )* <RPAREN>)
+|
+   (DatetimeValue() [<NOT> { jjtn000.not=true; } ] <IN>
+      <LPAREN> DatetimeValue() ( <COMMA> DatetimeValue() )* <RPAREN>)/*@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 LikeExpression()       :
+{/*@bgen(jjtree) Like */
+  ASTLike jjtn000 = new ASTLike(JJTLIKE);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Like */
+   try {
+/*@egen*/
+   StringValue() [<NOT> { jjtn000.not=true; } ] <LIKE>
+      StringExpression() [<ESCAPE> (StringLiteral() | NumericValuedParameter())]/*@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 NullComparisonExpression()                 :
+{/*@bgen(jjtree) NullComparison */
+  ASTNullComparison jjtn000 = new ASTNullComparison(JJTNULLCOMPARISON);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) NullComparison */
+   try {
+/*@egen*/
+   (
+      SingleValuedPath() |
+      NumericValuedParameter() |
+      EntityValuedParameter() |
+      StringValuedParameter() |
+      DatetimeValuedParameter() |
+      BooleanValuedParameter()
+   )
+   <IS> [<NOT> { jjtn000.not=true; } ] <NULL>/*@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 EmptyCollectionComparisonExpression()          :
+{/*@bgen(jjtree) IsEmpty */
+  ASTIsEmpty jjtn000 = new ASTIsEmpty(JJTISEMPTY);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) IsEmpty */
+   try {
+/*@egen*/
+   CollectionValuedPath() <IS> [<NOT> { jjtn000.not=true; } ] <EMPTY>/*@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 CollectionMemberExpression()           :
+{/*@bgen(jjtree) MemberOf */
+  ASTMemberOf jjtn000 = new ASTMemberOf(JJTMEMBEROF);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberOf */
+   try {
+/*@egen*/
+   (EntityValuedPath() |
+         IdentificationVariable() |
+         EntityValuedParameter())
+      [<NOT> { jjtn000.not=true; } ] <MEMBER> [<OF>] CollectionValuedPath()/*@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 ComparisonExpression()       :
+{}
+{
+////////////////////// New or changed elements /////////////////////////////
+   LOOKAHEAD(StringValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )/*@bgen(jjtree) StringComparison */
+   {
+     ASTStringComparison jjtn001 = new ASTStringComparison(JJTSTRINGCOMPARISON);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      StringValue()
+      (
+         <EQ> { jjtn001.opp="="; } |
+         <GT> { jjtn001.opp=">"; } |
+         <GE> { jjtn001.opp=">="; } |
+         <LT> { jjtn001.opp="<"; } |
+         <LE> { jjtn001.opp="<="; } |
+         <NE> { jjtn001.opp="<>"; }
+      )
+      StringExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+////////////////////////////////////////////////////////////////////////////
+|
+   LOOKAHEAD(BooleanValue() ( <EQ> | <NE> ) )/*@bgen(jjtree) BooleanComparison */
+   {
+     ASTBooleanComparison jjtn002 = new ASTBooleanComparison(JJTBOOLEANCOMPARISON);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      BooleanValue()
+      [
+         (
+            <EQ> { jjtn002.opp="="; } |
+            <NE> { jjtn002.opp="<>"; }
+         ) BooleanExpression()
+      ]
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+////////////////////// New or changed elements /////////////////////////////
+   LOOKAHEAD(DatetimeValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )/*@bgen(jjtree) DatetimeComparison */
+   {
+     ASTDatetimeComparison jjtn003 = new ASTDatetimeComparison(JJTDATETIMECOMPARISON);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      DatetimeValue()
+      (
+         <EQ> { jjtn003.opp="="; } |
+         <GT> { jjtn003.opp=">"; } |
+         <GE> { jjtn003.opp=">="; } |
+         <LT> { jjtn003.opp="<"; } |
+         <LE> { jjtn003.opp="<="; } |
+         <NE> { jjtn003.opp="<>"; }
+      )
+      DatetimeExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+   LOOKAHEAD(ValueClassValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )/*@bgen(jjtree) ValueClassComparison */
+   {
+     ASTValueClassComparison jjtn004 = new ASTValueClassComparison(JJTVALUECLASSCOMPARISON);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      ValueClassValue()
+      (
+         <EQ> { jjtn004.opp="="; } |
+         <GT> { jjtn004.opp=">"; } |
+         <GE> { jjtn004.opp=">="; } |
+         <LT> { jjtn004.opp="<"; } |
+         <LE> { jjtn004.opp="<="; } |
+         <NE> { jjtn004.opp="<>"; }
+      )
+      ValueClassExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+////////////////////////////////////////////////////////////////////////////
+|
+   LOOKAHEAD(EntityBeanValue() ( <EQ> | <NE> ) )/*@bgen(jjtree) EntityComparison */
+   {
+     ASTEntityComparison jjtn005 = new ASTEntityComparison(JJTENTITYCOMPARISON);
+     boolean jjtc005 = true;
+     jjtree.openNodeScope(jjtn005);
+   }
+   try {
+/*@egen*/
+   (
+      EntityBeanValue()
+      (
+         <EQ> { jjtn005.opp="="; } |
+         <NE> { jjtn005.opp="<>"; }
+      )
+      EntityBeanExpression()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+   LOOKAHEAD(ArithmeticValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )/*@bgen(jjtree) ArithmeticComparison */
+   {
+     ASTArithmeticComparison jjtn006 = new ASTArithmeticComparison(JJTARITHMETICCOMPARISON);
+     boolean jjtc006 = true;
+     jjtree.openNodeScope(jjtn006);
+   }
+   try {
+/*@egen*/
+   (
+      ArithmeticValue()
+      (
+         <EQ> { jjtn006.opp="="; } |
+         <GT> { jjtn006.opp=">"; } |
+         <GE> { jjtn006.opp=">="; } |
+         <LT> { jjtn006.opp="<"; } |
+         <LE> { jjtn006.opp="<="; } |
+         <NE> { jjtn006.opp="<>"; }
+      )
+      SingleValueDesignator()
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+   BetweenExpression()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+void ArithmeticValue()       :
+{}
+{
+   NumericValuedPath() | FunctionsReturningNumerics() |
+   NumericLiteral() | NumericValuedParameter()
+}
+////////////////////////////////////////////////////////////////////////////
+
+void SingleValueDesignator()       :
+{}
+{
+   ScalarExpression()
+}
+
+void ScalarExpression()       :
+{}
+{
+   ArithmeticExpression()
+}
+
+void ArithmeticExpression()       :
+{}
+{/*@bgen(jjtree) #PlusMinus(> 1) */
+   {
+     ASTPlusMinus jjtn001 = new ASTPlusMinus(JJTPLUSMINUS);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ArithmeticTerm()
+      (
+         (
+            <PLUS> { jjtn001.addOpp("+"); } |
+            <MINUS> { jjtn001.addOpp("-"); }
+         ) ArithmeticTerm()
+      )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ArithmeticTerm()       :
+{}
+{/*@bgen(jjtree) #MultDiv(> 1) */
+   {
+     ASTMultDiv jjtn001 = new ASTMultDiv(JJTMULTDIV);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      ArithmeticFactor()
+      (
+         (
+            <MULT> { jjtn001.addOpp("*"); } |
+            <DIV> { jjtn001.addOpp("/"); }
+         ) ArithmeticFactor()
+      )*
+   )/*@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, jjtree.nodeArity() > 1);
+     }
+   }
+/*@egen*/
+}
+
+void ArithmeticFactor()       :
+{ boolean negation = false; }
+{/*@bgen(jjtree) #Negation( negation) */
+   {
+     ASTNegation jjtn001 = new ASTNegation(JJTNEGATION);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      [<PLUS>|<MINUS>{negation=true;}] ArithmeticPrimary()
+   )/*@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,  negation);
+     }
+   }
+/*@egen*/
+}
+
+void ArithmeticPrimary()       :
+{}
+{
+   NumericValuedPath() |
+   NumericLiteral() |/*@bgen(jjtree) ArithmeticParenthetical */
+   {
+     ASTArithmeticParenthetical jjtn001 = new ASTArithmeticParenthetical(JJTARITHMETICPARENTHETICAL);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (<LPAREN> ArithmeticExpression() <RPAREN>)/*@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, true);
+     }
+   }
+/*@egen*/ |
+   NumericValuedParameter() |
+   FunctionsReturningNumerics()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+void StringValue()       :
+{}
+{
+   StringValuedPath() | FunctionsReturningStrings() |
+   StringLiteral()| StringValuedParameter()
+}
+////////////////////////////////////////////////////////////////////////////
+
+void StringExpression()       :
+{}
+{
+   StringPrimary() | StringValuedParameter()
+}
+
+void StringPrimary()       :
+{}
+{
+   StringValuedPath() |
+   StringLiteral() |/*@bgen(jjtree) StringParenthetical */
+   {
+     ASTStringParenthetical jjtn001 = new ASTStringParenthetical(JJTSTRINGPARENTHETICAL);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (<LPAREN> StringExpression() <RPAREN>)/*@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, true);
+     }
+   }
+/*@egen*/ |
+   FunctionsReturningStrings()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+
+void DatetimeValue()       :
+{}
+{
+   DatetimeValuedPath() | DatetimeValuedParameter()
+}
+
+void DatetimeExpression()       :
+{}
+{
+   DatetimeValue()
+}
+
+void BooleanValue()       :
+{}
+{
+   BooleanValuedPath() | BooleanValuedParameter() | BooleanLiteral()
+}
+
+void BooleanExpression()       :
+{}
+{
+   BooleanValue()
+}
+
+void ValueClassValue()       :
+{}
+{
+   ValueClassValuedPath() | ValueClassValuedParameter()
+}
+
+void ValueClassExpression()       :
+{}
+{
+   ValueClassValue()
+}
+
+
+void EntityBeanValue()       :
+{}
+{
+   EntityValuedPath() | IdentificationVariable() | EntityValuedParameter()
+}
+
+void EntityBeanExpression()       :
+{}
+{
+   EntityBeanValue()
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void FunctionsReturningStrings()       :
+{}
+{/*@bgen(jjtree) Concat */
+   {
+     ASTConcat jjtn001 = new ASTConcat(JJTCONCAT);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      <CONCAT> <LPAREN> StringExpression() <COMMA> StringExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Substring */
+   {
+     ASTSubstring jjtn002 = new ASTSubstring(JJTSUBSTRING);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      <SUBSTRING> <LPAREN>
+         StringExpression() <COMMA>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+////////////////////// New or changed elements /////////////////////////////
+|/*@bgen(jjtree) UCase */
+   {
+     ASTUCase jjtn003 = new ASTUCase(JJTUCASE);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      <UCASE> <LPAREN> StringExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) LCase */
+   {
+     ASTLCase jjtn004 = new ASTLCase(JJTLCASE);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      <LCASE> <LPAREN> StringExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+////////////////////////////////////////////////////////////////////////////
+}
+
+void FunctionsReturningNumerics()       :
+{}
+{/*@bgen(jjtree) Length */
+   {
+     ASTLength jjtn001 = new ASTLength(JJTLENGTH);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      <LENGTH> <LPAREN> StringExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Locate */
+   {
+     ASTLocate jjtn002 = new ASTLocate(JJTLOCATE);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      <LOCATE> <LPAREN>
+            StringExpression() <COMMA> StringExpression()
+            [ <COMMA> ArithmeticExpression()] <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Abs */
+   {
+     ASTAbs jjtn003 = new ASTAbs(JJTABS);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      <ABS> <LPAREN> ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Sqrt */
+   {
+     ASTSqrt jjtn004 = new ASTSqrt(JJTSQRT);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      <SQRT> <LPAREN> ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Mod */
+   {
+     ASTMod jjtn005 = new ASTMod(JJTMOD);
+     boolean jjtc005 = true;
+     jjtree.openNodeScope(jjtn005);
+   }
+   try {
+/*@egen*/
+   (
+      <MOD> <LPAREN>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|
+   AggregateFunctions()
+////////////////////////////////////////////////////////////////////////////
+}
+
+void AggregateFunctions()      :
+{}
+{/*@bgen(jjtree) Avg */
+   {
+     ASTAvg jjtn001 = new ASTAvg(JJTAVG);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      <AVG> <LPAREN> [<DISTINCT> {jjtn001.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Max */
+   {
+     ASTMax jjtn002 = new ASTMax(JJTMAX);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      <MAX> <LPAREN> [<DISTINCT> {jjtn002.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Min */
+   {
+     ASTMin jjtn003 = new ASTMin(JJTMIN);
+     boolean jjtc003 = true;
+     jjtree.openNodeScope(jjtn003);
+   }
+   try {
+/*@egen*/
+   (
+      <MIN> <LPAREN> [<DISTINCT> {jjtn003.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Sum */
+   {
+     ASTSum jjtn004 = new ASTSum(JJTSUM);
+     boolean jjtc004 = true;
+     jjtree.openNodeScope(jjtn004);
+   }
+   try {
+/*@egen*/
+   (
+      <SUM> <LPAREN> [<DISTINCT> {jjtn004.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) Count */
+   {
+     ASTCount jjtn005 = new ASTCount(JJTCOUNT);
+     boolean jjtc005 = true;
+     jjtree.openNodeScope(jjtn005);
+   }
+   try {
+/*@egen*/
+   (
+      <COUNT> <LPAREN> [<DISTINCT> {jjtn005.distinct="DISTINCT";}]
+      (
+         SingleValuedPath() | EntityBeanValue()
+      )
+      <RPAREN>
+   )/*@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, true);
+     }
+   }
+/*@egen*/
+}
+
+Token CollectionValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<COLLECTION_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   {
+      initPathNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE);
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+Token IdentificationVariable()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<IDENTIFICATION_VARIABLE>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   {
+      t.image = t.image.toLowerCase();
+      initPathNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE);
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+Token AbstractSchema()                 :
+{/*@bgen(jjtree) AbstractSchema */
+  ASTAbstractSchema jjtn000 = new ASTAbstractSchema(JJTABSTRACTSCHEMA);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) AbstractSchema */
+   try {
+/*@egen*/
+   t=<ABSTRACT_SCHEMA>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   {
+      jjtn000.abstractSchemaName = t.image;
+      jjtn000.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }
+   |
+   t=<ORDER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   {
+      jjtn000.abstractSchemaName = t.image;
+      jjtn000.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+Token Identifier()             :
+{/*@bgen(jjtree) Identifier */
+  ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Identifier */
+   try {
+/*@egen*/
+   t=<IDENTIFIER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   {
+      t.image = t.image.toLowerCase();
+      jjtn000.identifier = t.image;
+      return t;
+   }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void SingleValuedPath()       :
+{}
+{
+   NumericValuedPath()
+|  StringValuedPath()
+|  DatetimeValuedPath()
+|  BooleanValuedPath()
+|  EntityValuedPath()
+|  ValueClassValuedPath()
+}
+
+void NumericValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<NUMERIC_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initPathNode(jjtn000, t.image, EJBQLTypes.NUMERIC_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void StringValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<STRING_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initPathNode(jjtn000, t.image, EJBQLTypes.STRING_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void DatetimeValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<DATETIME_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initPathNode(jjtn000, t.image, EJBQLTypes.DATETIME_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void BooleanValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<BOOLEAN_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initPathNode(jjtn000, t.image, EJBQLTypes.BOOLEAN_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void EntityValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<ENTITY_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initPathNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void ValueClassValuedPath()       :
+{/*@bgen(jjtree) Path */
+  ASTPath jjtn000 = new ASTPath(JJTPATH);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Path */
+   try {
+/*@egen*/
+   t=<VALUE_CLASS_VALUED_PATH>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initPathNode(jjtn000, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void NumericValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<NUMERIC_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.NUMERIC_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void StringValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<STRING_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.STRING_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void DatetimeValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<DATETIME_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.DATETIME_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void BooleanValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<BOOLEAN_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.BOOLEAN_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void EntityValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<ENTITY_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.ENTITY_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void ValueClassValuedParameter()            :
+{/*@bgen(jjtree) Parameter */
+  ASTParameter jjtn000 = new ASTParameter(JJTPARAMETER);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) Parameter */
+   try {
+/*@egen*/
+   t=<VALUE_CLASS_VALUED_PARAMETER>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { initParameterNode(jjtn000, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void NumericLiteral()       :
+{ Token t; }
+{/*@bgen(jjtree) ExactNumericLiteral */
+   {
+     ASTExactNumericLiteral jjtn001 = new ASTExactNumericLiteral(JJTEXACTNUMERICLITERAL);
+     boolean jjtc001 = true;
+     jjtree.openNodeScope(jjtn001);
+   }
+   try {
+/*@egen*/
+   (
+      t=<INTEGER_LITERAL>/*@bgen(jjtree)*/
+                          {
+                            jjtree.closeNodeScope(jjtn001, true);
+                            jjtc001 = false;
+                          }
+/*@egen*/ { jjtn001.setValue(t.image); }
+   )/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc001) {
+       jjtree.closeNodeScope(jjtn001, true);
+     }
+   }
+/*@egen*/
+|/*@bgen(jjtree) ApproximateNumericLiteral */
+   {
+     ASTApproximateNumericLiteral jjtn002 = new ASTApproximateNumericLiteral(JJTAPPROXIMATENUMERICLITERAL);
+     boolean jjtc002 = true;
+     jjtree.openNodeScope(jjtn002);
+   }
+   try {
+/*@egen*/
+   (
+      t=<FLOATING_POINT_LITERAL>/*@bgen(jjtree)*/
+                                 {
+                                   jjtree.closeNodeScope(jjtn002, true);
+                                   jjtc002 = false;
+                                 }
+/*@egen*/ { jjtn002.setValue(t.image); }
+   )/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc002) {
+       jjtree.closeNodeScope(jjtn002, true);
+     }
+   }
+/*@egen*/
+}
+
+void StringLiteral()                :
+{/*@bgen(jjtree) StringLiteral */
+  ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) StringLiteral */
+   try {
+/*@egen*/
+   t=<STRING_LITERAL>/*@bgen(jjtree)*/
+   {
+     jjtree.closeNodeScope(jjtn000, true);
+     jjtc000 = false;
+   }
+/*@egen*/
+   { jjtn000.value=t.image; }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+void BooleanLiteral()                 :
+{/*@bgen(jjtree) BooleanLiteral */
+  ASTBooleanLiteral jjtn000 = new ASTBooleanLiteral(JJTBOOLEANLITERAL);
+  boolean jjtc000 = true;
+  jjtree.openNodeScope(jjtn000);
+/*@egen*/ Token t; }
+{/*@bgen(jjtree) BooleanLiteral */
+   try {
+/*@egen*/
+   <TRUE>/*@bgen(jjtree)*/
+          {
+            jjtree.closeNodeScope(jjtn000, true);
+            jjtc000 = false;
+          }
+/*@egen*/ { jjtn000.value=true; } | <FALSE>/*@bgen(jjtree)*/
+                                            {
+                                              jjtree.closeNodeScope(jjtn000, true);
+                                              jjtc000 = false;
+                                            }
+/*@egen*/ { jjtn000.value=false; }/*@bgen(jjtree)*/
+   } finally {
+     if (jjtc000) {
+       jjtree.closeNodeScope(jjtn000, true);
+     }
+   }
+/*@egen*/
+}
+
+/////////////////////////
+//  Tokens
+/////////////////////////
+
+TOKEN_MGR_DECLS :
+{
+   public Catalog catalog;
+   public Class[] argumentTypes;
+   public IdentifierManager idManager;
+
+   // used for navigation building
+   private List pathList;
+   private List fieldList;
+   private String path;
+
+   private void resetPath() {
+      path = "";
+      pathList = new ArrayList();
+      fieldList = new ArrayList();
+   }
+
+   private void throwUnknownPath(
+         String reason,
+         String fieldName) {
+
+      throw new UnknownPathException(
+            reason,
+            path,
+            fieldName,
+            input_stream.getEndLine(),
+            input_stream.getEndColumn());
+   }
+
+   private void addPath(String nav) {
+      String fieldName = nav.substring(0, nav.length()-1);
+      if(fieldList.size() > 0) {
+         FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+         if(field == null) {
+            throwUnknownPath("Unknown cmr field in path", fieldName);
+         }
+         if(!(field instanceof CMRFieldBridge)) {
+            throwUnknownPath("In path field is not a cmr field", fieldName);
+         }
+
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(!cmrField.isSingleValued()) {
+            throwUnknownPath("In path cmr field is collection valued",
+                  fieldName);
+         }
+         fieldList.add(cmrField);
+      } else {
+         EntityBridge entityBridge = idManager.getEntity(fieldName);
+         if(entityBridge == null) {
+            throwUnknownPath("Unknown initial identifier", fieldName);
+         }
+         fieldList.add(entityBridge);
+      }
+      pathList.add(path + fieldName);
+      path += nav;
+   }
+
+   private EntityBridge getCurrentSchema() {
+      Object lastElement = fieldList.get(fieldList.size()-1);
+      if(lastElement instanceof EntityBridge) {
+         return (EntityBridge)lastElement;
+      } else if(lastElement instanceof CMRFieldBridge) {
+         return ((CMRFieldBridge)lastElement).getRelatedEntity();
+      }
+      // should never happen
+      throw new IllegalStateException("Unknown path element type: " +
+            lastElement);
+   }
+}
+
+<DEFAULT> SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* RESERVED WORDS */
+{
+   < ABS: "ABS" >
+|  < AND: "AND" >
+|  < AS: "AS" >
+|  < BETWEEN: "BETWEEN" >
+|  < CONCAT: "CONCAT" >
+|  < COUNT: "COUNT" >
+|  < MAX: "MAX" >
+|  < MIN: "MIN" >
+|  < AVG: "AVG" >
+|  < SUM: "SUM" >
+|  < DISTINCT: "DISTINCT" >
+|  < EMPTY: "EMPTY" >
+|  < ESCAPE: "ESCAPE" >
+|  < FROM: "FROM" >
+|  < IN: "IN" >
+|  < IS: "IS" >
+|  < LENGTH: "LENGTH" >
+|  < LIKE: "LIKE" >
+|  < LOCATE: "LOCATE" >
+|  < NOT: "NOT" >
+|  < NULL: "NULL" >
+|  < OBJECT: "OBJECT" >
+|  < OF: "OF " >
+|  < OR: "OR" >
+|  < SELECT: "SELECT" >
+|  < SUBSTRING: "SUBSTRING" >
+|  < SQRT: "SQRT" >
+|  < UNKNOWN: "UNKNOWN" >
+|  < WHERE: "WHERE" >
+|  < MEMBER: "MEMBER" >
+|  < ASC: "ASC" >
+|  < DESC: "DESC" >
+|  < LCASE: "LCASE" >
+|  < LIMIT: "LIMIT" >
+|  < OFFSET: "OFFSET" >
+|  < ORDER: "ORDER" >
+|  < BY: "BY" >
+|  < UCASE: "UCASE" >
+|  < MOD: "MOD" >
+}
+
+<DEFAULT> TOKEN : /* SEPARATORS */
+{
+  < LPAREN: "(" >
+| < RPAREN: ")" >
+| < COMMA: "," >
+| < DOT: "." >
+}
+
+<DEFAULT> TOKEN : /* OPERATORS */
+{
+  < GT: ">" >
+| < LT: "<" >
+| < EQ: "=" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "<>" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < MULT: "*" >
+| < DIV: "/" >
+}
+
+<DEFAULT> TOKEN : /* String Literal */
+{
+   < STRING_LITERAL: "'" (~["'"])* ( "''" (~["'"])* )* "'" >
+}
+
+<DEFAULT> TOKEN : /* Numeric Literal */
+{
+   < INTEGER_LITERAL:
+      <DECIMAL_LITERAL> (["l","L"])?
+      | <HEX_LITERAL> (["l","L"])?
+      | <OCTAL_LITERAL> (["l","L"])?
+   >
+|
+   < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+   < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+   < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+   < FLOATING_POINT_LITERAL:
+      (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+   >
+|
+   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* Boolean Literal */
+{
+   < FALSE: "FALSE" >
+|  < TRUE: "TRUE" >
+}
+
+<DEFAULT> TOKEN : /* IDENTIFIERS */
+{
+   < IDENTIFIER: <NAME> >
+   {
+      if(catalog.getEntityByAbstractSchemaName(matchedToken.image) != null) {
+         matchedToken.kind = ABSTRACT_SCHEMA;
+      } else if(idManager.getEntity(matchedToken.image.toLowerCase()) != null) {
+         matchedToken.kind = IDENTIFICATION_VARIABLE;
+         matchedToken.image = matchedToken.image.toLowerCase();
+
+         List pathList = new ArrayList();
+         pathList.add(matchedToken.image);
+         List fieldList = new ArrayList();
+         fieldList.add(idManager.getEntity(matchedToken.image));
+         idManager.registerPath(matchedToken.image, pathList, fieldList);
+      }
+   }
+|
+   < ABSTRACT_SCHEMA: [] >
+|
+   < IDENTIFICATION_VARIABLE: [] >
+|
+   < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+   < #LETTER:
+      [
+       "$",
+       "A"-"Z",
+       "_",
+       "a"-"z",
+       "\u00c0"-"\u00d6",
+       "\u00d8"-"\u00f6",
+       "\u00f8"-"\u00ff",
+       "\u0100"-"\u1fff",
+       "\u3040"-"\u318f",
+       "\u3300"-"\u337f",
+       "\u3400"-"\u3d2d",
+       "\u4e00"-"\u9fff",
+       "\uf900"-"\ufaff"
+      ]
+   >
+|
+   < #DIGIT:
+      [
+       "0"-"9",
+       "\u0660"-"\u0669",
+       "\u06f0"-"\u06f9",
+       "\u0966"-"\u096f",
+       "\u09e6"-"\u09ef",
+       "\u0a66"-"\u0a6f",
+       "\u0ae6"-"\u0aef",
+       "\u0b66"-"\u0b6f",
+       "\u0be7"-"\u0bef",
+       "\u0c66"-"\u0c6f",
+       "\u0ce6"-"\u0cef",
+       "\u0d66"-"\u0d6f",
+       "\u0e50"-"\u0e59",
+       "\u0ed0"-"\u0ed9",
+       "\u1040"-"\u1049"
+      ]
+   >
+}
+
+<DEFAULT> TOKEN : /* PARAMETERS */
+{
+   < UNKNOWN_PARAMETER: "?" <INTEGER_LITERAL> >
+   {
+      int n = EJBQLTypes.UNKNOWN_TYPE;
+      try {
+         n = Integer.parseInt(matchedToken.image.substring(1, lengthOfMatch));
+      } catch(Exception e) { /* Should never come here. */ }
+
+      matchedToken.image = "" + n;
+
+      // zero base the index
+      n--;
+
+      if(n < argumentTypes.length) {
+         switch(EJBQLTypes.getEJBQLType(argumentTypes[n])) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PARAMETER;
+               break;
+         }
+      }
+   }
+|  < NUMERIC_VALUED_PARAMETER: [] >
+|  < STRING_VALUED_PARAMETER: [] >
+|  < DATETIME_VALUED_PARAMETER: [] >
+|  < BOOLEAN_VALUED_PARAMETER: [] >
+|  < ENTITY_VALUED_PARAMETER: [] >
+|  < VALUE_CLASS_VALUED_PARAMETER: [] >
+}
+
+/**
+ * WARNING: Be careful here. If look ahead is to high in the from clause, it
+ * is possible that the identification varible is not registered before it
+ * is used here.
+ */
+<DEFAULT> SPECIAL_TOKEN :  /* Navigation */
+{
+   < <NAME> <DOT> > {
+      resetPath();
+      addPath(matchedToken.image.toLowerCase());
+   } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> SPECIAL_TOKEN :
+{
+   < <NAME> <DOT> > { addPath(matchedToken.image); } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> TOKEN :
+{
+   < PART: <NAME> > {
+      String fieldName = matchedToken.image;
+      matchedToken.image = path + fieldName;
+
+      FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+      if(field == null) {
+         throwUnknownPath("Unknown terminal field", fieldName);
+      }
+      if(field instanceof CMPFieldBridge) {
+         CMPFieldBridge cmpField = (CMPFieldBridge)field;
+         switch(EJBQLTypes.getEJBQLType(cmpField.getFieldType())) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PATH;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PATH;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PATH;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PATH;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PATH;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PATH;
+               break;
+            default:
+               throwUnknownPath("Unknown cmp field type", fieldName);
+         }
+      } else {
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(cmrField.isSingleValued()) {
+            matchedToken.kind = ENTITY_VALUED_PATH;
+         } else {
+            matchedToken.kind = COLLECTION_VALUED_PATH;
+         }
+      }
+      pathList.add(matchedToken.image);
+      fieldList.add(field);
+      idManager.registerPath(matchedToken.image, pathList, fieldList);
+      resetPath();
+   } : DEFAULT
+|  < NUMERIC_VALUED_PATH: [] >
+|  < STRING_VALUED_PATH: [] >
+|  < DATETIME_VALUED_PATH: [] >
+|  < BOOLEAN_VALUED_PATH: [] >
+|  < ENTITY_VALUED_PATH: [] >
+|  < VALUE_CLASS_VALUED_PATH: [] >
+|  < UNKNOWN_PATH: [] >
+|  < COLLECTION_VALUED_PATH: [] >
+}
+
+

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/JBossQLParser.jjt
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/JBossQLParser.jjt	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/JBossQLParser.jjt	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,1331 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+ 
+options {
+   BUILD_NODE_FILES=false;
+   MULTI=true;
+   VISITOR=true;
+
+   JAVA_UNICODE_ESCAPE = true;
+   STATIC = false;
+
+   CHOICE_AMBIGUITY_CHECK = 5;
+   OTHER_AMBIGUITY_CHECK = 5;
+
+   LOOKAHEAD = 1;
+   DEBUG_PARSER = false;
+   DEBUG_LOOKAHEAD = false;
+   DEBUG_TOKEN_MANAGER = false;
+   ERROR_REPORTING = true;
+   UNICODE_INPUT = false;
+   IGNORE_CASE = false;
+   USER_TOKEN_MANAGER = false;
+   USER_CHAR_STREAM = false;
+   BUILD_PARSER = true;
+   BUILD_TOKEN_MANAGER = true;
+   SANITY_CHECK = true;
+   FORCE_LA_CHECK = false;
+}
+
+PARSER_BEGIN(JBossQLParser)
+package org.jboss.ejb.plugins.cmp.ejbql;
+
+import java.io.CharArrayReader;
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.ejb.plugins.cmp.bridge.EntityBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.FieldBridge;
+
+/**
+ * This class parses JBossQL into an abstract syntax tree.
+ *
+ * @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
+ * @author <a href="mailto:alex at jboss.org">Alex Loubyansky</a>
+ * @version $Revision: 44170 $
+ */
+public class JBossQLParser {
+   private Catalog catalog;
+   private Class[] argumentTypes;
+   private IdentifierManager idManager;
+   private boolean selectDistinct;
+   private String selectPath;
+
+   public ASTEJBQL parse(Catalog catalog, Class[] argumentTypes, String ejbql)
+         throws ParseException {
+
+      this.catalog = catalog;
+      token_source.catalog = catalog;
+      this.argumentTypes = argumentTypes;
+      token_source.argumentTypes = argumentTypes;
+      idManager = new IdentifierManager(catalog);
+      token_source.idManager = idManager;
+
+      String lowerCase = ejbql.toLowerCase();
+      int fromBeginIndex = indexOf(lowerCase, "from");
+      if(fromBeginIndex < 0) {
+         throw new ParseException("FROM not found");
+      }
+
+      int fromEndIndex = indexOf(lowerCase, "where");
+      ///////////////////// CHANGED //////////////////////////////
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOfOrderBy(lowerCase);
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOf(lowerCase, "offset");
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOf(lowerCase, "limit");
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = ejbql.length();
+      }
+      ////////////////////////////////////////////////////////////
+
+      // just the from clause
+      char[] from = ejbql.toCharArray();
+      clear(from, 0, fromBeginIndex);
+      clear(from, fromEndIndex, from.length);
+
+      // everything except for the from clause
+      char[] sansFrom = ejbql.toCharArray();
+      clear(sansFrom, fromBeginIndex + 4, fromEndIndex);
+
+      // From clause
+      ReInit(new CharArrayReader(from));
+      ASTFrom fromNode = ParseFromClause();
+
+      // Everything else
+      ReInit(new CharArrayReader(sansFrom));
+      ASTEJBQL ejbqlNode = EJBQL();
+
+      // replace the dummy from clause in the EJBQL
+      // node with the real from node
+      ejbqlNode.jjtAddChild(fromNode, 1);
+
+      return ejbqlNode;
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word)
+   {
+      return indexOf(ql, word, 0);
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * starting with startInd position or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word, int startInd)
+   {
+      int i = ql.indexOf(word, startInd);
+      if(i < 0)
+      {
+         return -1;
+      }
+
+      int qlLength = ql.length();
+      int wordLength = word.length();
+      while(i >= 0)
+      {
+         int endInd = i + wordLength;
+         if((i == 0 || Character.isWhitespace(ql.charAt(i - 1))) &&
+            (endInd == qlLength || endInd < qlLength && Character.isWhitespace(ql.charAt(endInd))))
+         {
+            break;
+         }
+
+         i = ql.indexOf(word, i + 1);
+      }
+      return i;
+   }
+
+   private static final int indexOfOrderBy(String ql)
+   {
+      int orderInd = indexOf(ql, "order", 0);
+      int byInd = -1;
+      while(orderInd > 0)
+      {
+         if(byInd < orderInd)
+         {
+            byInd = indexOf(ql, "by", orderInd + 5);
+         }
+
+         if(byInd > 0)
+         {
+            int i = byInd - 1;
+            while(i >= orderInd + 5 && Character.isWhitespace(ql.charAt(i--)));
+            if(i == orderInd + 4)
+            {
+               break;
+            }
+            else
+            {
+               orderInd = indexOf(ql, "order", orderInd + 5);
+            }
+         }
+         else
+         {
+            orderInd = -1;
+         }
+      }
+      return orderInd;
+   }
+
+   private final void clear(char[] c, int beginIndex, int endIndex) {
+      for(int i=beginIndex; i < endIndex; i++) {
+         if(c[i]!='\r' && c[i]!='\n' && c[i]!='\t') {
+            c[i] = ' ';
+         }
+      }
+   }
+
+   private final void initPathNode(ASTPath pathNode, String path, int type) {
+      pathNode.pathList = idManager.getPathList(path);
+      pathNode.fieldList = idManager.getFieldList(path);
+      pathNode.type = type;
+   }
+
+   private final void initParameterNode(
+         ASTParameter parameterNode,
+         String number,
+         int type) {
+
+      parameterNode.number = Integer.parseInt(number);
+      parameterNode.type = type;
+   }
+}
+
+PARSER_END(JBossQLParser)
+
+////////////////////// New or changed elements /////////////////////////////
+
+ASTEJBQL EJBQL() #EJBQL :
+{}
+{
+   SelectClause() FromKeyword() [WhereClause()] [OrderByClause()] [LimitClause()] <EOF>
+   { return jjtThis; }
+}
+
+ASTOrderBy OrderByClause() #OrderBy :
+{}
+{
+   <ORDER> <BY> OrderByPathExpression() ( <COMMA> OrderByPathExpression() ) *
+   { return jjtThis; }
+}
+
+void OrderByPathExpression() #OrderByPath :
+{}
+{
+   ( NumericValuedPath() | StringValuedPath() | DatetimeValuedPath() | ValueClassExpression())
+      [<ASC> | <DESC> { jjtThis.ascending=false; } ]
+}
+
+void LimitClause() #LimitOffset :
+{}
+{
+     <OFFSET> ArithmeticValue() { jjtThis.hasOffset = true; } [<LIMIT> ArithmeticValue() { jjtThis.hasLimit = true; }]
+   | <LIMIT> ArithmeticValue() { jjtThis.hasLimit = true; }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void FromKeyword() #From :
+{}
+{
+   <FROM>
+}
+
+ASTFrom ParseFromClause() #void :
+{ ASTFrom node; }
+{
+   node = FromClause() <EOF>
+   { return node; }
+}
+
+ASTFrom FromClause() #From :
+{}
+{
+   (
+      <FROM> IdentificationVariableDeclaration()
+         ( <COMMA> IdentificationVariableDeclaration() )*
+   ) { return jjtThis; }
+}
+
+void IdentificationVariableDeclaration() #void :
+{}
+{
+   (CollectionMemberDeclaration() | RangeVariableDeclaration())
+}
+
+void CollectionMemberDeclaration() :
+{
+   Token path;
+   Token id;
+}
+{
+   ( <IN> <LPAREN> path=CollectionValuedPath() <RPAREN>
+      [<AS>] id=Identifier() )
+      { idManager.declareCollectionMember(id.image, path.image); }
+}
+
+void RangeVariableDeclaration() :
+{
+   Token schema;
+   Token id;
+}
+{
+   ( schema=AbstractSchema() [<AS>] id=Identifier() )
+      { idManager.declareRangeVariable(id.image, schema.image); }
+}
+
+ASTSelect SelectClause() #Select :
+{}
+{
+   (
+      <SELECT> [<DISTINCT> { jjtThis.distinct=true; }]
+      (
+         <OBJECT> <LPAREN> IdentificationVariable() <RPAREN> |
+         SingleValuedPath() |
+         FunctionsAllowedInSelect()
+      )
+   ) { return jjtThis; }
+}
+
+ASTWhere WhereClause() #Where :
+{}
+{
+   <WHERE> WhereExpression()
+   { return jjtThis; }
+}
+
+//
+// ASTWhereExpression and ASTWhereConditionalTerm mimic
+// ConditionalExpression and ConditionalTerm.
+// They are added to support joins per WhereConditionalTerm.
+//
+void WhereExpression() #void :
+{}
+{
+   (
+      WhereConditionalTerm() ( <OR> WhereConditionalTerm() )*
+   ) #Or(>1)
+}
+
+ASTWhereConditionalTerm WhereConditionalTerm() #WhereConditionalTerm :
+{}
+{
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   ) #And(>1)
+   {return jjtThis;}
+}
+
+void ConditionalExpression() #void :
+{}
+{
+   (
+      ConditionalTerm() ( <OR> ConditionalTerm() )*
+   ) #Or(>1)
+}
+
+void ConditionalTerm() #void :
+{}
+{
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   ) #And(>1)
+}
+
+void ConditionalFactor() #void :
+{ boolean not = false; }
+{
+   (
+      [<NOT>{ not=true; }] ConditionalTest()
+   ) #Not(not)
+}
+
+void ConditionalTest() #void :
+{}
+{
+   ConditionalPrimary()
+}
+
+void ConditionalPrimary() #void :
+{}
+{
+   LOOKAHEAD(<LPAREN> ConditionalExpression() <RPAREN>)
+      (<LPAREN> ConditionalExpression() <RPAREN>) #ConditionalParenthetical
+|
+   SimpleCondExpression()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+
+void FunctionsAllowedInSelect() #void :
+{}
+{
+   FunctionsReturningNumerics() |
+   FunctionsReturningStrings()
+}
+
+void SimpleCondExpression() #void :
+{}
+{
+   EmptyCollectionComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IS })
+      NullComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==MEMBER || getToken(3).kind==MEMBER })
+      CollectionMemberExpression()
+|
+   LOOKAHEAD(StringValue() [<NOT>] <LIKE>)
+      LikeExpression()
+|
+   LOOKAHEAD((StringValue() | ArithmeticValue() | DatetimeValue()) [<NOT>] <IN>)
+      InExpression()
+|
+   ComparisonExpression()
+}
+
+void BetweenExpression() #Between :
+{}
+{
+   (ArithmeticExpression() [<NOT> { jjtThis.not=true; } ] <BETWEEN>
+      ArithmeticExpression() <AND> ArithmeticExpression())
+|
+   (DatetimeValue() [<NOT> { jjtThis.not=true; } ] <BETWEEN>
+      DatetimeValue() <AND> DatetimeValue())
+|
+   (StringValue() [<NOT> { jjtThis.not=true; } ] <BETWEEN>
+      StringValue() <AND> StringValue())
+}
+
+void InExpression() #In :
+{}
+{
+   (StringExpression() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN> StringExpression() ( <COMMA> StringExpression() )* <RPAREN>)
+|
+   (ArithmeticPrimary() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN>  ArithmeticPrimary() ( <COMMA> ArithmeticPrimary() )* <RPAREN>)
+|
+   (DatetimeValue() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN> DatetimeValue() ( <COMMA> DatetimeValue() )* <RPAREN>)
+}
+
+void LikeExpression() #Like :
+{}
+{
+   StringValue() [<NOT> { jjtThis.not=true; } ] <LIKE>
+      StringExpression() [<ESCAPE> (StringLiteral() | NumericValuedParameter())]
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void NullComparisonExpression() #NullComparison :
+{}
+{
+   (
+      SingleValuedPath() |
+      NumericValuedParameter() |
+      EntityValuedParameter() |
+      StringValuedParameter() |
+      DatetimeValuedParameter() |
+      BooleanValuedParameter()
+   )
+   <IS> [<NOT> { jjtThis.not=true; } ] <NULL>
+}
+
+void EmptyCollectionComparisonExpression() #IsEmpty :
+{}
+{
+   CollectionValuedPath() <IS> [<NOT> { jjtThis.not=true; } ] <EMPTY>
+}
+
+void CollectionMemberExpression() #MemberOf :
+{}
+{
+   (EntityValuedPath() |
+         IdentificationVariable() |
+         EntityValuedParameter())
+      [<NOT> { jjtThis.not=true; } ] <MEMBER> [<OF>] CollectionValuedPath()
+}
+
+
+void ComparisonExpression() #void :
+{}
+{
+////////////////////// New or changed elements /////////////////////////////
+   LOOKAHEAD(StringValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )
+   (
+      StringValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      StringExpression()
+   ) #StringComparison
+////////////////////////////////////////////////////////////////////////////
+|
+   LOOKAHEAD(BooleanValue() ( <EQ> | <NE> ) )
+   (
+      BooleanValue()
+      [
+         (
+            <EQ> { jjtThis.opp="="; } |
+            <NE> { jjtThis.opp="<>"; }
+         ) BooleanExpression()
+      ]
+   ) #BooleanComparison
+|
+////////////////////// New or changed elements /////////////////////////////
+   LOOKAHEAD(DatetimeValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )
+   (
+      DatetimeValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      DatetimeExpression()
+   ) #DatetimeComparison
+|
+   LOOKAHEAD(ValueClassValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )
+   (
+      ValueClassValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      ValueClassExpression()
+   ) #ValueClassComparison
+////////////////////////////////////////////////////////////////////////////
+|
+   LOOKAHEAD(EntityBeanValue() ( <EQ> | <NE> ) )
+   (
+      EntityBeanValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      EntityBeanExpression()
+   ) #EntityComparison
+|
+   LOOKAHEAD(ArithmeticValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )
+   (
+      ArithmeticValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      SingleValueDesignator()
+   ) #ArithmeticComparison
+|
+   BetweenExpression()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+void ArithmeticValue() #void :
+{}
+{
+   NumericValuedPath() | FunctionsReturningNumerics() |
+   NumericLiteral() | NumericValuedParameter()
+}
+////////////////////////////////////////////////////////////////////////////
+
+void SingleValueDesignator() #void :
+{}
+{
+   ScalarExpression()
+}
+
+void ScalarExpression() #void :
+{}
+{
+   ArithmeticExpression()
+}
+
+void ArithmeticExpression() #void :
+{}
+{
+   (
+      ArithmeticTerm()
+      (
+         (
+            <PLUS> { jjtThis.addOpp("+"); } |
+            <MINUS> { jjtThis.addOpp("-"); }
+         ) ArithmeticTerm()
+      )*
+   ) #PlusMinus(>1)
+}
+
+void ArithmeticTerm() #void :
+{}
+{
+   (
+      ArithmeticFactor()
+      (
+         (
+            <MULT> { jjtThis.addOpp("*"); } |
+            <DIV> { jjtThis.addOpp("/"); }
+         ) ArithmeticFactor()
+      )*
+   ) #MultDiv(>1)
+}
+
+void ArithmeticFactor() #void :
+{ boolean negation = false; }
+{
+   (
+      [<PLUS>|<MINUS>{negation=true;}] ArithmeticPrimary()
+   ) #Negation(negation)
+}
+
+void ArithmeticPrimary() #void :
+{}
+{
+   NumericValuedPath() |
+   NumericLiteral() |
+   (<LPAREN> ArithmeticExpression() <RPAREN>) #ArithmeticParenthetical |
+   NumericValuedParameter() |
+   FunctionsReturningNumerics()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+void StringValue() #void :
+{}
+{
+   StringValuedPath() | FunctionsReturningStrings() |
+   StringLiteral()| StringValuedParameter()
+}
+////////////////////////////////////////////////////////////////////////////
+
+void StringExpression() #void :
+{}
+{
+   StringPrimary() | StringValuedParameter()
+}
+
+void StringPrimary() #void :
+{}
+{
+   StringValuedPath() |
+   StringLiteral() |
+   (<LPAREN> StringExpression() <RPAREN>) #StringParenthetical |
+   FunctionsReturningStrings()
+}
+
+////////////////////// New or changed elements /////////////////////////////
+
+void DatetimeValue() #void :
+{}
+{
+   DatetimeValuedPath() | DatetimeValuedParameter()
+}
+
+void DatetimeExpression() #void :
+{}
+{
+   DatetimeValue()
+}
+
+void BooleanValue() #void :
+{}
+{
+   BooleanValuedPath() | BooleanValuedParameter() | BooleanLiteral()
+}
+
+void BooleanExpression() #void :
+{}
+{
+   BooleanValue()
+}
+
+void ValueClassValue() #void :
+{}
+{
+   ValueClassValuedPath() | ValueClassValuedParameter()
+}
+
+void ValueClassExpression() #void :
+{}
+{
+   ValueClassValue()
+}
+
+
+void EntityBeanValue() #void :
+{}
+{
+   EntityValuedPath() | IdentificationVariable() | EntityValuedParameter()
+}
+
+void EntityBeanExpression() #void :
+{}
+{
+   EntityBeanValue()
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void FunctionsReturningStrings() #void :
+{}
+{
+   (
+      <CONCAT> <LPAREN> StringExpression() <COMMA> StringExpression() <RPAREN>
+   ) #Concat
+|
+   (
+      <SUBSTRING> <LPAREN>
+         StringExpression() <COMMA>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   ) #Substring
+////////////////////// New or changed elements /////////////////////////////
+|
+   (
+      <UCASE> <LPAREN> StringExpression() <RPAREN>
+   ) #UCase
+|
+   (
+      <LCASE> <LPAREN> StringExpression() <RPAREN>
+   ) #LCase
+////////////////////////////////////////////////////////////////////////////
+}
+
+void FunctionsReturningNumerics() #void :
+{}
+{
+   (
+      <LENGTH> <LPAREN> StringExpression() <RPAREN>
+   ) #Length
+|
+   (
+      <LOCATE> <LPAREN>
+            StringExpression() <COMMA> StringExpression()
+            [ <COMMA> ArithmeticExpression()] <RPAREN>
+   ) #Locate
+|
+   (
+      <ABS> <LPAREN> ArithmeticExpression() <RPAREN>
+   ) #Abs
+|
+   (
+      <SQRT> <LPAREN> ArithmeticExpression() <RPAREN>
+   ) #Sqrt
+|
+   (
+      <MOD> <LPAREN>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   ) #Mod
+|
+   AggregateFunctions()
+////////////////////////////////////////////////////////////////////////////
+}
+
+void AggregateFunctions() #void:
+{}
+{
+   (
+      <AVG> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Avg
+|
+   (
+      <MAX> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Max
+|
+   (
+      <MIN> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Min
+|
+   (
+      <SUM> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Sum
+|
+   (
+      <COUNT> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}]
+      (
+         SingleValuedPath() | EntityBeanValue()
+      )
+      <RPAREN>
+   ) #Count
+}
+
+Token CollectionValuedPath() #Path :
+{ Token t; }
+{
+   t=<COLLECTION_VALUED_PATH>
+   {
+      initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE);
+      return t;
+   }
+}
+
+Token IdentificationVariable() #Path :
+{ Token t; }
+{
+   t=<IDENTIFICATION_VARIABLE>
+   {
+      t.image = t.image.toLowerCase();
+      initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE);
+      return t;
+   }
+}
+
+Token AbstractSchema() #AbstractSchema :
+{ Token t; }
+{
+   t=<ABSTRACT_SCHEMA>
+   {
+      jjtThis.abstractSchemaName = t.image;
+      jjtThis.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }
+   |
+   t=<ORDER>
+   {
+      jjtThis.abstractSchemaName = t.image;
+      jjtThis.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }
+}
+
+Token Identifier() #Identifier :
+{ Token t; }
+{
+   t=<IDENTIFIER>
+   {
+      t.image = t.image.toLowerCase();
+      jjtThis.identifier = t.image;
+      return t;
+   }
+}
+
+void SingleValuedPath() #void :
+{}
+{
+   NumericValuedPath()
+|  StringValuedPath()
+|  DatetimeValuedPath()
+|  BooleanValuedPath()
+|  EntityValuedPath()
+|  ValueClassValuedPath()
+}
+
+void NumericValuedPath() #Path :
+{ Token t; }
+{
+   t=<NUMERIC_VALUED_PATH>
+   { initPathNode(jjtThis, t.image, EJBQLTypes.NUMERIC_TYPE); }
+}
+
+void StringValuedPath() #Path :
+{ Token t; }
+{
+   t=<STRING_VALUED_PATH>
+   { initPathNode(jjtThis, t.image, EJBQLTypes.STRING_TYPE); }
+}
+
+void DatetimeValuedPath() #Path :
+{ Token t; }
+{
+   t=<DATETIME_VALUED_PATH>
+   { initPathNode(jjtThis, t.image, EJBQLTypes.DATETIME_TYPE); }
+}
+
+void BooleanValuedPath() #Path :
+{ Token t; }
+{
+   t=<BOOLEAN_VALUED_PATH>
+   { initPathNode(jjtThis, t.image, EJBQLTypes.BOOLEAN_TYPE); }
+}
+
+void EntityValuedPath() #Path :
+{ Token t; }
+{
+   t=<ENTITY_VALUED_PATH>
+   { initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); }
+}
+
+void ValueClassValuedPath() #Path :
+{ Token t; }
+{
+   t=<VALUE_CLASS_VALUED_PATH>
+   { initPathNode(jjtThis, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }
+}
+
+void NumericValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<NUMERIC_VALUED_PARAMETER>
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.NUMERIC_TYPE); }
+}
+
+void StringValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<STRING_VALUED_PARAMETER>
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.STRING_TYPE); }
+}
+
+void DatetimeValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<DATETIME_VALUED_PARAMETER>
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.DATETIME_TYPE); }
+}
+
+void BooleanValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<BOOLEAN_VALUED_PARAMETER>
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.BOOLEAN_TYPE); }
+}
+
+void EntityValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<ENTITY_VALUED_PARAMETER>
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); }
+}
+
+void ValueClassValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<VALUE_CLASS_VALUED_PARAMETER>
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }
+}
+
+void NumericLiteral() #void :
+{ Token t; }
+{
+   (
+      t=<INTEGER_LITERAL> { jjtThis.setValue(t.image); }
+   ) #ExactNumericLiteral
+|
+   (
+      t=<FLOATING_POINT_LITERAL> { jjtThis.setValue(t.image); }
+   ) #ApproximateNumericLiteral
+}
+
+void StringLiteral() #StringLiteral :
+{ Token t; }
+{
+   t=<STRING_LITERAL>
+   { jjtThis.value=t.image; }
+}
+
+void BooleanLiteral() #BooleanLiteral :
+{ Token t; }
+{
+   <TRUE> { jjtThis.value=true; } | <FALSE> { jjtThis.value=false; }
+}
+
+/////////////////////////
+//  Tokens
+/////////////////////////
+
+TOKEN_MGR_DECLS :
+{
+   public Catalog catalog;
+   public Class[] argumentTypes;
+   public IdentifierManager idManager;
+
+   // used for navigation building
+   private List pathList;
+   private List fieldList;
+   private String path;
+
+   private void resetPath() {
+      path = "";
+      pathList = new ArrayList();
+      fieldList = new ArrayList();
+   }
+
+   private void throwUnknownPath(
+         String reason,
+         String fieldName) {
+
+      throw new UnknownPathException(
+            reason,
+            path,
+            fieldName,
+            input_stream.getEndLine(),
+            input_stream.getEndColumn());
+   }
+
+   private void addPath(String nav) {
+      String fieldName = nav.substring(0, nav.length()-1);
+      if(fieldList.size() > 0) {
+         FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+         if(field == null) {
+            throwUnknownPath("Unknown cmr field in path", fieldName);
+         }
+         if(!(field instanceof CMRFieldBridge)) {
+            throwUnknownPath("In path field is not a cmr field", fieldName);
+         }
+
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(!cmrField.isSingleValued()) {
+            throwUnknownPath("In path cmr field is collection valued",
+                  fieldName);
+         }
+         fieldList.add(cmrField);
+      } else {
+         EntityBridge entityBridge = idManager.getEntity(fieldName);
+         if(entityBridge == null) {
+            throwUnknownPath("Unknown initial identifier", fieldName);
+         }
+         fieldList.add(entityBridge);
+      }
+      pathList.add(path + fieldName);
+      path += nav;
+   }
+
+   private EntityBridge getCurrentSchema() {
+      Object lastElement = fieldList.get(fieldList.size()-1);
+      if(lastElement instanceof EntityBridge) {
+         return (EntityBridge)lastElement;
+      } else if(lastElement instanceof CMRFieldBridge) {
+         return ((CMRFieldBridge)lastElement).getRelatedEntity();
+      }
+      // should never happen
+      throw new IllegalStateException("Unknown path element type: " +
+            lastElement);
+   }
+}
+
+<DEFAULT> SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* RESERVED WORDS */
+{
+   < ABS: "ABS" >
+|  < AND: "AND" >
+|  < AS: "AS" >
+|  < BETWEEN: "BETWEEN" >
+|  < CONCAT: "CONCAT" >
+|  < COUNT: "COUNT" >
+|  < MAX: "MAX" >
+|  < MIN: "MIN" >
+|  < AVG: "AVG" >
+|  < SUM: "SUM" >
+|  < DISTINCT: "DISTINCT" >
+|  < EMPTY: "EMPTY" >
+|  < ESCAPE: "ESCAPE" >
+|  < FROM: "FROM" >
+|  < IN: "IN" >
+|  < IS: "IS" >
+|  < LENGTH: "LENGTH" >
+|  < LIKE: "LIKE" >
+|  < LOCATE: "LOCATE" >
+|  < NOT: "NOT" >
+|  < NULL: "NULL" >
+|  < OBJECT: "OBJECT" >
+|  < OF: "OF " >
+|  < OR: "OR" >
+|  < SELECT: "SELECT" >
+|  < SUBSTRING: "SUBSTRING" >
+|  < SQRT: "SQRT" >
+|  < UNKNOWN: "UNKNOWN" >
+|  < WHERE: "WHERE" >
+|  < MEMBER: "MEMBER" >
+|  < ASC: "ASC" >
+|  < DESC: "DESC" >
+|  < LCASE: "LCASE" >
+|  < LIMIT: "LIMIT" >
+|  < OFFSET: "OFFSET" >
+|  < ORDER: "ORDER" >
+|  < BY: "BY" >
+|  < UCASE: "UCASE" >
+|  < MOD: "MOD" >
+}
+
+<DEFAULT> TOKEN : /* SEPARATORS */
+{
+  < LPAREN: "(" >
+| < RPAREN: ")" >
+| < COMMA: "," >
+| < DOT: "." >
+}
+
+<DEFAULT> TOKEN : /* OPERATORS */
+{
+  < GT: ">" >
+| < LT: "<" >
+| < EQ: "=" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "<>" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < MULT: "*" >
+| < DIV: "/" >
+}
+
+<DEFAULT> TOKEN : /* String Literal */
+{
+   < STRING_LITERAL: "'" (~["'"])* ( "''" (~["'"])* )* "'" >
+}
+
+<DEFAULT> TOKEN : /* Numeric Literal */
+{
+   < INTEGER_LITERAL:
+      <DECIMAL_LITERAL> (["l","L"])?
+      | <HEX_LITERAL> (["l","L"])?
+      | <OCTAL_LITERAL> (["l","L"])?
+   >
+|
+   < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+   < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+   < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+   < FLOATING_POINT_LITERAL:
+      (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+   >
+|
+   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* Boolean Literal */
+{
+   < FALSE: "FALSE" >
+|  < TRUE: "TRUE" >
+}
+
+<DEFAULT> TOKEN : /* IDENTIFIERS */
+{
+   < IDENTIFIER: <NAME> >
+   {
+      if(catalog.getEntityByAbstractSchemaName(matchedToken.image) != null) {
+         matchedToken.kind = ABSTRACT_SCHEMA;
+      } else if(idManager.getEntity(matchedToken.image.toLowerCase()) != null) {
+         matchedToken.kind = IDENTIFICATION_VARIABLE;
+         matchedToken.image = matchedToken.image.toLowerCase();
+
+         List pathList = new ArrayList();
+         pathList.add(matchedToken.image);
+         List fieldList = new ArrayList();
+         fieldList.add(idManager.getEntity(matchedToken.image));
+         idManager.registerPath(matchedToken.image, pathList, fieldList);
+      }
+   }
+|
+   < ABSTRACT_SCHEMA: [] >
+|
+   < IDENTIFICATION_VARIABLE: [] >
+|
+   < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+   < #LETTER:
+      [
+       "\u0024",
+       "\u0041"-"\u005a",
+       "\u005f",
+       "\u0061"-"\u007a",
+       "\u00c0"-"\u00d6",
+       "\u00d8"-"\u00f6",
+       "\u00f8"-"\u00ff",
+       "\u0100"-"\u1fff",
+       "\u3040"-"\u318f",
+       "\u3300"-"\u337f",
+       "\u3400"-"\u3d2d",
+       "\u4e00"-"\u9fff",
+       "\uf900"-"\ufaff"
+      ]
+   >
+|
+   < #DIGIT:
+      [
+       "\u0030"-"\u0039",
+       "\u0660"-"\u0669",
+       "\u06f0"-"\u06f9",
+       "\u0966"-"\u096f",
+       "\u09e6"-"\u09ef",
+       "\u0a66"-"\u0a6f",
+       "\u0ae6"-"\u0aef",
+       "\u0b66"-"\u0b6f",
+       "\u0be7"-"\u0bef",
+       "\u0c66"-"\u0c6f",
+       "\u0ce6"-"\u0cef",
+       "\u0d66"-"\u0d6f",
+       "\u0e50"-"\u0e59",
+       "\u0ed0"-"\u0ed9",
+       "\u1040"-"\u1049"
+      ]
+   >
+}
+
+<DEFAULT> TOKEN : /* PARAMETERS */
+{
+   < UNKNOWN_PARAMETER: "?" <INTEGER_LITERAL> >
+   {
+      int n = EJBQLTypes.UNKNOWN_TYPE;
+      try {
+         n = Integer.parseInt(matchedToken.image.substring(1, lengthOfMatch));
+      } catch(Exception e) { /* Should never come here. */ }
+
+      matchedToken.image = "" + n;
+
+      // zero base the index
+      n--;
+
+      if(n < argumentTypes.length) {
+         switch(EJBQLTypes.getEJBQLType(argumentTypes[n])) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PARAMETER;
+               break;
+         }
+      }
+   }
+|  < NUMERIC_VALUED_PARAMETER: [] >
+|  < STRING_VALUED_PARAMETER: [] >
+|  < DATETIME_VALUED_PARAMETER: [] >
+|  < BOOLEAN_VALUED_PARAMETER: [] >
+|  < ENTITY_VALUED_PARAMETER: [] >
+|  < VALUE_CLASS_VALUED_PARAMETER: [] >
+}
+
+/**
+ * WARNING: Be careful here. If look ahead is to high in the from clause, it
+ * is possible that the identification varible is not registered before it
+ * is used here.
+ */
+<DEFAULT> SPECIAL_TOKEN :  /* Navigation */
+{
+   < <NAME> <DOT> > {
+      resetPath();
+      addPath(matchedToken.image.toLowerCase());
+   } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> SPECIAL_TOKEN :
+{
+   < <NAME> <DOT> > { addPath(matchedToken.image); } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> TOKEN :
+{
+   < PART: <NAME> > {
+      String fieldName = matchedToken.image;
+      matchedToken.image = path + fieldName;
+
+      FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+      if(field == null) {
+         throwUnknownPath("Unknown terminal field", fieldName);
+      }
+      if(field instanceof CMPFieldBridge) {
+         CMPFieldBridge cmpField = (CMPFieldBridge)field;
+         switch(EJBQLTypes.getEJBQLType(cmpField.getFieldType())) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PATH;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PATH;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PATH;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PATH;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PATH;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PATH;
+               break;
+            default:
+               throwUnknownPath("Unknown cmp field type", fieldName);
+         }
+      } else {
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(cmrField.isSingleValued()) {
+            matchedToken.kind = ENTITY_VALUED_PATH;
+         } else {
+            matchedToken.kind = COLLECTION_VALUED_PATH;
+         }
+      }
+      pathList.add(matchedToken.image);
+      fieldList.add(field);
+      idManager.registerPath(matchedToken.image, pathList, fieldList);
+      resetPath();
+   } : DEFAULT
+|  < NUMERIC_VALUED_PATH: [] >
+|  < STRING_VALUED_PATH: [] >
+|  < DATETIME_VALUED_PATH: [] >
+|  < BOOLEAN_VALUED_PATH: [] >
+|  < ENTITY_VALUED_PATH: [] >
+|  < VALUE_CLASS_VALUED_PATH: [] >
+|  < UNKNOWN_PATH: [] >
+|  < COLLECTION_VALUED_PATH: [] >
+}
+
+

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/cmp/ejbql/EJBQLParser.jjt
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/cmp/ejbql/EJBQLParser.jjt	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/jboss/ejb/plugins/cmp/ejbql/EJBQLParser.jjt	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,1235 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+ 
+options {
+   BUILD_NODE_FILES=false;
+   MULTI=true;
+   
+   JAVA_UNICODE_ESCAPE = true;
+   STATIC = false;
+
+   CHOICE_AMBIGUITY_CHECK = 5;
+   OTHER_AMBIGUITY_CHECK = 5;
+
+   LOOKAHEAD = 1;
+   DEBUG_PARSER = false;
+   DEBUG_LOOKAHEAD = false;
+   DEBUG_TOKEN_MANAGER = false;
+   ERROR_REPORTING = true;
+   UNICODE_INPUT = false;
+   IGNORE_CASE = false;
+   USER_TOKEN_MANAGER = false;
+   USER_CHAR_STREAM = false;
+   BUILD_PARSER = true;
+   BUILD_TOKEN_MANAGER = true;
+   SANITY_CHECK = true;
+   FORCE_LA_CHECK = false;
+}
+
+PARSER_BEGIN(EJBQLParser)
+package org.jboss.ejb.somepackage;
+
+import java.io.CharArrayReader;
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.ejb.plugins.cmp.bridge.EntityBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.FieldBridge;
+
+/**
+ * This class parses EJB-QL into an abstract syntax tree.
+ *
+ * @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version $Revision: 44170 $
+ */                            
+public class EJBQLParser {
+   private Catalog catalog;
+   private Class[] argumentTypes;
+   private IdentifierManager idManager;
+   private boolean selectDistinct;
+   private String selectPath;
+
+   public ASTEJBQL parse(Catalog catalog, Class[] argumentTypes, String ejbql)
+         throws ParseException {
+
+      this.catalog = catalog;
+      token_source.catalog = catalog;
+      this.argumentTypes = argumentTypes;
+      token_source.argumentTypes = argumentTypes;
+      idManager = new IdentifierManager(catalog);
+      token_source.idManager = idManager;
+
+      String lowerCase = ejbql.toLowerCase();
+      int fromBeginIndex = indexOf(lowerCase, "from");
+      if(fromBeginIndex < 0) {
+         throw new ParseException("FROM not found");
+      }
+
+      int fromEndIndex = indexOf(lowerCase, "where");
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOfOrderBy(lowerCase);
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = ejbql.length();
+      }
+
+      // just the from clause
+      char[] from = ejbql.toCharArray();
+      clear(from, 0, fromBeginIndex);
+      clear(from, fromEndIndex, from.length);
+
+      // everything except for the from clause
+      char[] sansFrom = ejbql.toCharArray();
+      clear(sansFrom, fromBeginIndex + 4, fromEndIndex);
+
+      // From clause
+      ReInit(new CharArrayReader(from));
+      ASTFrom fromNode = ParseFromClause();
+
+      // Everything else
+      ReInit(new CharArrayReader(sansFrom));
+      ASTEJBQL ejbqlNode = EJBQL();
+
+      // replace the dummy from clause in the EJBQL 
+      // node with the real from node
+      ejbqlNode.jjtAddChild(fromNode, 1);
+
+      return ejbqlNode;
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word)
+   {
+      return indexOf(ql, word, 0);
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * starting with startInd position or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word, int startInd)
+   {
+      int i = ql.indexOf(word, startInd);
+      if(i < 0)
+      {
+         return -1;
+      }
+
+      int qlLength = ql.length();
+      int wordLength = word.length();
+      while(i >= 0)
+      {
+         int endInd = i + wordLength;
+         if((i == 0 || Character.isWhitespace(ql.charAt(i - 1))) &&
+            (endInd == qlLength || endInd < qlLength && Character.isWhitespace(ql.charAt(endInd))))
+         {
+            break;
+         }
+
+         i = ql.indexOf(word, i + 1);
+      }
+      return i;
+   }
+
+   private static final int indexOfOrderBy(String ql)
+   {
+      int orderInd = indexOf(ql, "order", 0);
+      int byInd = -1;
+      while(orderInd > 0)
+      {
+         if(byInd < orderInd)
+         {
+            byInd = indexOf(ql, "by", orderInd + 5);
+         }
+
+         if(byInd > 0)
+         {
+            int i = byInd - 1;
+            while(i >= orderInd + 5 && Character.isWhitespace(ql.charAt(i--)));
+            if(i == orderInd + 4)
+            {
+               break;
+            }
+            else
+            {
+               orderInd = indexOf(ql, "order", orderInd + 5);
+            }
+         }
+         else
+         {
+            orderInd = -1;
+         }
+      }
+      return orderInd;
+   }
+
+   private final void clear(char[] c, int beginIndex, int endIndex) {
+      for(int i=beginIndex; i < endIndex; i++) {
+         if(c[i]!='\r' && c[i]!='\n' && c[i]!='\t') {
+            c[i] = ' ';
+         }
+      }
+   }
+
+   private final void initPathNode(ASTPath pathNode, String path, int type) {
+      pathNode.pathList = idManager.getPathList(path);
+      pathNode.fieldList = idManager.getFieldList(path);
+      pathNode.type = type;
+   }
+
+   private final void initParameterNode(
+         ASTParameter parameterNode,
+         String number,
+         int type) {
+         
+      parameterNode.number = Integer.parseInt(number);
+      parameterNode.type = type;
+   }
+}
+
+PARSER_END(EJBQLParser)
+
+ASTEJBQL EJBQL() #EJBQL :
+{}
+{
+   SelectClause() FromKeyword() [WhereClause()] [OrderByClause()] <EOF>
+   { return jjtThis; }
+}
+
+ASTOrderBy OrderByClause() #OrderBy :
+{}
+{
+   <ORDER> <BY> OrderByPathExpression() ( <COMMA> OrderByPathExpression() ) *
+   { return jjtThis; }
+}
+
+void OrderByPathExpression() #OrderByPath :
+{}
+{
+   ( NumericValuedPath() | StringValuedPath() | DatetimeValuedPath() )
+      [<ASC> | <DESC> { jjtThis.ascending=false; } ]
+}
+
+void FromKeyword() #From :
+{}
+{
+   <FROM>
+}
+
+ASTFrom ParseFromClause() #void :
+{ ASTFrom node; }
+{
+   node = FromClause() <EOF>
+   { return node; }
+}
+
+ASTFrom FromClause() #From :
+{}
+{
+   (
+      <FROM> IdentificationVariableDeclaration() 
+         ( <COMMA> IdentificationVariableDeclaration() )*
+   ) { return jjtThis; }
+}
+
+void IdentificationVariableDeclaration() #void :
+{}
+{
+   (CollectionMemberDeclaration() | RangeVariableDeclaration())
+}
+
+void CollectionMemberDeclaration() :
+{
+   Token path;
+   Token id;
+}
+{
+   ( <IN> <LPAREN> path=CollectionValuedPath() <RPAREN>
+      [<AS>] id=Identifier() )
+      { idManager.declareCollectionMember(id.image, path.image); }
+}
+
+void RangeVariableDeclaration() :
+{
+   Token schema;
+   Token id;
+}
+{
+   ( schema=AbstractSchema() [<AS>] id=Identifier() )
+      { idManager.declareRangeVariable(id.image, schema.image); }
+}
+
+ASTSelect SelectClause() #Select :
+{}
+{
+   (
+      <SELECT> [<DISTINCT> { jjtThis.distinct=true; }] 
+      ( 
+         <OBJECT> <LPAREN> IdentificationVariable() <RPAREN> |
+         SelectExpression()
+      )
+   ) { return jjtThis; }
+}
+
+void SelectExpression() #void :
+{}
+{
+   SingleValuedPath() | AggregateSelectExpression()
+}
+
+ASTWhere WhereClause() #Where :
+{}
+{
+   <WHERE> WhereExpression()
+   { return jjtThis; }
+}
+
+//
+// ASTWhereExpression and ASTWhereConditionalTerm mimic
+// ConditionalExpression and ConditionalTerm.
+// They are added to support joins per WhereConditionalTerm.
+//
+void WhereExpression() #void :
+{}
+{
+   (
+      WhereConditionalTerm() ( <OR> WhereConditionalTerm() )*
+   ) #Or(>1)
+}
+
+ASTWhereConditionalTerm WhereConditionalTerm() #WhereConditionalTerm :
+{}
+{
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   ) #And(>1)
+   {return jjtThis;}
+}
+
+void ConditionalExpression() #void :
+{}
+{
+   (
+      ConditionalTerm() ( <OR> ConditionalTerm() )*
+   ) #Or(>1)
+}
+
+void ConditionalTerm() #void :
+{}
+{
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   ) #And(>1)
+}
+   
+void ConditionalFactor() #void :
+{ boolean not = false; }
+{
+   (
+      [<NOT>{ not=true; }] ConditionalTest()
+   ) #Not(not)
+}
+
+void ConditionalTest() #void :
+{}
+{
+   ConditionalPrimary()
+}
+
+void ConditionalPrimary() #void :
+{}
+{
+   LOOKAHEAD(<LPAREN> ConditionalExpression() <RPAREN>)
+      (<LPAREN> ConditionalExpression() <RPAREN>) #ConditionalParenthetical 
+|
+   SimpleCondExpression()
+}
+
+void SimpleCondExpression() #void :
+{}
+{
+   EmptyCollectionComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IS })
+      NullComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==MEMBER || getToken(3).kind==MEMBER })
+      CollectionMemberExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==LIKE || getToken(3).kind==LIKE })
+      LikeExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IN || getToken(3).kind==IN })
+      InExpression()
+| 
+   ComparisonExpression()
+}
+
+void BetweenExpression() #Between :
+{}
+{
+   ArithmeticExpression() [<NOT> { jjtThis.not=true; } ] <BETWEEN> 
+      ArithmeticExpression() <AND> ArithmeticExpression()
+}
+
+void InExpression() #In :
+{}
+{
+   (StringExpression() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN> StringExpression() ( <COMMA> StringExpression() )* <RPAREN>)
+|
+   (ArithmeticPrimary() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN>  ArithmeticPrimary() ( <COMMA> ArithmeticPrimary() )* <RPAREN>)
+}
+
+void LikeExpression() #Like :
+{}
+{
+   StringValuedPath() [<NOT> { jjtThis.not=true; } ] <LIKE>
+      StringExpression() [<ESCAPE> (StringLiteral() | NumericValuedParameter())]
+}
+
+void NullComparisonExpression() #NullComparison :
+{}
+{
+   (
+      SingleValuedPath() |
+      NumericValuedParameter() |
+      EntityValuedParameter() |
+      StringValuedParameter() |
+      DatetimeValuedParameter() |
+      BooleanValuedParameter()
+   )
+   <IS> [<NOT> { jjtThis.not=true; } ] <NULL>
+}
+
+void EmptyCollectionComparisonExpression() #IsEmpty :
+{}
+{
+   CollectionValuedPath() <IS> [<NOT> { jjtThis.not=true; } ] <EMPTY>
+}
+
+void CollectionMemberExpression() #MemberOf :
+{}
+{
+   (EntityValuedPath() |
+         IdentificationVariable() |
+         EntityValuedParameter())
+      [<NOT> { jjtThis.not=true; } ] <MEMBER> [<OF>] CollectionValuedPath()
+}
+
+
+void ComparisonExpression() #void :
+{}
+{
+   (
+      StringValue() 
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      StringExpression()
+   ) #StringComparison
+|
+   (
+      BooleanValue()
+      [
+         ( 
+            <EQ> { jjtThis.opp="="; } |
+            <NE> { jjtThis.opp="<>"; }
+         ) BooleanExpression()
+      ]
+   ) #BooleanComparison
+|
+   (
+      DatetimeValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <LT> { jjtThis.opp="<"; } |
+         <NE> { jjtThis.opp="<>"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LE> { jjtThis.opp="<="; }
+      )
+      DatetimeExpression()
+   ) #DatetimeComparison
+|
+   (
+      EntityBeanValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      EntityBeanExpression()
+   ) #EntityComparison
+|
+   LOOKAHEAD(ArithmeticValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )
+   ( 
+      ArithmeticValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; } 
+      )
+      SingleValueDesignator()
+   ) #ArithmeticComparison
+|
+   BetweenExpression() 
+}
+
+void ArithmeticValue() #void :
+{}
+{
+   NumericValuedPath() | FunctionsReturningNumerics()
+}
+
+void SingleValueDesignator() #void :
+{}
+{
+   ScalarExpression()
+}
+
+void ScalarExpression() #void :
+{}
+{
+   ArithmeticExpression()
+}
+
+void ArithmeticExpression() #void :
+{}
+{
+   (
+      ArithmeticTerm()
+      (
+         (
+            <PLUS> { jjtThis.addOpp("+"); } |
+            <MINUS> { jjtThis.addOpp("-"); }
+         ) ArithmeticTerm()
+      )*
+   ) #PlusMinus(>1)
+}
+
+void ArithmeticTerm() #void :
+{}
+{
+   (
+      ArithmeticFactor() 
+      (
+         (
+            <MULT> { jjtThis.addOpp("*"); } |
+            <DIV> { jjtThis.addOpp("/"); }
+         ) ArithmeticFactor()
+      )*
+   ) #MultDiv(>1)
+}
+
+void ArithmeticFactor() #void :
+{ boolean negation = false; }
+{
+   (
+      [<PLUS>|<MINUS>{negation=true;}] ArithmeticPrimary()
+   ) #Negation(negation)
+}
+
+void ArithmeticPrimary() #void :
+{}
+{
+   NumericValuedPath() |
+   NumericLiteral() |
+   (<LPAREN> ArithmeticExpression() <RPAREN>) #ArithmeticParenthetical |
+   NumericValuedParameter() |
+   FunctionsReturningNumerics()
+}
+
+void StringValue() #void :
+{}
+{
+   StringValuedPath() | FunctionsReturningStrings()
+}
+
+void StringExpression() #void :
+{}
+{
+   StringPrimary() | StringValuedParameter() 
+}
+
+void StringPrimary() #void :
+{}
+{
+   StringValuedPath() |
+   StringLiteral() | 
+   (<LPAREN> StringExpression() <RPAREN>) #StringParenthetical |
+   FunctionsReturningStrings()
+}
+
+void DatetimeValue() #void :
+{}
+{
+   DatetimeValuedPath() 
+}
+
+void DatetimeExpression() #void :
+{}
+{
+   DatetimeValue() | DatetimeValuedParameter() 
+}
+
+void BooleanValue() #void :
+{}
+{
+   BooleanValuedPath() 
+}
+
+void BooleanExpression() #void :
+{}
+{
+   BooleanValue() | BooleanValuedParameter() | BooleanLiteral()
+}
+
+void EntityBeanValue() #void :
+{}
+{
+   EntityValuedPath() | IdentificationVariable()
+}
+
+void EntityBeanExpression() #void :
+{}
+{
+   EntityBeanValue() | EntityValuedParameter() 
+}
+
+void FunctionsReturningStrings() #void :
+{}
+{
+   (
+      <CONCAT> <LPAREN> StringExpression() <COMMA> StringExpression() <RPAREN>
+   ) #Concat
+|
+   (
+      <SUBSTRING> <LPAREN> 
+         StringExpression() <COMMA>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   ) #Substring
+}
+
+void FunctionsReturningNumerics() #void :
+{}
+{
+   (
+      <LENGTH> <LPAREN> StringExpression() <RPAREN> 
+   ) #Length
+|
+   (
+      <LOCATE> <LPAREN> 
+            StringExpression() <COMMA> StringExpression()
+            [ <COMMA> ArithmeticExpression()] <RPAREN>
+   ) #Locate
+|
+   (
+      <ABS> <LPAREN> ArithmeticExpression() <RPAREN> 
+   ) #Abs
+|
+   (
+      <SQRT> <LPAREN> ArithmeticExpression() <RPAREN>
+   ) #Sqrt
+|
+   (
+      <MOD> <LPAREN> ArithmeticExpression() <COMMA> ArithmeticExpression() <RPAREN>
+   ) #Mod
+}
+
+Token CollectionValuedPath() #Path :
+{ Token t; }
+{
+   t=<COLLECTION_VALUED_PATH> 
+   { 
+      initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); 
+      return t;
+   }
+}
+
+Token IdentificationVariable() #Path :
+{ Token t; }
+{
+   t=<IDENTIFICATION_VARIABLE> 
+   { 
+      t.image = t.image.toLowerCase();
+      initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); 
+      return t;
+   }
+}
+
+Token AbstractSchema() #AbstractSchema :
+{ Token t; }
+{
+   t=<ABSTRACT_SCHEMA> 
+   { 
+      jjtThis.abstractSchemaName = t.image;
+      jjtThis.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t; 
+   }
+   |
+   t=<ORDER>
+   {
+      jjtThis.abstractSchemaName = t.image;
+      jjtThis.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }
+}
+
+Token Identifier() #Identifier :
+{ Token t; }
+{
+   t=<IDENTIFIER> 
+   { 
+      t.image = t.image.toLowerCase();
+      jjtThis.identifier = t.image;
+      return t; 
+   }
+}
+
+void SingleValuedPath() #void :
+{}
+{
+   NumericValuedPath()
+|  StringValuedPath()
+|  DatetimeValuedPath()
+|  BooleanValuedPath()
+|  EntityValuedPath()
+|  ValueClassValuedPath()
+}
+
+void NumericValuedPath() #Path :
+{ Token t; }
+{
+   t=<NUMERIC_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.NUMERIC_TYPE); }
+}
+
+void StringValuedPath() #Path :
+{ Token t; }
+{
+   t=<STRING_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.STRING_TYPE); }
+}
+
+void DatetimeValuedPath() #Path :
+{ Token t; }
+{
+   t=<DATETIME_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.DATETIME_TYPE); }
+}
+
+void BooleanValuedPath() #Path :
+{ Token t; }
+{
+   t=<BOOLEAN_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.BOOLEAN_TYPE); }
+}
+
+void EntityValuedPath() #Path :
+{ Token t; }
+{
+   t=<ENTITY_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); }
+}
+
+void ValueClassValuedPath() #Path :
+{ Token t; }
+{
+   t=<VALUE_CLASS_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }
+}
+
+void NumericValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<NUMERIC_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.NUMERIC_TYPE); }
+}
+
+void StringValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<STRING_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.STRING_TYPE); }
+}
+
+void DatetimeValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<DATETIME_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.DATETIME_TYPE); }
+}
+
+void BooleanValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<BOOLEAN_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.BOOLEAN_TYPE); }
+}
+
+void EntityValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<ENTITY_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); }
+}
+
+void ValueClassValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<VALUE_CLASS_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }
+}
+
+void NumericLiteral() #void :
+{ Token t; }
+{
+   (
+      t=<INTEGER_LITERAL> { jjtThis.setValue(t.image); }
+   ) #ExactNumericLiteral
+| 
+   (
+      t=<FLOATING_POINT_LITERAL> { jjtThis.setValue(t.image); }
+   ) #ApproximateNumericLiteral
+}
+
+void StringLiteral() #StringLiteral :
+{ Token t; }
+{
+   t=<STRING_LITERAL> 
+   { jjtThis.value=t.image; }
+}
+
+void BooleanLiteral() #BooleanLiteral :
+{ Token t; }
+{
+   <TRUE> { jjtThis.value=true; } | <FALSE> { jjtThis.value=false; } 
+}
+
+void AggregateSelectExpression() #void:
+{}
+{
+   (
+      <AVG> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Avg
+|
+   (
+      <MAX> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Max
+|
+   (
+      <MIN> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Min
+|
+   (
+      <SUM> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Sum
+|
+   (
+      <COUNT> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}]
+      (
+         SingleValuedPath() | EntityBeanValue()
+      )
+      <RPAREN>
+   ) #Count
+}
+
+/////////////////////////
+//  Tokens
+/////////////////////////
+
+TOKEN_MGR_DECLS :
+{
+   public Catalog catalog;
+   public Class[] argumentTypes;
+   public IdentifierManager idManager;
+
+   // used for navigation building
+   private List pathList;
+   private List fieldList;
+   private String path;
+
+   private void resetPath() {
+      path = "";
+      pathList = new ArrayList();
+      fieldList = new ArrayList();
+   }
+   
+   private void throwUnknownPath(
+         String reason,
+         String fieldName) {
+
+      throw new UnknownPathException(
+            reason,
+            path,
+            fieldName,
+            input_stream.getEndLine(),
+            input_stream.getEndColumn());
+   }
+   
+   private void addPath(String nav) {
+      String fieldName = nav.substring(0, nav.length()-1);
+      if(fieldList.size() > 0) {
+         FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+         if(field == null) {
+            throwUnknownPath("Unknown cmr field in path", fieldName);
+         }
+         if(!(field instanceof CMRFieldBridge)) {
+            throwUnknownPath("In path field is not a cmr field", fieldName);
+         }
+
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(!cmrField.isSingleValued()) {
+            throwUnknownPath("In path cmr field is collection valued",
+                  fieldName);
+         }
+         fieldList.add(cmrField);
+      } else {
+         EntityBridge entityBridge = idManager.getEntity(fieldName);
+         if(entityBridge == null) {
+            throwUnknownPath("Unknown initial identifier", fieldName);
+         }
+         fieldList.add(entityBridge);
+      }
+      pathList.add(path + fieldName);
+      path += nav;
+   }
+
+   private EntityBridge getCurrentSchema() {
+      Object lastElement = fieldList.get(fieldList.size()-1);
+      if(lastElement instanceof EntityBridge) {
+         return (EntityBridge)lastElement;
+      } else if(lastElement instanceof CMRFieldBridge) {
+         return ((CMRFieldBridge)lastElement).getRelatedEntity();
+      }
+      // should never happen
+      throw new IllegalStateException("Unknown path element type: " +
+            lastElement);
+   }
+}
+
+<DEFAULT> SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* RESERVED WORDS */
+{
+   < ABS: "ABS" >
+|  < AND: "AND" >
+|  < AS: "AS" >
+|  < BETWEEN: "BETWEEN" >
+|  < CONCAT: "CONCAT" >
+|  < DISTINCT: "DISTINCT" >
+|  < EMPTY: "EMPTY" >
+|  < ESCAPE: "ESCAPE" >
+|  < FROM: "FROM" >
+|  < IN: "IN" >
+|  < IS: "IS" >
+|  < LENGTH: "LENGTH" >
+|  < LIKE: "LIKE" >
+|  < LOCATE: "LOCATE" >
+|  < NOT: "NOT" >
+|  < NULL: "NULL" >
+|  < OBJECT: "OBJECT" >
+|  < OF: "OF " >
+|  < OR: "OR" >
+|  < SELECT: "SELECT" >
+|  < SUBSTRING: "SUBSTRING" >
+|  < SQRT: "SQRT" >
+|  < UNKNOWN: "UNKNOWN" >
+|  < WHERE: "WHERE" >
+|  < MEMBER: "MEMBER" >
+
+// EJB QL 2.1 tokens
+
+|  < ORDER: "ORDER" >
+|  < BY: "BY" >
+|  < ASC: "ASC" >
+|  < DESC: "DESC" >
+|  < COUNT: "COUNT" >
+|  < MAX: "MAX" >
+|  < MIN: "MIN" >
+|  < AVG: "AVG" >
+|  < SUM: "SUM" >
+|  < MOD: "MOD" >
+}
+
+<DEFAULT> TOKEN : /* SEPARATORS */
+{
+  < LPAREN: "(" >
+| < RPAREN: ")" >
+| < COMMA: "," >
+| < DOT: "." >
+}
+
+<DEFAULT> TOKEN : /* OPERATORS */
+{
+  < GT: ">" >
+| < LT: "<" >
+| < EQ: "=" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "<>" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < MULT: "*" >
+| < DIV: "/" >
+}
+
+<DEFAULT> TOKEN : /* String Literal */
+{
+   < STRING_LITERAL: "'" (~["'"])* ( "''" (~["'"])* )* "'" >
+}
+
+<DEFAULT> TOKEN : /* Numeric Literal */
+{
+   < INTEGER_LITERAL:
+      <DECIMAL_LITERAL> (["l","L"])?
+      | <HEX_LITERAL> (["l","L"])?
+      | <OCTAL_LITERAL> (["l","L"])?
+   >
+|
+   < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+   < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+   < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+   < FLOATING_POINT_LITERAL:
+      (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+   >
+|
+   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* Boolean Literal */
+{
+   < FALSE: "FALSE" >
+|  < TRUE: "TRUE" >
+}
+
+<DEFAULT> TOKEN : /* IDENTIFIERS */
+{
+   < IDENTIFIER: <NAME> >
+   {
+      if(catalog.getEntityByAbstractSchemaName(matchedToken.image) != null) {
+         matchedToken.kind = ABSTRACT_SCHEMA;
+      } else if(idManager.getEntity(matchedToken.image.toLowerCase()) != null) {
+         matchedToken.kind = IDENTIFICATION_VARIABLE;
+         matchedToken.image = matchedToken.image.toLowerCase();
+
+         List pathList = new ArrayList();
+         pathList.add(matchedToken.image);
+         List fieldList = new ArrayList();
+         fieldList.add(idManager.getEntity(matchedToken.image));
+         idManager.registerPath(matchedToken.image, pathList, fieldList);
+      }
+   }
+|
+   < ABSTRACT_SCHEMA: [] >
+|
+   < IDENTIFICATION_VARIABLE: [] >
+|
+   < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+   < #LETTER:
+      [
+       "\u0024",
+       "\u0041"-"\u005a",
+       "\u005f",
+       "\u0061"-"\u007a",
+       "\u00c0"-"\u00d6",
+       "\u00d8"-"\u00f6",
+       "\u00f8"-"\u00ff",
+       "\u0100"-"\u1fff",
+       "\u3040"-"\u318f",
+       "\u3300"-"\u337f",
+       "\u3400"-"\u3d2d",
+       "\u4e00"-"\u9fff",
+       "\uf900"-"\ufaff"
+      ]
+   >
+|
+   < #DIGIT:
+      [
+       "\u0030"-"\u0039",
+       "\u0660"-"\u0669",
+       "\u06f0"-"\u06f9",
+       "\u0966"-"\u096f",
+       "\u09e6"-"\u09ef",
+       "\u0a66"-"\u0a6f",
+       "\u0ae6"-"\u0aef",
+       "\u0b66"-"\u0b6f",
+       "\u0be7"-"\u0bef",
+       "\u0c66"-"\u0c6f",
+       "\u0ce6"-"\u0cef",
+       "\u0d66"-"\u0d6f",
+       "\u0e50"-"\u0e59",
+       "\u0ed0"-"\u0ed9",
+       "\u1040"-"\u1049"
+      ]
+   >
+}
+
+<DEFAULT> TOKEN : /* PARAMETERS */
+{
+   < UNKNOWN_PARAMETER: "?" <INTEGER_LITERAL> >
+   {
+      int n = EJBQLTypes.UNKNOWN_TYPE;
+      try { 
+         n = Integer.parseInt(matchedToken.image.substring(1, lengthOfMatch));
+      } catch(Exception e) { /* Should never come here. */ }
+      
+      matchedToken.image = "" + n;
+
+      // zero base the index
+      n--;   
+      
+      if(n < argumentTypes.length) {
+         switch(EJBQLTypes.getEJBQLType(argumentTypes[n])) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PARAMETER;
+               break;
+         }
+      }
+   }
+|  < NUMERIC_VALUED_PARAMETER: [] >
+|  < STRING_VALUED_PARAMETER: [] >
+|  < DATETIME_VALUED_PARAMETER: [] >
+|  < BOOLEAN_VALUED_PARAMETER: [] >
+|  < ENTITY_VALUED_PARAMETER: [] >
+|  < VALUE_CLASS_VALUED_PARAMETER: [] >
+}
+
+/**
+ * WARNING: Be careful here. If look ahead is to high in the from clause, it
+ * is possible that the identification varible is not registered before it
+ * is used here.
+ */
+<DEFAULT> SPECIAL_TOKEN :  /* Navigation */
+{
+   < <NAME> <DOT> > { 
+      resetPath();
+      addPath(matchedToken.image.toLowerCase()); 
+   } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> SPECIAL_TOKEN :
+{
+   < <NAME> <DOT> > { addPath(matchedToken.image); } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> TOKEN :
+{
+   < PART: <NAME> > {
+      String fieldName = matchedToken.image;
+      matchedToken.image = path + fieldName;
+
+      FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+      if(field == null) {
+         throwUnknownPath("Unknown terminal field", fieldName);
+      }
+      if(field instanceof CMPFieldBridge) {
+         CMPFieldBridge cmpField = (CMPFieldBridge)field;
+         switch(EJBQLTypes.getEJBQLType(cmpField.getFieldType())) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PATH;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PATH;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PATH;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PATH;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PATH;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PATH;
+               break;
+            default:
+               throwUnknownPath("Unknown cmp field type", fieldName);
+         }
+      } else {
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(cmrField.isSingleValued()) {
+            matchedToken.kind = ENTITY_VALUED_PATH;
+         } else {
+            matchedToken.kind = COLLECTION_VALUED_PATH;
+         }
+      }
+      pathList.add(matchedToken.image);
+      fieldList.add(field);
+      idManager.registerPath(matchedToken.image, pathList, fieldList);
+      resetPath();
+   } : DEFAULT
+|  < NUMERIC_VALUED_PATH: [] >
+|  < STRING_VALUED_PATH: [] >
+|  < DATETIME_VALUED_PATH: [] >
+|  < BOOLEAN_VALUED_PATH: [] >
+|  < ENTITY_VALUED_PATH: [] >
+|  < VALUE_CLASS_VALUED_PATH: [] >
+|  < UNKNOWN_PATH: [] >
+|  < COLLECTION_VALUED_PATH: [] >
+}  
+
+

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/test/EJBQLParser.jjt
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/test/EJBQLParser.jjt	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/main/stuff/org/test/EJBQLParser.jjt	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,1235 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+ 
+options {
+   BUILD_NODE_FILES=false;
+   MULTI=true;
+   
+   JAVA_UNICODE_ESCAPE = true;
+   STATIC = false;
+
+   CHOICE_AMBIGUITY_CHECK = 5;
+   OTHER_AMBIGUITY_CHECK = 5;
+
+   LOOKAHEAD = 1;
+   DEBUG_PARSER = false;
+   DEBUG_LOOKAHEAD = false;
+   DEBUG_TOKEN_MANAGER = false;
+   ERROR_REPORTING = true;
+   UNICODE_INPUT = false;
+   IGNORE_CASE = false;
+   USER_TOKEN_MANAGER = false;
+   USER_CHAR_STREAM = false;
+   BUILD_PARSER = true;
+   BUILD_TOKEN_MANAGER = true;
+   SANITY_CHECK = true;
+   FORCE_LA_CHECK = false;
+}
+
+PARSER_BEGIN(EJBQLParser)
+package org.test;
+
+import java.io.CharArrayReader;
+import java.util.ArrayList;
+import java.util.List;
+import org.jboss.ejb.plugins.cmp.bridge.EntityBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge;
+import org.jboss.ejb.plugins.cmp.bridge.FieldBridge;
+
+/**
+ * This class parses EJB-QL into an abstract syntax tree.
+ *
+ * @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version $Revision: 44170 $
+ */                            
+public class EJBQLParser {
+   private Catalog catalog;
+   private Class[] argumentTypes;
+   private IdentifierManager idManager;
+   private boolean selectDistinct;
+   private String selectPath;
+
+   public ASTEJBQL parse(Catalog catalog, Class[] argumentTypes, String ejbql)
+         throws ParseException {
+
+      this.catalog = catalog;
+      token_source.catalog = catalog;
+      this.argumentTypes = argumentTypes;
+      token_source.argumentTypes = argumentTypes;
+      idManager = new IdentifierManager(catalog);
+      token_source.idManager = idManager;
+
+      String lowerCase = ejbql.toLowerCase();
+      int fromBeginIndex = indexOf(lowerCase, "from");
+      if(fromBeginIndex < 0) {
+         throw new ParseException("FROM not found");
+      }
+
+      int fromEndIndex = indexOf(lowerCase, "where");
+      if(fromEndIndex < 0) {
+         fromEndIndex = indexOfOrderBy(lowerCase);
+      }
+      if(fromEndIndex < 0) {
+         fromEndIndex = ejbql.length();
+      }
+
+      // just the from clause
+      char[] from = ejbql.toCharArray();
+      clear(from, 0, fromBeginIndex);
+      clear(from, fromEndIndex, from.length);
+
+      // everything except for the from clause
+      char[] sansFrom = ejbql.toCharArray();
+      clear(sansFrom, fromBeginIndex + 4, fromEndIndex);
+
+      // From clause
+      ReInit(new CharArrayReader(from));
+      ASTFrom fromNode = ParseFromClause();
+
+      // Everything else
+      ReInit(new CharArrayReader(sansFrom));
+      ASTEJBQL ejbqlNode = EJBQL();
+
+      // replace the dummy from clause in the EJBQL 
+      // node with the real from node
+      ejbqlNode.jjtAddChild(fromNode, 1);
+
+      return ejbqlNode;
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word)
+   {
+      return indexOf(ql, word, 0);
+   }
+
+   /**
+    * Returns the first index of the word (surrounded with whitespaces) in the string
+    * starting with startInd position or -1 if the word was not found.
+    */
+   private static final int indexOf(String ql, String word, int startInd)
+   {
+      int i = ql.indexOf(word, startInd);
+      if(i < 0)
+      {
+         return -1;
+      }
+
+      int qlLength = ql.length();
+      int wordLength = word.length();
+      while(i >= 0)
+      {
+         int endInd = i + wordLength;
+         if((i == 0 || Character.isWhitespace(ql.charAt(i - 1))) &&
+            (endInd == qlLength || endInd < qlLength && Character.isWhitespace(ql.charAt(endInd))))
+         {
+            break;
+         }
+
+         i = ql.indexOf(word, i + 1);
+      }
+      return i;
+   }
+
+   private static final int indexOfOrderBy(String ql)
+   {
+      int orderInd = indexOf(ql, "order", 0);
+      int byInd = -1;
+      while(orderInd > 0)
+      {
+         if(byInd < orderInd)
+         {
+            byInd = indexOf(ql, "by", orderInd + 5);
+         }
+
+         if(byInd > 0)
+         {
+            int i = byInd - 1;
+            while(i >= orderInd + 5 && Character.isWhitespace(ql.charAt(i--)));
+            if(i == orderInd + 4)
+            {
+               break;
+            }
+            else
+            {
+               orderInd = indexOf(ql, "order", orderInd + 5);
+            }
+         }
+         else
+         {
+            orderInd = -1;
+         }
+      }
+      return orderInd;
+   }
+
+   private final void clear(char[] c, int beginIndex, int endIndex) {
+      for(int i=beginIndex; i < endIndex; i++) {
+         if(c[i]!='\r' && c[i]!='\n' && c[i]!='\t') {
+            c[i] = ' ';
+         }
+      }
+   }
+
+   private final void initPathNode(ASTPath pathNode, String path, int type) {
+      pathNode.pathList = idManager.getPathList(path);
+      pathNode.fieldList = idManager.getFieldList(path);
+      pathNode.type = type;
+   }
+
+   private final void initParameterNode(
+         ASTParameter parameterNode,
+         String number,
+         int type) {
+         
+      parameterNode.number = Integer.parseInt(number);
+      parameterNode.type = type;
+   }
+}
+
+PARSER_END(EJBQLParser)
+
+ASTEJBQL EJBQL() #EJBQL :
+{}
+{
+   SelectClause() FromKeyword() [WhereClause()] [OrderByClause()] <EOF>
+   { return jjtThis; }
+}
+
+ASTOrderBy OrderByClause() #OrderBy :
+{}
+{
+   <ORDER> <BY> OrderByPathExpression() ( <COMMA> OrderByPathExpression() ) *
+   { return jjtThis; }
+}
+
+void OrderByPathExpression() #OrderByPath :
+{}
+{
+   ( NumericValuedPath() | StringValuedPath() | DatetimeValuedPath() )
+      [<ASC> | <DESC> { jjtThis.ascending=false; } ]
+}
+
+void FromKeyword() #From :
+{}
+{
+   <FROM>
+}
+
+ASTFrom ParseFromClause() #void :
+{ ASTFrom node; }
+{
+   node = FromClause() <EOF>
+   { return node; }
+}
+
+ASTFrom FromClause() #From :
+{}
+{
+   (
+      <FROM> IdentificationVariableDeclaration() 
+         ( <COMMA> IdentificationVariableDeclaration() )*
+   ) { return jjtThis; }
+}
+
+void IdentificationVariableDeclaration() #void :
+{}
+{
+   (CollectionMemberDeclaration() | RangeVariableDeclaration())
+}
+
+void CollectionMemberDeclaration() :
+{
+   Token path;
+   Token id;
+}
+{
+   ( <IN> <LPAREN> path=CollectionValuedPath() <RPAREN>
+      [<AS>] id=Identifier() )
+      { idManager.declareCollectionMember(id.image, path.image); }
+}
+
+void RangeVariableDeclaration() :
+{
+   Token schema;
+   Token id;
+}
+{
+   ( schema=AbstractSchema() [<AS>] id=Identifier() )
+      { idManager.declareRangeVariable(id.image, schema.image); }
+}
+
+ASTSelect SelectClause() #Select :
+{}
+{
+   (
+      <SELECT> [<DISTINCT> { jjtThis.distinct=true; }] 
+      ( 
+         <OBJECT> <LPAREN> IdentificationVariable() <RPAREN> |
+         SelectExpression()
+      )
+   ) { return jjtThis; }
+}
+
+void SelectExpression() #void :
+{}
+{
+   SingleValuedPath() | AggregateSelectExpression()
+}
+
+ASTWhere WhereClause() #Where :
+{}
+{
+   <WHERE> WhereExpression()
+   { return jjtThis; }
+}
+
+//
+// ASTWhereExpression and ASTWhereConditionalTerm mimic
+// ConditionalExpression and ConditionalTerm.
+// They are added to support joins per WhereConditionalTerm.
+//
+void WhereExpression() #void :
+{}
+{
+   (
+      WhereConditionalTerm() ( <OR> WhereConditionalTerm() )*
+   ) #Or(>1)
+}
+
+ASTWhereConditionalTerm WhereConditionalTerm() #WhereConditionalTerm :
+{}
+{
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   ) #And(>1)
+   {return jjtThis;}
+}
+
+void ConditionalExpression() #void :
+{}
+{
+   (
+      ConditionalTerm() ( <OR> ConditionalTerm() )*
+   ) #Or(>1)
+}
+
+void ConditionalTerm() #void :
+{}
+{
+   (
+      ConditionalFactor() ( <AND> ConditionalFactor() )*
+   ) #And(>1)
+}
+   
+void ConditionalFactor() #void :
+{ boolean not = false; }
+{
+   (
+      [<NOT>{ not=true; }] ConditionalTest()
+   ) #Not(not)
+}
+
+void ConditionalTest() #void :
+{}
+{
+   ConditionalPrimary()
+}
+
+void ConditionalPrimary() #void :
+{}
+{
+   LOOKAHEAD(<LPAREN> ConditionalExpression() <RPAREN>)
+      (<LPAREN> ConditionalExpression() <RPAREN>) #ConditionalParenthetical 
+|
+   SimpleCondExpression()
+}
+
+void SimpleCondExpression() #void :
+{}
+{
+   EmptyCollectionComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IS })
+      NullComparisonExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==MEMBER || getToken(3).kind==MEMBER })
+      CollectionMemberExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==LIKE || getToken(3).kind==LIKE })
+      LikeExpression()
+|
+   LOOKAHEAD({ getToken(2).kind==IN || getToken(3).kind==IN })
+      InExpression()
+| 
+   ComparisonExpression()
+}
+
+void BetweenExpression() #Between :
+{}
+{
+   ArithmeticExpression() [<NOT> { jjtThis.not=true; } ] <BETWEEN> 
+      ArithmeticExpression() <AND> ArithmeticExpression()
+}
+
+void InExpression() #In :
+{}
+{
+   (StringExpression() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN> StringExpression() ( <COMMA> StringExpression() )* <RPAREN>)
+|
+   (ArithmeticPrimary() [<NOT> { jjtThis.not=true; } ] <IN>
+      <LPAREN>  ArithmeticPrimary() ( <COMMA> ArithmeticPrimary() )* <RPAREN>)
+}
+
+void LikeExpression() #Like :
+{}
+{
+   StringValuedPath() [<NOT> { jjtThis.not=true; } ] <LIKE>
+      StringExpression() [<ESCAPE> (StringLiteral() | NumericValuedParameter())]
+}
+
+void NullComparisonExpression() #NullComparison :
+{}
+{
+   (
+      SingleValuedPath() |
+      NumericValuedParameter() |
+      EntityValuedParameter() |
+      StringValuedParameter() |
+      DatetimeValuedParameter() |
+      BooleanValuedParameter()
+   )
+   <IS> [<NOT> { jjtThis.not=true; } ] <NULL>
+}
+
+void EmptyCollectionComparisonExpression() #IsEmpty :
+{}
+{
+   CollectionValuedPath() <IS> [<NOT> { jjtThis.not=true; } ] <EMPTY>
+}
+
+void CollectionMemberExpression() #MemberOf :
+{}
+{
+   (EntityValuedPath() |
+         IdentificationVariable() |
+         EntityValuedParameter())
+      [<NOT> { jjtThis.not=true; } ] <MEMBER> [<OF>] CollectionValuedPath()
+}
+
+
+void ComparisonExpression() #void :
+{}
+{
+   (
+      StringValue() 
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      StringExpression()
+   ) #StringComparison
+|
+   (
+      BooleanValue()
+      [
+         ( 
+            <EQ> { jjtThis.opp="="; } |
+            <NE> { jjtThis.opp="<>"; }
+         ) BooleanExpression()
+      ]
+   ) #BooleanComparison
+|
+   (
+      DatetimeValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <LT> { jjtThis.opp="<"; } |
+         <NE> { jjtThis.opp="<>"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LE> { jjtThis.opp="<="; }
+      )
+      DatetimeExpression()
+   ) #DatetimeComparison
+|
+   (
+      EntityBeanValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <NE> { jjtThis.opp="<>"; }
+      )
+      EntityBeanExpression()
+   ) #EntityComparison
+|
+   LOOKAHEAD(ArithmeticValue() ( <EQ> | <GT> | <GE> | <LT> | <LE> | <NE> ) )
+   ( 
+      ArithmeticValue()
+      (
+         <EQ> { jjtThis.opp="="; } |
+         <GT> { jjtThis.opp=">"; } |
+         <GE> { jjtThis.opp=">="; } |
+         <LT> { jjtThis.opp="<"; } |
+         <LE> { jjtThis.opp="<="; } |
+         <NE> { jjtThis.opp="<>"; } 
+      )
+      SingleValueDesignator()
+   ) #ArithmeticComparison
+|
+   BetweenExpression() 
+}
+
+void ArithmeticValue() #void :
+{}
+{
+   NumericValuedPath() | FunctionsReturningNumerics()
+}
+
+void SingleValueDesignator() #void :
+{}
+{
+   ScalarExpression()
+}
+
+void ScalarExpression() #void :
+{}
+{
+   ArithmeticExpression()
+}
+
+void ArithmeticExpression() #void :
+{}
+{
+   (
+      ArithmeticTerm()
+      (
+         (
+            <PLUS> { jjtThis.addOpp("+"); } |
+            <MINUS> { jjtThis.addOpp("-"); }
+         ) ArithmeticTerm()
+      )*
+   ) #PlusMinus(>1)
+}
+
+void ArithmeticTerm() #void :
+{}
+{
+   (
+      ArithmeticFactor() 
+      (
+         (
+            <MULT> { jjtThis.addOpp("*"); } |
+            <DIV> { jjtThis.addOpp("/"); }
+         ) ArithmeticFactor()
+      )*
+   ) #MultDiv(>1)
+}
+
+void ArithmeticFactor() #void :
+{ boolean negation = false; }
+{
+   (
+      [<PLUS>|<MINUS>{negation=true;}] ArithmeticPrimary()
+   ) #Negation(negation)
+}
+
+void ArithmeticPrimary() #void :
+{}
+{
+   NumericValuedPath() |
+   NumericLiteral() |
+   (<LPAREN> ArithmeticExpression() <RPAREN>) #ArithmeticParenthetical |
+   NumericValuedParameter() |
+   FunctionsReturningNumerics()
+}
+
+void StringValue() #void :
+{}
+{
+   StringValuedPath() | FunctionsReturningStrings()
+}
+
+void StringExpression() #void :
+{}
+{
+   StringPrimary() | StringValuedParameter() 
+}
+
+void StringPrimary() #void :
+{}
+{
+   StringValuedPath() |
+   StringLiteral() | 
+   (<LPAREN> StringExpression() <RPAREN>) #StringParenthetical |
+   FunctionsReturningStrings()
+}
+
+void DatetimeValue() #void :
+{}
+{
+   DatetimeValuedPath() 
+}
+
+void DatetimeExpression() #void :
+{}
+{
+   DatetimeValue() | DatetimeValuedParameter() 
+}
+
+void BooleanValue() #void :
+{}
+{
+   BooleanValuedPath() 
+}
+
+void BooleanExpression() #void :
+{}
+{
+   BooleanValue() | BooleanValuedParameter() | BooleanLiteral()
+}
+
+void EntityBeanValue() #void :
+{}
+{
+   EntityValuedPath() | IdentificationVariable()
+}
+
+void EntityBeanExpression() #void :
+{}
+{
+   EntityBeanValue() | EntityValuedParameter() 
+}
+
+void FunctionsReturningStrings() #void :
+{}
+{
+   (
+      <CONCAT> <LPAREN> StringExpression() <COMMA> StringExpression() <RPAREN>
+   ) #Concat
+|
+   (
+      <SUBSTRING> <LPAREN> 
+         StringExpression() <COMMA>
+         ArithmeticExpression() <COMMA>
+         ArithmeticExpression() <RPAREN>
+   ) #Substring
+}
+
+void FunctionsReturningNumerics() #void :
+{}
+{
+   (
+      <LENGTH> <LPAREN> StringExpression() <RPAREN> 
+   ) #Length
+|
+   (
+      <LOCATE> <LPAREN> 
+            StringExpression() <COMMA> StringExpression()
+            [ <COMMA> ArithmeticExpression()] <RPAREN>
+   ) #Locate
+|
+   (
+      <ABS> <LPAREN> ArithmeticExpression() <RPAREN> 
+   ) #Abs
+|
+   (
+      <SQRT> <LPAREN> ArithmeticExpression() <RPAREN>
+   ) #Sqrt
+|
+   (
+      <MOD> <LPAREN> ArithmeticExpression() <COMMA> ArithmeticExpression() <RPAREN>
+   ) #Mod
+}
+
+Token CollectionValuedPath() #Path :
+{ Token t; }
+{
+   t=<COLLECTION_VALUED_PATH> 
+   { 
+      initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); 
+      return t;
+   }
+}
+
+Token IdentificationVariable() #Path :
+{ Token t; }
+{
+   t=<IDENTIFICATION_VARIABLE> 
+   { 
+      t.image = t.image.toLowerCase();
+      initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); 
+      return t;
+   }
+}
+
+Token AbstractSchema() #AbstractSchema :
+{ Token t; }
+{
+   t=<ABSTRACT_SCHEMA> 
+   { 
+      jjtThis.abstractSchemaName = t.image;
+      jjtThis.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t; 
+   }
+   |
+   t=<ORDER>
+   {
+      jjtThis.abstractSchemaName = t.image;
+      jjtThis.entity = catalog.getEntityByAbstractSchemaName(t.image);
+      return t;
+   }
+}
+
+Token Identifier() #Identifier :
+{ Token t; }
+{
+   t=<IDENTIFIER> 
+   { 
+      t.image = t.image.toLowerCase();
+      jjtThis.identifier = t.image;
+      return t; 
+   }
+}
+
+void SingleValuedPath() #void :
+{}
+{
+   NumericValuedPath()
+|  StringValuedPath()
+|  DatetimeValuedPath()
+|  BooleanValuedPath()
+|  EntityValuedPath()
+|  ValueClassValuedPath()
+}
+
+void NumericValuedPath() #Path :
+{ Token t; }
+{
+   t=<NUMERIC_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.NUMERIC_TYPE); }
+}
+
+void StringValuedPath() #Path :
+{ Token t; }
+{
+   t=<STRING_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.STRING_TYPE); }
+}
+
+void DatetimeValuedPath() #Path :
+{ Token t; }
+{
+   t=<DATETIME_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.DATETIME_TYPE); }
+}
+
+void BooleanValuedPath() #Path :
+{ Token t; }
+{
+   t=<BOOLEAN_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.BOOLEAN_TYPE); }
+}
+
+void EntityValuedPath() #Path :
+{ Token t; }
+{
+   t=<ENTITY_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); }
+}
+
+void ValueClassValuedPath() #Path :
+{ Token t; }
+{
+   t=<VALUE_CLASS_VALUED_PATH> 
+   { initPathNode(jjtThis, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }
+}
+
+void NumericValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<NUMERIC_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.NUMERIC_TYPE); }
+}
+
+void StringValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<STRING_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.STRING_TYPE); }
+}
+
+void DatetimeValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<DATETIME_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.DATETIME_TYPE); }
+}
+
+void BooleanValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<BOOLEAN_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.BOOLEAN_TYPE); }
+}
+
+void EntityValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<ENTITY_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.ENTITY_TYPE); }
+}
+
+void ValueClassValuedParameter() #Parameter :
+{ Token t; }
+{
+   t=<VALUE_CLASS_VALUED_PARAMETER> 
+   { initParameterNode(jjtThis, t.image, EJBQLTypes.VALUE_CLASS_TYPE); }
+}
+
+void NumericLiteral() #void :
+{ Token t; }
+{
+   (
+      t=<INTEGER_LITERAL> { jjtThis.setValue(t.image); }
+   ) #ExactNumericLiteral
+| 
+   (
+      t=<FLOATING_POINT_LITERAL> { jjtThis.setValue(t.image); }
+   ) #ApproximateNumericLiteral
+}
+
+void StringLiteral() #StringLiteral :
+{ Token t; }
+{
+   t=<STRING_LITERAL> 
+   { jjtThis.value=t.image; }
+}
+
+void BooleanLiteral() #BooleanLiteral :
+{ Token t; }
+{
+   <TRUE> { jjtThis.value=true; } | <FALSE> { jjtThis.value=false; } 
+}
+
+void AggregateSelectExpression() #void:
+{}
+{
+   (
+      <AVG> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Avg
+|
+   (
+      <MAX> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Max
+|
+   (
+      <MIN> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Min
+|
+   (
+      <SUM> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}] SingleValuedPath() <RPAREN>
+   ) #Sum
+|
+   (
+      <COUNT> <LPAREN> [<DISTINCT> {jjtThis.distinct="DISTINCT";}]
+      (
+         SingleValuedPath() | EntityBeanValue()
+      )
+      <RPAREN>
+   ) #Count
+}
+
+/////////////////////////
+//  Tokens
+/////////////////////////
+
+TOKEN_MGR_DECLS :
+{
+   public Catalog catalog;
+   public Class[] argumentTypes;
+   public IdentifierManager idManager;
+
+   // used for navigation building
+   private List pathList;
+   private List fieldList;
+   private String path;
+
+   private void resetPath() {
+      path = "";
+      pathList = new ArrayList();
+      fieldList = new ArrayList();
+   }
+   
+   private void throwUnknownPath(
+         String reason,
+         String fieldName) {
+
+      throw new UnknownPathException(
+            reason,
+            path,
+            fieldName,
+            input_stream.getEndLine(),
+            input_stream.getEndColumn());
+   }
+   
+   private void addPath(String nav) {
+      String fieldName = nav.substring(0, nav.length()-1);
+      if(fieldList.size() > 0) {
+         FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+         if(field == null) {
+            throwUnknownPath("Unknown cmr field in path", fieldName);
+         }
+         if(!(field instanceof CMRFieldBridge)) {
+            throwUnknownPath("In path field is not a cmr field", fieldName);
+         }
+
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(!cmrField.isSingleValued()) {
+            throwUnknownPath("In path cmr field is collection valued",
+                  fieldName);
+         }
+         fieldList.add(cmrField);
+      } else {
+         EntityBridge entityBridge = idManager.getEntity(fieldName);
+         if(entityBridge == null) {
+            throwUnknownPath("Unknown initial identifier", fieldName);
+         }
+         fieldList.add(entityBridge);
+      }
+      pathList.add(path + fieldName);
+      path += nav;
+   }
+
+   private EntityBridge getCurrentSchema() {
+      Object lastElement = fieldList.get(fieldList.size()-1);
+      if(lastElement instanceof EntityBridge) {
+         return (EntityBridge)lastElement;
+      } else if(lastElement instanceof CMRFieldBridge) {
+         return ((CMRFieldBridge)lastElement).getRelatedEntity();
+      }
+      // should never happen
+      throw new IllegalStateException("Unknown path element type: " +
+            lastElement);
+   }
+}
+
+<DEFAULT> SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* RESERVED WORDS */
+{
+   < ABS: "ABS" >
+|  < AND: "AND" >
+|  < AS: "AS" >
+|  < BETWEEN: "BETWEEN" >
+|  < CONCAT: "CONCAT" >
+|  < DISTINCT: "DISTINCT" >
+|  < EMPTY: "EMPTY" >
+|  < ESCAPE: "ESCAPE" >
+|  < FROM: "FROM" >
+|  < IN: "IN" >
+|  < IS: "IS" >
+|  < LENGTH: "LENGTH" >
+|  < LIKE: "LIKE" >
+|  < LOCATE: "LOCATE" >
+|  < NOT: "NOT" >
+|  < NULL: "NULL" >
+|  < OBJECT: "OBJECT" >
+|  < OF: "OF " >
+|  < OR: "OR" >
+|  < SELECT: "SELECT" >
+|  < SUBSTRING: "SUBSTRING" >
+|  < SQRT: "SQRT" >
+|  < UNKNOWN: "UNKNOWN" >
+|  < WHERE: "WHERE" >
+|  < MEMBER: "MEMBER" >
+
+// EJB QL 2.1 tokens
+
+|  < ORDER: "ORDER" >
+|  < BY: "BY" >
+|  < ASC: "ASC" >
+|  < DESC: "DESC" >
+|  < COUNT: "COUNT" >
+|  < MAX: "MAX" >
+|  < MIN: "MIN" >
+|  < AVG: "AVG" >
+|  < SUM: "SUM" >
+|  < MOD: "MOD" >
+}
+
+<DEFAULT> TOKEN : /* SEPARATORS */
+{
+  < LPAREN: "(" >
+| < RPAREN: ")" >
+| < COMMA: "," >
+| < DOT: "." >
+}
+
+<DEFAULT> TOKEN : /* OPERATORS */
+{
+  < GT: ">" >
+| < LT: "<" >
+| < EQ: "=" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "<>" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < MULT: "*" >
+| < DIV: "/" >
+}
+
+<DEFAULT> TOKEN : /* String Literal */
+{
+   < STRING_LITERAL: "'" (~["'"])* ( "''" (~["'"])* )* "'" >
+}
+
+<DEFAULT> TOKEN : /* Numeric Literal */
+{
+   < INTEGER_LITERAL:
+      <DECIMAL_LITERAL> (["l","L"])?
+      | <HEX_LITERAL> (["l","L"])?
+      | <OCTAL_LITERAL> (["l","L"])?
+   >
+|
+   < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+   < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+   < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+   < FLOATING_POINT_LITERAL:
+      (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+   >
+|
+   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : /* Boolean Literal */
+{
+   < FALSE: "FALSE" >
+|  < TRUE: "TRUE" >
+}
+
+<DEFAULT> TOKEN : /* IDENTIFIERS */
+{
+   < IDENTIFIER: <NAME> >
+   {
+      if(catalog.getEntityByAbstractSchemaName(matchedToken.image) != null) {
+         matchedToken.kind = ABSTRACT_SCHEMA;
+      } else if(idManager.getEntity(matchedToken.image.toLowerCase()) != null) {
+         matchedToken.kind = IDENTIFICATION_VARIABLE;
+         matchedToken.image = matchedToken.image.toLowerCase();
+
+         List pathList = new ArrayList();
+         pathList.add(matchedToken.image);
+         List fieldList = new ArrayList();
+         fieldList.add(idManager.getEntity(matchedToken.image));
+         idManager.registerPath(matchedToken.image, pathList, fieldList);
+      }
+   }
+|
+   < ABSTRACT_SCHEMA: [] >
+|
+   < IDENTIFICATION_VARIABLE: [] >
+|
+   < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+   < #LETTER:
+      [
+       "\u0024",
+       "\u0041"-"\u005a",
+       "\u005f",
+       "\u0061"-"\u007a",
+       "\u00c0"-"\u00d6",
+       "\u00d8"-"\u00f6",
+       "\u00f8"-"\u00ff",
+       "\u0100"-"\u1fff",
+       "\u3040"-"\u318f",
+       "\u3300"-"\u337f",
+       "\u3400"-"\u3d2d",
+       "\u4e00"-"\u9fff",
+       "\uf900"-"\ufaff"
+      ]
+   >
+|
+   < #DIGIT:
+      [
+       "\u0030"-"\u0039",
+       "\u0660"-"\u0669",
+       "\u06f0"-"\u06f9",
+       "\u0966"-"\u096f",
+       "\u09e6"-"\u09ef",
+       "\u0a66"-"\u0a6f",
+       "\u0ae6"-"\u0aef",
+       "\u0b66"-"\u0b6f",
+       "\u0be7"-"\u0bef",
+       "\u0c66"-"\u0c6f",
+       "\u0ce6"-"\u0cef",
+       "\u0d66"-"\u0d6f",
+       "\u0e50"-"\u0e59",
+       "\u0ed0"-"\u0ed9",
+       "\u1040"-"\u1049"
+      ]
+   >
+}
+
+<DEFAULT> TOKEN : /* PARAMETERS */
+{
+   < UNKNOWN_PARAMETER: "?" <INTEGER_LITERAL> >
+   {
+      int n = EJBQLTypes.UNKNOWN_TYPE;
+      try { 
+         n = Integer.parseInt(matchedToken.image.substring(1, lengthOfMatch));
+      } catch(Exception e) { /* Should never come here. */ }
+      
+      matchedToken.image = "" + n;
+
+      // zero base the index
+      n--;   
+      
+      if(n < argumentTypes.length) {
+         switch(EJBQLTypes.getEJBQLType(argumentTypes[n])) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PARAMETER;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PARAMETER;
+               break;
+         }
+      }
+   }
+|  < NUMERIC_VALUED_PARAMETER: [] >
+|  < STRING_VALUED_PARAMETER: [] >
+|  < DATETIME_VALUED_PARAMETER: [] >
+|  < BOOLEAN_VALUED_PARAMETER: [] >
+|  < ENTITY_VALUED_PARAMETER: [] >
+|  < VALUE_CLASS_VALUED_PARAMETER: [] >
+}
+
+/**
+ * WARNING: Be careful here. If look ahead is to high in the from clause, it
+ * is possible that the identification varible is not registered before it
+ * is used here.
+ */
+<DEFAULT> SPECIAL_TOKEN :  /* Navigation */
+{
+   < <NAME> <DOT> > { 
+      resetPath();
+      addPath(matchedToken.image.toLowerCase()); 
+   } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> SPECIAL_TOKEN :
+{
+   < <NAME> <DOT> > { addPath(matchedToken.image); } : IN_NAVIGATION
+}
+
+<IN_NAVIGATION> TOKEN :
+{
+   < PART: <NAME> > {
+      String fieldName = matchedToken.image;
+      matchedToken.image = path + fieldName;
+
+      FieldBridge field = getCurrentSchema().getFieldByName(fieldName);
+      if(field == null) {
+         throwUnknownPath("Unknown terminal field", fieldName);
+      }
+      if(field instanceof CMPFieldBridge) {
+         CMPFieldBridge cmpField = (CMPFieldBridge)field;
+         switch(EJBQLTypes.getEJBQLType(cmpField.getFieldType())) {
+            case EJBQLTypes.NUMERIC_TYPE:
+               matchedToken.kind = NUMERIC_VALUED_PATH;
+               break;
+            case EJBQLTypes.STRING_TYPE:
+               matchedToken.kind = STRING_VALUED_PATH;
+               break;
+            case EJBQLTypes.DATETIME_TYPE:
+               matchedToken.kind = DATETIME_VALUED_PATH;
+               break;
+            case EJBQLTypes.BOOLEAN_TYPE:
+               matchedToken.kind = BOOLEAN_VALUED_PATH;
+               break;
+            case EJBQLTypes.ENTITY_TYPE:
+               matchedToken.kind = ENTITY_VALUED_PATH;
+               break;
+            case EJBQLTypes.VALUE_CLASS_TYPE:
+               matchedToken.kind = VALUE_CLASS_VALUED_PATH;
+               break;
+            default:
+               throwUnknownPath("Unknown cmp field type", fieldName);
+         }
+      } else {
+         CMRFieldBridge cmrField = (CMRFieldBridge)field;
+         if(cmrField.isSingleValued()) {
+            matchedToken.kind = ENTITY_VALUED_PATH;
+         } else {
+            matchedToken.kind = COLLECTION_VALUED_PATH;
+         }
+      }
+      pathList.add(matchedToken.image);
+      fieldList.add(field);
+      idManager.registerPath(matchedToken.image, pathList, fieldList);
+      resetPath();
+   } : DEFAULT
+|  < NUMERIC_VALUED_PATH: [] >
+|  < STRING_VALUED_PATH: [] >
+|  < DATETIME_VALUED_PATH: [] >
+|  < BOOLEAN_VALUED_PATH: [] >
+|  < ENTITY_VALUED_PATH: [] >
+|  < VALUE_CLASS_VALUED_PATH: [] >
+|  < UNKNOWN_PATH: [] >
+|  < COLLECTION_VALUED_PATH: [] >
+}  
+
+

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/site/site.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/site/site.xml	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/site/site.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,29 @@
+<project name="Maven Build Test">
+  <bannerLeft>
+    <name>Maven Build Test</name>
+    <href>http://www.jboss.org/jboss-build</href>
+  </bannerLeft>
+  <bannerRight>
+    <name>JBoss.org</name>
+    <src>http://www.jboss.org/junk</src>
+  </bannerRight>
+  <skin>
+    <groupId>org.jboss.maven.skins</groupId>
+    <artifactId>maven-jboss-default-skin</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </skin>
+  <publishDate format="dd MMM yyyy" />
+  <body>
+    <links>
+      <item name="JBoss" href="http://www.randomsite.org/"/>
+      <item name="Maven" href="http://maven.apache.org/"/>
+    </links>
+    <head>
+      <meta name="faq" content="proficio"/>
+    </head>
+    <menu name="Quick Links">
+      <item name="Features" href="/maven-features.html"/>
+    </menu>
+    ${reports}
+  </body>
+</project>


Property changes on: labs/jbossbuild/maven-build-test/trunk/module1/src/site/site.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTeller.java
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTeller.java	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTeller.java	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,16 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.build.module1;
+
+public class FortuneTeller
+{
+
+   public String generateFortune() {
+      return "You might not have a nice day.";
+   }
+
+}


Property changes on: labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTeller.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTellerTestCase.java
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTellerTestCase.java	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTellerTestCase.java	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,20 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.build.module1;
+
+import junit.framework.TestCase;
+
+
+public class FortuneTellerTestCase extends TestCase
+{
+   public void testFortuneTeller() {
+      FortuneTeller teller = new FortuneTeller();
+      //assertEquals("You might not have a nice day.", teller.generateFortune());
+      //assertEquals("You will have a nice day.", teller.generateFortune());
+   }
+
+}


Property changes on: labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/FortuneTellerTestCase.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/PropertiesTestCase.java
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/PropertiesTestCase.java	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/PropertiesTestCase.java	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.build.module1;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+public class PropertiesTestCase extends TestCase
+{
+   public void testProperties() {
+      Properties props = new Properties();
+      try {
+         InputStream propsIS = getClass().getResourceAsStream("junk.properties");
+         props.load(propsIS);
+      } catch (IOException ioe) {
+         ioe.printStackTrace();
+      }
+      Enumeration en = props.keys();
+      while (en.hasMoreElements()) {
+         Object key = en.nextElement();
+         //System.out.println(key + " : " + props.getProperty(key.toString()));
+      }
+   }
+}


Property changes on: labs/jbossbuild/maven-build-test/trunk/module1/src/test/java/org/jboss/build/module1/PropertiesTestCase.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/module1/junk.properties
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/module1/junk.properties	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/module1/junk.properties	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,35 @@
+classPathUrl.34 : /home/pgier/.m2/repository/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar
+classPathUrl.33 : /home/pgier/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
+classPathUrl.32 : /home/pgier/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
+classPathUrl.31 : /home/pgier/.m2/repository/org/apache/maven/maven-plugin-descriptor/2.0.6/maven-plugin-descriptor-2.0.6.jar
+classPathUrl.30 : /home/pgier/.m2/repository/antlr/antlr/2.7.5/antlr-2.7.5.jar
+classPathUrl.29 : /home/pgier/.m2/repository/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.jar
+classPathUrl.28 : /home/pgier/.m2/repository/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar
+classPathUrl.27 : /home/pgier/.m2/repository/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug2000r7-dev.jar
+classPathUrl.26 : /home/pgier/.m2/repository/org/apache/maven/maven-error-diagnostics/2.0.6/maven-error-diagnostics-2.0.6.jar
+classPathUrl.25 : /home/pgier/.m2/repository/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.jar
+classPathUrl.24 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-file/1.0-beta-2/wagon-file-1.0-beta-2.jar
+classPathUrl.23 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-ssh-external/1.0-beta-2/wagon-ssh-external-1.0-beta-2.jar
+classPathUrl.22 : /home/pgier/.m2/repository/org/apache/maven/maven-plugin-parameter-documenter/2.0.6/maven-plugin-parameter-documenter-2.0.6.jar
+classPathUrl.21 : /home/pgier/.m2/repository/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.jar
+classPathUrl.20 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-http-lightweight/1.0-beta-2/wagon-http-lightweight-1.0-beta-2.jar
+classPathUrl.19 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar
+classPathUrl.18 : /home/pgier/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar
+classPathUrl.17 : /home/pgier/.m2/repository/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.jar
+classPathUrl.16 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-ssh/1.0-beta-2/wagon-ssh-1.0-beta-2.jar
+classPathUrl.15 : /home/pgier/.m2/repository/com/jcraft/jsch/0.1.27/jsch-0.1.27.jar
+classPathUrl.14 : /home/pgier/.m2/repository/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar
+classPathUrl.13 : /home/pgier/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
+classPathUrl.12 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-http-shared/1.0-beta-2/wagon-http-shared-1.0-beta-2.jar
+classPathUrl.11 : /home/pgier/.m2/repository/org/apache/maven/maven-monitor/2.0.6/maven-monitor-2.0.6.jar
+classPathUrl.10 : /home/pgier/.m2/repository/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar
+classPathUrl.9 : /home/pgier/.m2/repository/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.jar
+classPathUrl.8 : /home/pgier/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
+classPathUrl.7 : /home/pgier/.m2/repository/classworlds/classworlds/1.1/classworlds-1.1.jar
+classPathUrl.6 : /home/pgier/.m2/repository/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.jar
+classPathUrl.5 : /home/pgier/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar
+classPathUrl.4 : /home/pgier/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
+classPathUrl.3 : /home/pgier/.m2/repository/org/apache/maven/wagon/wagon-ssh-common/1.0-beta-2/wagon-ssh-common-1.0-beta-2.jar
+classPathUrl.2 : /home/pgier/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
+classPathUrl.1 : /home/pgier/projects/maven-build-test/module1/target/classes
+classPathUrl.0 : /home/pgier/projects/maven-build-test/module1/target/test-classes


Property changes on: labs/jbossbuild/maven-build-test/trunk/module1/src/test/resources/org/jboss/build/module1/junk.properties
___________________________________________________________________
Name: svn:executable
   + *

Modified: labs/jbossbuild/maven-build-test/trunk/module2/module2-2/pom.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/module2/module2-2/pom.xml	2007-10-22 13:46:07 UTC (rev 15980)
+++ labs/jbossbuild/maven-build-test/trunk/module2/module2-2/pom.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -69,11 +69,16 @@
     </repository>
   </repositories>
   <dependencies>
-    <!--<dependency>
+    <dependency>
       <groupId>org.jboss.maven.test</groupId>
       <artifactId>maven-build-test-module1</artifactId>
-      <version>1.0.5-SNAPSHOT</version>
-    </dependency>-->
+      <version>1.0.6-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>3.0b5</version>
+    </dependency>
   </dependencies>
   <properties>
     <antlrVersion>2.7.7</antlrVersion>

Added: labs/jbossbuild/maven-build-test/trunk/pom-alt.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/pom-alt.xml	                        (rev 0)
+++ labs/jbossbuild/maven-build-test/trunk/pom-alt.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -0,0 +1,253 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <!--<parent>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>3-SNAPSHOT</version>
+  </parent>-->
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.maven.test</groupId>
+  <artifactId>maven-build-test-parent</artifactId>
+  <packaging>pom</packaging>
+  <name>JBoss Build Test Parent Alternate</name>
+  <version>1.0.6-SNAPSHOT</version>
+  <description>A project to test the release and packaging features of maven</description>
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.jboss.com/jira/browse/JBBUILD</url>
+  </issueManagement>
+  <developers>
+    <developer>
+      <name>Paul Gier</name>
+      <id>pgier</id>
+      <email>pgier at redhat.com</email>
+      <organization>JBoss, a division of Red Hat, Inc.</organization>
+      <timezone>-5</timezone>
+    </developer>
+  </developers>
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/trunk</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/trunk</developerConnection>
+    <url>http://fisheye.jboss.org/repos/jbossbuild/trunk</url>
+  </scm>
+  <build>
+    <plugins>
+      <!--<plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources2</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+        <inherited>true</inherited>
+      </plugin>-->
+      <!--<plugin>
+        <groupId>org.jboss.maven.plugins</groupId>
+        <artifactId>maven-test-plugin</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>test</goal>
+            </goals>
+          </execution>
+        </executions>
+        <inherited>true</inherited>
+      </plugin>-->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>        
+        <artifactId>maven-release-plugin</artifactId>
+        <version>2.0-beta-5</version>          
+        <!--<configuration>
+          <tagBase>https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/tags</tagBase>
+        </configuration>-->
+      </plugin>
+      <!--<plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>1.0-alpha-3-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>enforce-versions</id>
+            <goals>
+               <goal>enforce-once</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireMavenVersion>
+                  <version>2.0.6</version>
+                </requireMavenVersion>
+                <requireJavaVersion>
+                  <version>1.6</version>
+                </requireJavaVersion>   
+                <requireProperty>
+                  <property>junk</property>
+                  <warning>Junk is not set, if you don't set this you are so dead!</warning>
+                </requireProperty>
+                <requireProperty>
+                  <property>another</property>
+                  <regex>[^abc]</regex>
+                </requireProperty>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+        <inherited>false</inherited>
+      </plugin>-->
+      <!--<plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <tagBase>https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/tags</tagBase>
+        </configuration>
+      </plugin>-->
+      <!--<plugin>
+        <groupId>jboss.maven-plugins</groupId>
+        <artifactId>jboss-deploy-maven-plugin</artifactId>
+        <version>1.3-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <phase>install</phase>
+            <goals>
+              <goal>jboss-deploy</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
+        </configuration>
+      </plugin>-->
+      <!--<plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>2.3-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>javadoc</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <aggregate>false</aggregate>
+          <links>
+            <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+          </links>
+          <minmemory>128m</minmemory>
+          <maxmemory>512</maxmemory>
+        </configuration>
+      </plugin>-->
+    </plugins>
+  </build>
+  <repositories>
+    <repository>
+      <id>jboss</id>
+      <name>JBoss Repository</name>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>jboss-snapshots</id>
+      <name>JBoss Snapshot Repository</name>
+      <url>http://snapshots.jboss.org/maven2/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>apache.snapshots</id>
+      <name>Maven snapshot repo</name>
+      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.org</id>
+      <name>Maven Snapshots</name>
+      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+  <profiles>
+    <profile>
+      <id>module3</id>
+      <modules>
+        <module>module3</module>
+      </modules>
+    </profile>
+    <profile>
+      <id>test-plugin</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>jboss.maven-plugins</groupId>
+            <artifactId>maven-test-plugin</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>test</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+  
+  <modules>
+    <module>module1</module>
+    <module>module2</module>
+  </modules>
+  <!--<reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>2.3-SNAPSHOT</version>
+        <configuration>
+          <aggregate>true</aggregate>
+          <links>
+            <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+          </links>
+          <minmemory>128m</minmemory>
+          <maxmemory>512</maxmemory>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>-->
+  <distributionManagement>
+    <repository>
+      <!-- Copy the distribution jar file to a local checkout of the maven repository 
+        -  This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+      <id>repository.jboss.org</id>
+      <url>file://${maven.repository.root}</url>
+    </repository>
+    <snapshotRepository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshot Repository</name>
+      <url>dav:https://snapshots.jboss.org/maven2</url>
+    </snapshotRepository>
+    <site>
+      <id>www.jboss.org</id>
+      <name>JBoss.org site freezone</name>
+      <url>file:///home/pgier/projects/jbossbuild-site/freezone</url>
+    </site>
+  </distributionManagement>
+  <!--<properties>
+    <junk>paul</junk>
+  </properties>-->
+</project>
\ No newline at end of file


Property changes on: labs/jbossbuild/maven-build-test/trunk/pom-alt.xml
___________________________________________________________________
Name: svn:executable
   + *

Modified: labs/jbossbuild/maven-build-test/trunk/pom.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/pom.xml	2007-10-22 13:46:07 UTC (rev 15980)
+++ labs/jbossbuild/maven-build-test/trunk/pom.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -11,6 +11,19 @@
   <name>JBoss Build Test Parent</name>
   <version>1.0.6-SNAPSHOT</version>
   <description>A project to test the release and packaging features of maven</description>
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.jboss.com/jira/browse/JBBUILD</url>
+  </issueManagement>
+  <developers>
+    <developer>
+      <name>Paul Gier</name>
+      <id>pgier</id>
+      <email>pgier at redhat.com</email>
+      <organization>JBoss, a division of Red Hat, Inc.</organization>
+      <timezone>-5</timezone>
+    </developer>
+  </developers>
   <scm>
     <connection>scm:svn:http://anonsvn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/trunk</connection>
     <developerConnection>scm:svn:https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-build-test/trunk</developerConnection>
@@ -18,7 +31,7 @@
   </scm>
   <build>
     <plugins>
-      <plugin>
+      <!--<plugin>
         <artifactId>maven-source-plugin</artifactId>
         <executions>
           <execution>
@@ -29,7 +42,7 @@
           </execution>
         </executions>
         <inherited>true</inherited>
-      </plugin>
+      </plugin>-->
       <!--<plugin>
         <groupId>org.jboss.maven.plugins</groupId>
         <artifactId>maven-test-plugin</artifactId>
@@ -228,6 +241,11 @@
       <name>JBoss Snapshot Repository</name>
       <url>dav:https://snapshots.jboss.org/maven2</url>
     </snapshotRepository>
+    <site>
+      <id>www.jboss.org</id>
+      <name>JBoss.org site freezone</name>
+      <url>file:///home/pgier/projects/jbossbuild-site/freezone</url>
+    </site>
   </distributionManagement>
   <!--<properties>
     <junk>paul</junk>

Modified: labs/jbossbuild/maven-build-test/trunk/src/site/site.xml
===================================================================
--- labs/jbossbuild/maven-build-test/trunk/src/site/site.xml	2007-10-22 13:46:07 UTC (rev 15980)
+++ labs/jbossbuild/maven-build-test/trunk/src/site/site.xml	2007-10-22 15:28:58 UTC (rev 15981)
@@ -9,7 +9,7 @@
   </bannerRight>
   <skin>
     <groupId>org.jboss.maven.skins</groupId>
-    <artifactId>maven-jboss-default-skin</artifactId>
+    <artifactId>maven-jbossorg-freezone-skin</artifactId>
     <version>0.0.1-SNAPSHOT</version>
   </skin>
   <publishDate format="dd MMM yyyy" />




More information about the jboss-svn-commits mailing list