[hibernate-commits] Hibernate SVN: r17224 - in core/branches/Branch_3_2_4_SP1_CP: src/org/hibernate/hql/ast and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Sun Aug 2 22:58:25 EDT 2009


Author: stliu
Date: 2009-08-02 22:58:24 -0400 (Sun, 02 Aug 2009)
New Revision: 17224

Added:
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlGeneratorBase.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.txt
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNotNullLogicOperatorNode.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNullLogicOperatorNode.java
Modified:
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/SqlASTFactory.java
   core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/UnaryLogicOperatorNode.java
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
Back-ported HHH-2826 for JBPAPP-2049 IS [NOT] NULL checks with component values

Added: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlGeneratorBase.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlGeneratorBase.java	                        (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlGeneratorBase.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -0,0 +1,3887 @@
+// $ANTLR 2.7.2: "sql-gen.g" -> "SqlGeneratorBase.java"$
+
+//   $Id: sql-gen.g 15746 2009-01-06 17:14:14Z cbredesen $
+package org.hibernate.hql.antlr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+import antlr.TreeParser;
+import antlr.Token;
+import antlr.collections.AST;
+import antlr.RecognitionException;
+import antlr.ANTLRException;
+import antlr.NoViableAltException;
+import antlr.MismatchedTokenException;
+import antlr.SemanticException;
+import antlr.collections.impl.BitSet;
+import antlr.ASTPair;
+import antlr.collections.impl.ASTArray;
+
+
+/**
+ * SQL Generator Tree Parser, providing SQL rendering of SQL ASTs produced by the previous phase, HqlSqlWalker.  All
+ * syntax decoration such as extra spaces, lack of spaces, extra parens, etc. should be added by this class.
+ * <br>
+ * This grammar processes the HQL/SQL AST and produces an SQL string.  The intent is to move dialect-specific
+ * code into a sub-class that will override some of the methods, just like the other two grammars in this system.
+ * @author Joshua Davis (joshua at hibernate.org)
+ */
+public class SqlGeneratorBase extends antlr.TreeParser       implements SqlTokenTypes
+ {
+
+	private static Log log = LogFactory.getLog(SqlGeneratorBase.class);
+
+   /** the buffer resulting SQL statement is written to */
+	private StringBuffer buf = new StringBuffer();
+
+	protected void out(String s) {
+		buf.append(s);
+	}
+
+	/**
+	 * Returns the last character written to the output, or -1 if there isn't one.
+	 */
+	protected int getLastChar() {
+		int len = buf.length();
+		if ( len == 0 )
+			return -1;
+		else
+			return buf.charAt( len - 1 );
+	}
+
+	/**
+	 * Add a aspace if the previous token was not a space or a parenthesis.
+	 */
+	protected void optionalSpace() {
+		// Implemented in the sub-class.
+	}
+
+	protected void out(AST n) {
+		out(n.getText());
+	}
+
+	protected void separator(AST n, String sep) {
+		if (n.getNextSibling() != null)
+			out(sep);
+	}
+
+	protected boolean hasText(AST a) {
+		String t = a.getText();
+		return t != null && t.length() > 0;
+	}
+
+	protected void fromFragmentSeparator(AST a) {
+		// moved this impl into the subclass...
+	}
+
+	protected void nestedFromFragment(AST d,AST parent) {
+		// moved this impl into the subclass...
+	}
+
+	protected StringBuffer getStringBuffer() {
+		return buf;
+	}
+
+	protected void nyi(AST n) {
+		throw new UnsupportedOperationException("Unsupported node: " + n);
+	}
+
+	protected void beginFunctionTemplate(AST m,AST i) {
+		// if template is null we just write the function out as it appears in the hql statement
+		out(i);
+		out("(");
+	}
+
+	protected void endFunctionTemplate(AST m) {
+	      out(")");
+	}
+
+	protected void commaBetweenParameters(String comma) {
+		out(comma);
+	}
+public SqlGeneratorBase() {
+	tokenNames = _tokenNames;
+}
+
+	public final void statement(AST _t) throws RecognitionException {
+		
+		AST statement_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case SELECT:
+			{
+				selectStatement(_t);
+				_t = _retTree;
+				break;
+			}
+			case UPDATE:
+			{
+				updateStatement(_t);
+				_t = _retTree;
+				break;
+			}
+			case DELETE:
+			{
+				deleteStatement(_t);
+				_t = _retTree;
+				break;
+			}
+			case INSERT:
+			{
+				insertStatement(_t);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void selectStatement(AST _t) throws RecognitionException {
+		
+		AST selectStatement_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t3 = _t;
+			AST tmp1_AST_in = (AST)_t;
+			match(_t,SELECT);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out("select ");
+			}
+			selectClause(_t);
+			_t = _retTree;
+			from(_t);
+			_t = _retTree;
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case WHERE:
+			{
+				AST __t5 = _t;
+				AST tmp2_AST_in = (AST)_t;
+				match(_t,WHERE);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(" where ");
+				}
+				whereExpr(_t);
+				_t = _retTree;
+				_t = __t5;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case 3:
+			case GROUP:
+			case ORDER:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case GROUP:
+			{
+				AST __t7 = _t;
+				AST tmp3_AST_in = (AST)_t;
+				match(_t,GROUP);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(" group by ");
+				}
+				groupExprs(_t);
+				_t = _retTree;
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case HAVING:
+				{
+					AST __t9 = _t;
+					AST tmp4_AST_in = (AST)_t;
+					match(_t,HAVING);
+					_t = _t.getFirstChild();
+					if ( inputState.guessing==0 ) {
+						out(" having ");
+					}
+					booleanExpr(_t,false);
+					_t = _retTree;
+					_t = __t9;
+					_t = _t.getNextSibling();
+					break;
+				}
+				case 3:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				_t = __t7;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case 3:
+			case ORDER:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ORDER:
+			{
+				AST __t11 = _t;
+				AST tmp5_AST_in = (AST)_t;
+				match(_t,ORDER);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(" order by ");
+				}
+				orderExprs(_t);
+				_t = _retTree;
+				_t = __t11;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			_t = __t3;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void updateStatement(AST _t) throws RecognitionException {
+		
+		AST updateStatement_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t13 = _t;
+			AST tmp6_AST_in = (AST)_t;
+			match(_t,UPDATE);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out("update ");
+			}
+			AST __t14 = _t;
+			AST tmp7_AST_in = (AST)_t;
+			match(_t,FROM);
+			_t = _t.getFirstChild();
+			fromTable(_t);
+			_t = _retTree;
+			_t = __t14;
+			_t = _t.getNextSibling();
+			setClause(_t);
+			_t = _retTree;
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case WHERE:
+			{
+				whereClause(_t);
+				_t = _retTree;
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			_t = __t13;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void deleteStatement(AST _t) throws RecognitionException {
+		
+		AST deleteStatement_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t17 = _t;
+			AST tmp8_AST_in = (AST)_t;
+			match(_t,DELETE);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out("delete");
+			}
+			from(_t);
+			_t = _retTree;
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case WHERE:
+			{
+				whereClause(_t);
+				_t = _retTree;
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			_t = __t17;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void insertStatement(AST _t) throws RecognitionException {
+		
+		AST insertStatement_AST_in = (AST)_t;
+		AST i = null;
+		
+		try {      // for error handling
+			AST __t20 = _t;
+			AST tmp9_AST_in = (AST)_t;
+			match(_t,INSERT);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out( "insert " );
+			}
+			i = (AST)_t;
+			match(_t,INTO);
+			_t = _t.getNextSibling();
+			if ( inputState.guessing==0 ) {
+				out( i ); out( " " );
+			}
+			selectStatement(_t);
+			_t = _retTree;
+			_t = __t20;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void selectClause(AST _t) throws RecognitionException {
+		
+		AST selectClause_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t48 = _t;
+			AST tmp10_AST_in = (AST)_t;
+			match(_t,SELECT_CLAUSE);
+			_t = _t.getFirstChild();
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ALL:
+			case DISTINCT:
+			{
+				distinctOrAll(_t);
+				_t = _retTree;
+				break;
+			}
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case SELECT:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CONSTRUCTOR:
+			case CASE2:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case SELECT_EXPR:
+			case SQL_NODE:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			{
+			int _cnt51=0;
+			_loop51:
+			do {
+				if (_t==null) _t=ASTNULL;
+				if ((_tokenSet_0.member(_t.getType()))) {
+					selectColumn(_t);
+					_t = _retTree;
+				}
+				else {
+					if ( _cnt51>=1 ) { break _loop51; } else {throw new NoViableAltException(_t);}
+				}
+				
+				_cnt51++;
+			} while (true);
+			}
+			_t = __t48;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void from(AST _t) throws RecognitionException {
+		
+		AST from_AST_in = (AST)_t;
+		AST f = null;
+		
+		try {      // for error handling
+			AST __t66 = _t;
+			f = _t==ASTNULL ? null :(AST)_t;
+			match(_t,FROM);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out(" from ");
+			}
+			{
+			_loop68:
+			do {
+				if (_t==null) _t=ASTNULL;
+				if ((_t.getType()==FROM_FRAGMENT||_t.getType()==JOIN_FRAGMENT)) {
+					fromTable(_t);
+					_t = _retTree;
+				}
+				else {
+					break _loop68;
+				}
+				
+			} while (true);
+			}
+			_t = __t66;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void whereExpr(AST _t) throws RecognitionException {
+		
+		AST whereExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case FILTERS:
+			{
+				filters(_t);
+				_t = _retTree;
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case THETA_JOINS:
+				{
+					if ( inputState.guessing==0 ) {
+						out(" and ");
+					}
+					thetaJoins(_t);
+					_t = _retTree;
+					break;
+				}
+				case 3:
+				case AND:
+				case BETWEEN:
+				case EXISTS:
+				case IN:
+				case LIKE:
+				case NOT:
+				case OR:
+				case IS_NOT_NULL:
+				case IS_NULL:
+				case NOT_BETWEEN:
+				case NOT_IN:
+				case NOT_LIKE:
+				case EQ:
+				case NE:
+				case LT:
+				case GT:
+				case LE:
+				case GE:
+				case SQL_TOKEN:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case AND:
+				case BETWEEN:
+				case EXISTS:
+				case IN:
+				case LIKE:
+				case NOT:
+				case OR:
+				case IS_NOT_NULL:
+				case IS_NULL:
+				case NOT_BETWEEN:
+				case NOT_IN:
+				case NOT_LIKE:
+				case EQ:
+				case NE:
+				case LT:
+				case GT:
+				case LE:
+				case GE:
+				case SQL_TOKEN:
+				{
+					if ( inputState.guessing==0 ) {
+						out(" and ");
+					}
+					booleanExpr(_t, true );
+					_t = _retTree;
+					break;
+				}
+				case 3:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				break;
+			}
+			case THETA_JOINS:
+			{
+				thetaJoins(_t);
+				_t = _retTree;
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case AND:
+				case BETWEEN:
+				case EXISTS:
+				case IN:
+				case LIKE:
+				case NOT:
+				case OR:
+				case IS_NOT_NULL:
+				case IS_NULL:
+				case NOT_BETWEEN:
+				case NOT_IN:
+				case NOT_LIKE:
+				case EQ:
+				case NE:
+				case LT:
+				case GT:
+				case LE:
+				case GE:
+				case SQL_TOKEN:
+				{
+					if ( inputState.guessing==0 ) {
+						out(" and ");
+					}
+					booleanExpr(_t, true );
+					_t = _retTree;
+					break;
+				}
+				case 3:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				break;
+			}
+			case AND:
+			case BETWEEN:
+			case EXISTS:
+			case IN:
+			case LIKE:
+			case NOT:
+			case OR:
+			case IS_NOT_NULL:
+			case IS_NULL:
+			case NOT_BETWEEN:
+			case NOT_IN:
+			case NOT_LIKE:
+			case EQ:
+			case NE:
+			case LT:
+			case GT:
+			case LE:
+			case GE:
+			case SQL_TOKEN:
+			{
+				booleanExpr(_t,false);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void groupExprs(AST _t) throws RecognitionException {
+		
+		AST groupExprs_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			expr(_t);
+			_t = _retTree;
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ALL:
+			case ANY:
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case SELECT:
+			case SOME:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case VECTOR_EXPR:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				if ( inputState.guessing==0 ) {
+					out(" , ");
+				}
+				groupExprs(_t);
+				_t = _retTree;
+				break;
+			}
+			case 3:
+			case HAVING:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void booleanExpr(AST _t,
+		 boolean parens 
+	) throws RecognitionException {
+		
+		AST booleanExpr_AST_in = (AST)_t;
+		AST st = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case AND:
+			case NOT:
+			case OR:
+			{
+				booleanOp(_t, parens );
+				_t = _retTree;
+				break;
+			}
+			case BETWEEN:
+			case EXISTS:
+			case IN:
+			case LIKE:
+			case IS_NOT_NULL:
+			case IS_NULL:
+			case NOT_BETWEEN:
+			case NOT_IN:
+			case NOT_LIKE:
+			case EQ:
+			case NE:
+			case LT:
+			case GT:
+			case LE:
+			case GE:
+			{
+				comparisonExpr(_t, parens );
+				_t = _retTree;
+				break;
+			}
+			case SQL_TOKEN:
+			{
+				st = (AST)_t;
+				match(_t,SQL_TOKEN);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(st);
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void orderExprs(AST _t) throws RecognitionException {
+		
+		AST orderExprs_AST_in = (AST)_t;
+		AST dir = null;
+		
+		try {      // for error handling
+			{
+			expr(_t);
+			_t = _retTree;
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ASCENDING:
+			case DESCENDING:
+			{
+				dir = _t==ASTNULL ? null : (AST)_t;
+				orderDirection(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" "); out(dir);
+				}
+				break;
+			}
+			case 3:
+			case ALL:
+			case ANY:
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case SELECT:
+			case SOME:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case VECTOR_EXPR:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ALL:
+			case ANY:
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case SELECT:
+			case SOME:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case VECTOR_EXPR:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				if ( inputState.guessing==0 ) {
+					out(", ");
+				}
+				orderExprs(_t);
+				_t = _retTree;
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void fromTable(AST _t) throws RecognitionException {
+		
+		AST fromTable_AST_in = (AST)_t;
+		AST a = null;
+		AST b = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case FROM_FRAGMENT:
+			{
+				AST __t70 = _t;
+				a = _t==ASTNULL ? null :(AST)_t;
+				match(_t,FROM_FRAGMENT);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(a);
+				}
+				{
+				_loop72:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_t.getType()==FROM_FRAGMENT||_t.getType()==JOIN_FRAGMENT)) {
+						tableJoin(_t, a );
+						_t = _retTree;
+					}
+					else {
+						break _loop72;
+					}
+					
+				} while (true);
+				}
+				if ( inputState.guessing==0 ) {
+					fromFragmentSeparator(a);
+				}
+				_t = __t70;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case JOIN_FRAGMENT:
+			{
+				AST __t73 = _t;
+				b = _t==ASTNULL ? null :(AST)_t;
+				match(_t,JOIN_FRAGMENT);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(b);
+				}
+				{
+				_loop75:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_t.getType()==FROM_FRAGMENT||_t.getType()==JOIN_FRAGMENT)) {
+						tableJoin(_t, b );
+						_t = _retTree;
+					}
+					else {
+						break _loop75;
+					}
+					
+				} while (true);
+				}
+				if ( inputState.guessing==0 ) {
+					fromFragmentSeparator(b);
+				}
+				_t = __t73;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void setClause(AST _t) throws RecognitionException {
+		
+		AST setClause_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t22 = _t;
+			AST tmp11_AST_in = (AST)_t;
+			match(_t,SET);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out(" set ");
+			}
+			comparisonExpr(_t,false);
+			_t = _retTree;
+			{
+			_loop24:
+			do {
+				if (_t==null) _t=ASTNULL;
+				if ((_tokenSet_1.member(_t.getType()))) {
+					if ( inputState.guessing==0 ) {
+						out(", ");
+					}
+					comparisonExpr(_t,false);
+					_t = _retTree;
+				}
+				else {
+					break _loop24;
+				}
+				
+			} while (true);
+			}
+			_t = __t22;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void whereClause(AST _t) throws RecognitionException {
+		
+		AST whereClause_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t26 = _t;
+			AST tmp12_AST_in = (AST)_t;
+			match(_t,WHERE);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out(" where ");
+			}
+			whereClauseExpr(_t);
+			_t = _retTree;
+			_t = __t26;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void comparisonExpr(AST _t,
+		 boolean parens 
+	) throws RecognitionException {
+		
+		AST comparisonExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case EQ:
+			case NE:
+			case LT:
+			case GT:
+			case LE:
+			case GE:
+			{
+				binaryComparisonExpression(_t);
+				_t = _retTree;
+				break;
+			}
+			case BETWEEN:
+			case EXISTS:
+			case IN:
+			case LIKE:
+			case IS_NOT_NULL:
+			case IS_NULL:
+			case NOT_BETWEEN:
+			case NOT_IN:
+			case NOT_LIKE:
+			{
+				if ( inputState.guessing==0 ) {
+					if (parens) out("(");
+				}
+				exoticComparisonExpression(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					if (parens) out(")");
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void whereClauseExpr(AST _t) throws RecognitionException {
+		
+		AST whereClauseExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			boolean synPredMatched29 = false;
+			if (((_t.getType()==SQL_TOKEN))) {
+				AST __t29 = _t;
+				synPredMatched29 = true;
+				inputState.guessing++;
+				try {
+					{
+					AST tmp13_AST_in = (AST)_t;
+					match(_t,SQL_TOKEN);
+					_t = _t.getNextSibling();
+					}
+				}
+				catch (RecognitionException pe) {
+					synPredMatched29 = false;
+				}
+				_t = __t29;
+				inputState.guessing--;
+			}
+			if ( synPredMatched29 ) {
+				conditionList(_t);
+				_t = _retTree;
+			}
+			else if ((_tokenSet_2.member(_t.getType()))) {
+				booleanExpr(_t, false );
+				_t = _retTree;
+			}
+			else {
+				throw new NoViableAltException(_t);
+			}
+			
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void conditionList(AST _t) throws RecognitionException {
+		
+		AST conditionList_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			sqlToken(_t);
+			_t = _retTree;
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case SQL_TOKEN:
+			{
+				if ( inputState.guessing==0 ) {
+					out(" and ");
+				}
+				conditionList(_t);
+				_t = _retTree;
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void expr(AST _t) throws RecognitionException {
+		
+		AST expr_AST_in = (AST)_t;
+		AST e = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				simpleExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			case VECTOR_EXPR:
+			{
+				AST __t116 = _t;
+				AST tmp14_AST_in = (AST)_t;
+				match(_t,VECTOR_EXPR);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("(");
+				}
+				{
+				_loop118:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_tokenSet_3.member(_t.getType()))) {
+						e = _t==ASTNULL ? null : (AST)_t;
+						expr(_t);
+						_t = _retTree;
+						if ( inputState.guessing==0 ) {
+							separator(e," , ");
+						}
+					}
+					else {
+						break _loop118;
+					}
+					
+				} while (true);
+				}
+				if ( inputState.guessing==0 ) {
+					out(")");
+				}
+				_t = __t116;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case SELECT:
+			{
+				parenSelect(_t);
+				_t = _retTree;
+				break;
+			}
+			case ANY:
+			{
+				AST __t119 = _t;
+				AST tmp15_AST_in = (AST)_t;
+				match(_t,ANY);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("any ");
+				}
+				quantified(_t);
+				_t = _retTree;
+				_t = __t119;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case ALL:
+			{
+				AST __t120 = _t;
+				AST tmp16_AST_in = (AST)_t;
+				match(_t,ALL);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("all ");
+				}
+				quantified(_t);
+				_t = _retTree;
+				_t = __t120;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case SOME:
+			{
+				AST __t121 = _t;
+				AST tmp17_AST_in = (AST)_t;
+				match(_t,SOME);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("some ");
+				}
+				quantified(_t);
+				_t = _retTree;
+				_t = __t121;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void orderDirection(AST _t) throws RecognitionException {
+		
+		AST orderDirection_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ASCENDING:
+			{
+				AST tmp18_AST_in = (AST)_t;
+				match(_t,ASCENDING);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case DESCENDING:
+			{
+				AST tmp19_AST_in = (AST)_t;
+				match(_t,DESCENDING);
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void filters(AST _t) throws RecognitionException {
+		
+		AST filters_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t42 = _t;
+			AST tmp20_AST_in = (AST)_t;
+			match(_t,FILTERS);
+			_t = _t.getFirstChild();
+			conditionList(_t);
+			_t = _retTree;
+			_t = __t42;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void thetaJoins(AST _t) throws RecognitionException {
+		
+		AST thetaJoins_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t44 = _t;
+			AST tmp21_AST_in = (AST)_t;
+			match(_t,THETA_JOINS);
+			_t = _t.getFirstChild();
+			conditionList(_t);
+			_t = _retTree;
+			_t = __t44;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void sqlToken(AST _t) throws RecognitionException {
+		
+		AST sqlToken_AST_in = (AST)_t;
+		AST t = null;
+		
+		try {      // for error handling
+			t = (AST)_t;
+			match(_t,SQL_TOKEN);
+			_t = _t.getNextSibling();
+			if ( inputState.guessing==0 ) {
+				out(t);
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void distinctOrAll(AST _t) throws RecognitionException {
+		
+		AST distinctOrAll_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case DISTINCT:
+			{
+				AST tmp22_AST_in = (AST)_t;
+				match(_t,DISTINCT);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out("distinct ");
+				}
+				break;
+			}
+			case ALL:
+			{
+				AST tmp23_AST_in = (AST)_t;
+				match(_t,ALL);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out("all ");
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void selectColumn(AST _t) throws RecognitionException {
+		
+		AST selectColumn_AST_in = (AST)_t;
+		AST p = null;
+		AST sc = null;
+		
+		try {      // for error handling
+			p = _t==ASTNULL ? null : (AST)_t;
+			selectExpr(_t);
+			_t = _retTree;
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case SELECT_COLUMNS:
+			{
+				sc = (AST)_t;
+				match(_t,SELECT_COLUMNS);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(sc);
+				}
+				break;
+			}
+			case 3:
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case SELECT:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CONSTRUCTOR:
+			case CASE2:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case SELECT_EXPR:
+			case SQL_NODE:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			if ( inputState.guessing==0 ) {
+				separator( (sc != null) ? sc : p,", ");
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void selectExpr(AST _t) throws RecognitionException {
+		
+		AST selectExpr_AST_in = (AST)_t;
+		AST e = null;
+		AST c = null;
+		AST param = null;
+		AST sn = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case DOT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case SELECT_EXPR:
+			{
+				e = _t==ASTNULL ? null : (AST)_t;
+				selectAtom(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(e);
+				}
+				break;
+			}
+			case COUNT:
+			{
+				count(_t);
+				_t = _retTree;
+				break;
+			}
+			case CONSTRUCTOR:
+			{
+				AST __t55 = _t;
+				AST tmp24_AST_in = (AST)_t;
+				match(_t,CONSTRUCTOR);
+				_t = _t.getFirstChild();
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case DOT:
+				{
+					AST tmp25_AST_in = (AST)_t;
+					match(_t,DOT);
+					_t = _t.getNextSibling();
+					break;
+				}
+				case IDENT:
+				{
+					AST tmp26_AST_in = (AST)_t;
+					match(_t,IDENT);
+					_t = _t.getNextSibling();
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				{
+				int _cnt58=0;
+				_loop58:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_tokenSet_0.member(_t.getType()))) {
+						selectColumn(_t);
+						_t = _retTree;
+					}
+					else {
+						if ( _cnt58>=1 ) { break _loop58; } else {throw new NoViableAltException(_t);}
+					}
+					
+					_cnt58++;
+				} while (true);
+				}
+				_t = __t55;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case METHOD_CALL:
+			{
+				methodCall(_t);
+				_t = _retTree;
+				break;
+			}
+			case AGGREGATE:
+			{
+				aggregate(_t);
+				_t = _retTree;
+				break;
+			}
+			case FALSE:
+			case TRUE:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			{
+				c = _t==ASTNULL ? null : (AST)_t;
+				constant(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(c);
+				}
+				break;
+			}
+			case CASE:
+			case CASE2:
+			case UNARY_MINUS:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			{
+				arithmeticExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			case PARAM:
+			{
+				param = (AST)_t;
+				match(_t,PARAM);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(param);
+				}
+				break;
+			}
+			case SQL_NODE:
+			{
+				sn = (AST)_t;
+				match(_t,SQL_NODE);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(sn);
+				}
+				break;
+			}
+			case SELECT:
+			{
+				if ( inputState.guessing==0 ) {
+					out("(");
+				}
+				selectStatement(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(")");
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void selectAtom(AST _t) throws RecognitionException {
+		
+		AST selectAtom_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case DOT:
+			{
+				AST tmp27_AST_in = (AST)_t;
+				match(_t,DOT);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case SQL_TOKEN:
+			{
+				AST tmp28_AST_in = (AST)_t;
+				match(_t,SQL_TOKEN);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case ALIAS_REF:
+			{
+				AST tmp29_AST_in = (AST)_t;
+				match(_t,ALIAS_REF);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case SELECT_EXPR:
+			{
+				AST tmp30_AST_in = (AST)_t;
+				match(_t,SELECT_EXPR);
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void count(AST _t) throws RecognitionException {
+		
+		AST count_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t60 = _t;
+			AST tmp31_AST_in = (AST)_t;
+			match(_t,COUNT);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out("count(");
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ALL:
+			case DISTINCT:
+			{
+				distinctOrAll(_t);
+				_t = _retTree;
+				break;
+			}
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case ROW_STAR:
+			case UNARY_MINUS:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			countExpr(_t);
+			_t = _retTree;
+			if ( inputState.guessing==0 ) {
+				out(")");
+			}
+			_t = __t60;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void methodCall(AST _t) throws RecognitionException {
+		
+		AST methodCall_AST_in = (AST)_t;
+		AST m = null;
+		AST i = null;
+		
+		try {      // for error handling
+			AST __t157 = _t;
+			m = _t==ASTNULL ? null :(AST)_t;
+			match(_t,METHOD_CALL);
+			_t = _t.getFirstChild();
+			i = (AST)_t;
+			match(_t,METHOD_NAME);
+			_t = _t.getNextSibling();
+			if ( inputState.guessing==0 ) {
+				beginFunctionTemplate(m,i);
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case EXPR_LIST:
+			{
+				AST __t159 = _t;
+				AST tmp32_AST_in = (AST)_t;
+				match(_t,EXPR_LIST);
+				_t = _t.getFirstChild();
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case ALL:
+				case ANY:
+				case COUNT:
+				case DOT:
+				case FALSE:
+				case NULL:
+				case SELECT:
+				case SOME:
+				case TRUE:
+				case CASE:
+				case AGGREGATE:
+				case CASE2:
+				case INDEX_OP:
+				case METHOD_CALL:
+				case UNARY_MINUS:
+				case VECTOR_EXPR:
+				case CONSTANT:
+				case NUM_DOUBLE:
+				case NUM_FLOAT:
+				case NUM_LONG:
+				case JAVA_CONSTANT:
+				case PLUS:
+				case MINUS:
+				case STAR:
+				case DIV:
+				case PARAM:
+				case NUM_INT:
+				case QUOTED_STRING:
+				case IDENT:
+				case ALIAS_REF:
+				case SQL_TOKEN:
+				case NAMED_PARAM:
+				{
+					arguments(_t);
+					_t = _retTree;
+					break;
+				}
+				case 3:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				_t = __t159;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			if ( inputState.guessing==0 ) {
+				endFunctionTemplate(m);
+			}
+			_t = __t157;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void aggregate(AST _t) throws RecognitionException {
+		
+		AST aggregate_AST_in = (AST)_t;
+		AST a = null;
+		
+		try {      // for error handling
+			AST __t155 = _t;
+			a = _t==ASTNULL ? null :(AST)_t;
+			match(_t,AGGREGATE);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out(a); out("(");
+			}
+			expr(_t);
+			_t = _retTree;
+			if ( inputState.guessing==0 ) {
+				out(")");
+			}
+			_t = __t155;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void constant(AST _t) throws RecognitionException {
+		
+		AST constant_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case NUM_DOUBLE:
+			{
+				AST tmp33_AST_in = (AST)_t;
+				match(_t,NUM_DOUBLE);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NUM_FLOAT:
+			{
+				AST tmp34_AST_in = (AST)_t;
+				match(_t,NUM_FLOAT);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NUM_INT:
+			{
+				AST tmp35_AST_in = (AST)_t;
+				match(_t,NUM_INT);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NUM_LONG:
+			{
+				AST tmp36_AST_in = (AST)_t;
+				match(_t,NUM_LONG);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case QUOTED_STRING:
+			{
+				AST tmp37_AST_in = (AST)_t;
+				match(_t,QUOTED_STRING);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case CONSTANT:
+			{
+				AST tmp38_AST_in = (AST)_t;
+				match(_t,CONSTANT);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case JAVA_CONSTANT:
+			{
+				AST tmp39_AST_in = (AST)_t;
+				match(_t,JAVA_CONSTANT);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case TRUE:
+			{
+				AST tmp40_AST_in = (AST)_t;
+				match(_t,TRUE);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case FALSE:
+			{
+				AST tmp41_AST_in = (AST)_t;
+				match(_t,FALSE);
+				_t = _t.getNextSibling();
+				break;
+			}
+			case IDENT:
+			{
+				AST tmp42_AST_in = (AST)_t;
+				match(_t,IDENT);
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void arithmeticExpr(AST _t) throws RecognitionException {
+		
+		AST arithmeticExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case PLUS:
+			case MINUS:
+			{
+				additiveExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			case STAR:
+			case DIV:
+			{
+				multiplicativeExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			case UNARY_MINUS:
+			{
+				AST __t128 = _t;
+				AST tmp43_AST_in = (AST)_t;
+				match(_t,UNARY_MINUS);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("-");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t128;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case CASE:
+			case CASE2:
+			{
+				caseExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void countExpr(AST _t) throws RecognitionException {
+		
+		AST countExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ROW_STAR:
+			{
+				AST tmp44_AST_in = (AST)_t;
+				match(_t,ROW_STAR);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out("*");
+				}
+				break;
+			}
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				simpleExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void simpleExpr(AST _t) throws RecognitionException {
+		
+		AST simpleExpr_AST_in = (AST)_t;
+		AST c = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case FALSE:
+			case TRUE:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			{
+				c = _t==ASTNULL ? null : (AST)_t;
+				constant(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(c);
+				}
+				break;
+			}
+			case NULL:
+			{
+				AST tmp45_AST_in = (AST)_t;
+				match(_t,NULL);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out("null");
+				}
+				break;
+			}
+			case DOT:
+			case INDEX_OP:
+			case ALIAS_REF:
+			{
+				addrExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			case SQL_TOKEN:
+			{
+				sqlToken(_t);
+				_t = _retTree;
+				break;
+			}
+			case AGGREGATE:
+			{
+				aggregate(_t);
+				_t = _retTree;
+				break;
+			}
+			case METHOD_CALL:
+			{
+				methodCall(_t);
+				_t = _retTree;
+				break;
+			}
+			case COUNT:
+			{
+				count(_t);
+				_t = _retTree;
+				break;
+			}
+			case PARAM:
+			case NAMED_PARAM:
+			{
+				parameter(_t);
+				_t = _retTree;
+				break;
+			}
+			case CASE:
+			case CASE2:
+			case UNARY_MINUS:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			{
+				arithmeticExpr(_t);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void tableJoin(AST _t,
+		 AST parent 
+	) throws RecognitionException {
+		
+		AST tableJoin_AST_in = (AST)_t;
+		AST c = null;
+		AST d = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case JOIN_FRAGMENT:
+			{
+				AST __t77 = _t;
+				c = _t==ASTNULL ? null :(AST)_t;
+				match(_t,JOIN_FRAGMENT);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(" "); out(c);
+				}
+				{
+				_loop79:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_t.getType()==FROM_FRAGMENT||_t.getType()==JOIN_FRAGMENT)) {
+						tableJoin(_t, c );
+						_t = _retTree;
+					}
+					else {
+						break _loop79;
+					}
+					
+				} while (true);
+				}
+				_t = __t77;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case FROM_FRAGMENT:
+			{
+				AST __t80 = _t;
+				d = _t==ASTNULL ? null :(AST)_t;
+				match(_t,FROM_FRAGMENT);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					nestedFromFragment(d,parent);
+				}
+				{
+				_loop82:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_t.getType()==FROM_FRAGMENT||_t.getType()==JOIN_FRAGMENT)) {
+						tableJoin(_t, d );
+						_t = _retTree;
+					}
+					else {
+						break _loop82;
+					}
+					
+				} while (true);
+				}
+				_t = __t80;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void booleanOp(AST _t,
+		 boolean parens 
+	) throws RecognitionException {
+		
+		AST booleanOp_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case AND:
+			{
+				AST __t84 = _t;
+				AST tmp46_AST_in = (AST)_t;
+				match(_t,AND);
+				_t = _t.getFirstChild();
+				booleanExpr(_t,true);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" and ");
+				}
+				booleanExpr(_t,true);
+				_t = _retTree;
+				_t = __t84;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case OR:
+			{
+				AST __t85 = _t;
+				AST tmp47_AST_in = (AST)_t;
+				match(_t,OR);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					if (parens) out("(");
+				}
+				booleanExpr(_t,false);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" or ");
+				}
+				booleanExpr(_t,false);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					if (parens) out(")");
+				}
+				_t = __t85;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NOT:
+			{
+				AST __t86 = _t;
+				AST tmp48_AST_in = (AST)_t;
+				match(_t,NOT);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(" not (");
+				}
+				booleanExpr(_t,false);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(")");
+				}
+				_t = __t86;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void binaryComparisonExpression(AST _t) throws RecognitionException {
+		
+		AST binaryComparisonExpression_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case EQ:
+			{
+				AST __t90 = _t;
+				AST tmp49_AST_in = (AST)_t;
+				match(_t,EQ);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("=");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t90;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NE:
+			{
+				AST __t91 = _t;
+				AST tmp50_AST_in = (AST)_t;
+				match(_t,NE);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("<>");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t91;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case GT:
+			{
+				AST __t92 = _t;
+				AST tmp51_AST_in = (AST)_t;
+				match(_t,GT);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(">");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t92;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case GE:
+			{
+				AST __t93 = _t;
+				AST tmp52_AST_in = (AST)_t;
+				match(_t,GE);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(">=");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t93;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case LT:
+			{
+				AST __t94 = _t;
+				AST tmp53_AST_in = (AST)_t;
+				match(_t,LT);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("<");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t94;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case LE:
+			{
+				AST __t95 = _t;
+				AST tmp54_AST_in = (AST)_t;
+				match(_t,LE);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("<=");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t95;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void exoticComparisonExpression(AST _t) throws RecognitionException {
+		
+		AST exoticComparisonExpression_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case LIKE:
+			{
+				AST __t97 = _t;
+				AST tmp55_AST_in = (AST)_t;
+				match(_t,LIKE);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" like ");
+				}
+				expr(_t);
+				_t = _retTree;
+				likeEscape(_t);
+				_t = _retTree;
+				_t = __t97;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NOT_LIKE:
+			{
+				AST __t98 = _t;
+				AST tmp56_AST_in = (AST)_t;
+				match(_t,NOT_LIKE);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" not like ");
+				}
+				expr(_t);
+				_t = _retTree;
+				likeEscape(_t);
+				_t = _retTree;
+				_t = __t98;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case BETWEEN:
+			{
+				AST __t99 = _t;
+				AST tmp57_AST_in = (AST)_t;
+				match(_t,BETWEEN);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" between ");
+				}
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" and ");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t99;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NOT_BETWEEN:
+			{
+				AST __t100 = _t;
+				AST tmp58_AST_in = (AST)_t;
+				match(_t,NOT_BETWEEN);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" not between ");
+				}
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" and ");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t100;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case IN:
+			{
+				AST __t101 = _t;
+				AST tmp59_AST_in = (AST)_t;
+				match(_t,IN);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" in");
+				}
+				inList(_t);
+				_t = _retTree;
+				_t = __t101;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case NOT_IN:
+			{
+				AST __t102 = _t;
+				AST tmp60_AST_in = (AST)_t;
+				match(_t,NOT_IN);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(" not in ");
+				}
+				inList(_t);
+				_t = _retTree;
+				_t = __t102;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case EXISTS:
+			{
+				AST __t103 = _t;
+				AST tmp61_AST_in = (AST)_t;
+				match(_t,EXISTS);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					optionalSpace(); out("exists ");
+				}
+				quantified(_t);
+				_t = _retTree;
+				_t = __t103;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case IS_NULL:
+			{
+				AST __t104 = _t;
+				AST tmp62_AST_in = (AST)_t;
+				match(_t,IS_NULL);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				_t = __t104;
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(" is null");
+				}
+				break;
+			}
+			case IS_NOT_NULL:
+			{
+				AST __t105 = _t;
+				AST tmp63_AST_in = (AST)_t;
+				match(_t,IS_NOT_NULL);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				_t = __t105;
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(" is not null");
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void likeEscape(AST _t) throws RecognitionException {
+		
+		AST likeEscape_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case ESCAPE:
+			{
+				AST __t108 = _t;
+				AST tmp64_AST_in = (AST)_t;
+				match(_t,ESCAPE);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out(" escape ");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t108;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case 3:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void inList(AST _t) throws RecognitionException {
+		
+		AST inList_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			AST __t110 = _t;
+			AST tmp65_AST_in = (AST)_t;
+			match(_t,IN_LIST);
+			_t = _t.getFirstChild();
+			if ( inputState.guessing==0 ) {
+				out(" ");
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case SELECT:
+			{
+				parenSelect(_t);
+				_t = _retTree;
+				break;
+			}
+			case 3:
+			case COUNT:
+			case DOT:
+			case FALSE:
+			case NULL:
+			case TRUE:
+			case CASE:
+			case AGGREGATE:
+			case CASE2:
+			case INDEX_OP:
+			case METHOD_CALL:
+			case UNARY_MINUS:
+			case CONSTANT:
+			case NUM_DOUBLE:
+			case NUM_FLOAT:
+			case NUM_LONG:
+			case JAVA_CONSTANT:
+			case PLUS:
+			case MINUS:
+			case STAR:
+			case DIV:
+			case PARAM:
+			case NUM_INT:
+			case QUOTED_STRING:
+			case IDENT:
+			case ALIAS_REF:
+			case SQL_TOKEN:
+			case NAMED_PARAM:
+			{
+				simpleExprList(_t);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			_t = __t110;
+			_t = _t.getNextSibling();
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void quantified(AST _t) throws RecognitionException {
+		
+		AST quantified_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if ( inputState.guessing==0 ) {
+				out("(");
+			}
+			{
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case SQL_TOKEN:
+			{
+				sqlToken(_t);
+				_t = _retTree;
+				break;
+			}
+			case SELECT:
+			{
+				selectStatement(_t);
+				_t = _retTree;
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+			}
+			if ( inputState.guessing==0 ) {
+				out(")");
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void parenSelect(AST _t) throws RecognitionException {
+		
+		AST parenSelect_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if ( inputState.guessing==0 ) {
+				out("(");
+			}
+			selectStatement(_t);
+			_t = _retTree;
+			if ( inputState.guessing==0 ) {
+				out(")");
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void simpleExprList(AST _t) throws RecognitionException {
+		
+		AST simpleExprList_AST_in = (AST)_t;
+		AST e = null;
+		
+		try {      // for error handling
+			if ( inputState.guessing==0 ) {
+				out("(");
+			}
+			{
+			_loop114:
+			do {
+				if (_t==null) _t=ASTNULL;
+				if ((_tokenSet_4.member(_t.getType()))) {
+					e = _t==ASTNULL ? null : (AST)_t;
+					simpleExpr(_t);
+					_t = _retTree;
+					if ( inputState.guessing==0 ) {
+						separator(e," , ");
+					}
+				}
+				else {
+					break _loop114;
+				}
+				
+			} while (true);
+			}
+			if ( inputState.guessing==0 ) {
+				out(")");
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void addrExpr(AST _t) throws RecognitionException {
+		
+		AST addrExpr_AST_in = (AST)_t;
+		AST r = null;
+		AST i = null;
+		AST j = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case DOT:
+			{
+				AST __t166 = _t;
+				r = _t==ASTNULL ? null :(AST)_t;
+				match(_t,DOT);
+				_t = _t.getFirstChild();
+				AST tmp66_AST_in = (AST)_t;
+				if ( _t==null ) throw new MismatchedTokenException();
+				_t = _t.getNextSibling();
+				AST tmp67_AST_in = (AST)_t;
+				if ( _t==null ) throw new MismatchedTokenException();
+				_t = _t.getNextSibling();
+				_t = __t166;
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(r);
+				}
+				break;
+			}
+			case ALIAS_REF:
+			{
+				i = (AST)_t;
+				match(_t,ALIAS_REF);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(i);
+				}
+				break;
+			}
+			case INDEX_OP:
+			{
+				j = (AST)_t;
+				match(_t,INDEX_OP);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(j);
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void parameter(AST _t) throws RecognitionException {
+		
+		AST parameter_AST_in = (AST)_t;
+		AST n = null;
+		AST p = null;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case NAMED_PARAM:
+			{
+				n = (AST)_t;
+				match(_t,NAMED_PARAM);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(n);
+				}
+				break;
+			}
+			case PARAM:
+			{
+				p = (AST)_t;
+				match(_t,PARAM);
+				_t = _t.getNextSibling();
+				if ( inputState.guessing==0 ) {
+					out(p);
+				}
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void additiveExpr(AST _t) throws RecognitionException {
+		
+		AST additiveExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case PLUS:
+			{
+				AST __t130 = _t;
+				AST tmp68_AST_in = (AST)_t;
+				match(_t,PLUS);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("+");
+				}
+				expr(_t);
+				_t = _retTree;
+				_t = __t130;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case MINUS:
+			{
+				AST __t131 = _t;
+				AST tmp69_AST_in = (AST)_t;
+				match(_t,MINUS);
+				_t = _t.getFirstChild();
+				expr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("-");
+				}
+				nestedExprAfterMinusDiv(_t);
+				_t = _retTree;
+				_t = __t131;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void multiplicativeExpr(AST _t) throws RecognitionException {
+		
+		AST multiplicativeExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case STAR:
+			{
+				AST __t133 = _t;
+				AST tmp70_AST_in = (AST)_t;
+				match(_t,STAR);
+				_t = _t.getFirstChild();
+				nestedExpr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("*");
+				}
+				nestedExpr(_t);
+				_t = _retTree;
+				_t = __t133;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case DIV:
+			{
+				AST __t134 = _t;
+				AST tmp71_AST_in = (AST)_t;
+				match(_t,DIV);
+				_t = _t.getFirstChild();
+				nestedExpr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out("/");
+				}
+				nestedExprAfterMinusDiv(_t);
+				_t = _retTree;
+				_t = __t134;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void caseExpr(AST _t) throws RecognitionException {
+		
+		AST caseExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			if (_t==null) _t=ASTNULL;
+			switch ( _t.getType()) {
+			case CASE:
+			{
+				AST __t142 = _t;
+				AST tmp72_AST_in = (AST)_t;
+				match(_t,CASE);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("case");
+				}
+				{
+				int _cnt145=0;
+				_loop145:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_t.getType()==WHEN)) {
+						AST __t144 = _t;
+						AST tmp73_AST_in = (AST)_t;
+						match(_t,WHEN);
+						_t = _t.getFirstChild();
+						if ( inputState.guessing==0 ) {
+							out( " when ");
+						}
+						booleanExpr(_t,false);
+						_t = _retTree;
+						if ( inputState.guessing==0 ) {
+							out(" then ");
+						}
+						expr(_t);
+						_t = _retTree;
+						_t = __t144;
+						_t = _t.getNextSibling();
+					}
+					else {
+						if ( _cnt145>=1 ) { break _loop145; } else {throw new NoViableAltException(_t);}
+					}
+					
+					_cnt145++;
+				} while (true);
+				}
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case ELSE:
+				{
+					AST __t147 = _t;
+					AST tmp74_AST_in = (AST)_t;
+					match(_t,ELSE);
+					_t = _t.getFirstChild();
+					if ( inputState.guessing==0 ) {
+						out(" else ");
+					}
+					expr(_t);
+					_t = _retTree;
+					_t = __t147;
+					_t = _t.getNextSibling();
+					break;
+				}
+				case 3:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				if ( inputState.guessing==0 ) {
+					out(" end");
+				}
+				_t = __t142;
+				_t = _t.getNextSibling();
+				break;
+			}
+			case CASE2:
+			{
+				AST __t148 = _t;
+				AST tmp75_AST_in = (AST)_t;
+				match(_t,CASE2);
+				_t = _t.getFirstChild();
+				if ( inputState.guessing==0 ) {
+					out("case ");
+				}
+				expr(_t);
+				_t = _retTree;
+				{
+				int _cnt151=0;
+				_loop151:
+				do {
+					if (_t==null) _t=ASTNULL;
+					if ((_t.getType()==WHEN)) {
+						AST __t150 = _t;
+						AST tmp76_AST_in = (AST)_t;
+						match(_t,WHEN);
+						_t = _t.getFirstChild();
+						if ( inputState.guessing==0 ) {
+							out( " when ");
+						}
+						expr(_t);
+						_t = _retTree;
+						if ( inputState.guessing==0 ) {
+							out(" then ");
+						}
+						expr(_t);
+						_t = _retTree;
+						_t = __t150;
+						_t = _t.getNextSibling();
+					}
+					else {
+						if ( _cnt151>=1 ) { break _loop151; } else {throw new NoViableAltException(_t);}
+					}
+					
+					_cnt151++;
+				} while (true);
+				}
+				{
+				if (_t==null) _t=ASTNULL;
+				switch ( _t.getType()) {
+				case ELSE:
+				{
+					AST __t153 = _t;
+					AST tmp77_AST_in = (AST)_t;
+					match(_t,ELSE);
+					_t = _t.getFirstChild();
+					if ( inputState.guessing==0 ) {
+						out(" else ");
+					}
+					expr(_t);
+					_t = _retTree;
+					_t = __t153;
+					_t = _t.getNextSibling();
+					break;
+				}
+				case 3:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(_t);
+				}
+				}
+				}
+				if ( inputState.guessing==0 ) {
+					out(" end");
+				}
+				_t = __t148;
+				_t = _t.getNextSibling();
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(_t);
+			}
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void nestedExprAfterMinusDiv(AST _t) throws RecognitionException {
+		
+		AST nestedExprAfterMinusDiv_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			boolean synPredMatched140 = false;
+			if (((_tokenSet_5.member(_t.getType())))) {
+				AST __t140 = _t;
+				synPredMatched140 = true;
+				inputState.guessing++;
+				try {
+					{
+					arithmeticExpr(_t);
+					_t = _retTree;
+					}
+				}
+				catch (RecognitionException pe) {
+					synPredMatched140 = false;
+				}
+				_t = __t140;
+				inputState.guessing--;
+			}
+			if ( synPredMatched140 ) {
+				if ( inputState.guessing==0 ) {
+					out("(");
+				}
+				arithmeticExpr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(")");
+				}
+			}
+			else if ((_tokenSet_3.member(_t.getType()))) {
+				expr(_t);
+				_t = _retTree;
+			}
+			else {
+				throw new NoViableAltException(_t);
+			}
+			
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void nestedExpr(AST _t) throws RecognitionException {
+		
+		AST nestedExpr_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			boolean synPredMatched137 = false;
+			if (((_t.getType()==PLUS||_t.getType()==MINUS))) {
+				AST __t137 = _t;
+				synPredMatched137 = true;
+				inputState.guessing++;
+				try {
+					{
+					additiveExpr(_t);
+					_t = _retTree;
+					}
+				}
+				catch (RecognitionException pe) {
+					synPredMatched137 = false;
+				}
+				_t = __t137;
+				inputState.guessing--;
+			}
+			if ( synPredMatched137 ) {
+				if ( inputState.guessing==0 ) {
+					out("(");
+				}
+				additiveExpr(_t);
+				_t = _retTree;
+				if ( inputState.guessing==0 ) {
+					out(")");
+				}
+			}
+			else if ((_tokenSet_3.member(_t.getType()))) {
+				expr(_t);
+				_t = _retTree;
+			}
+			else {
+				throw new NoViableAltException(_t);
+			}
+			
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	public final void arguments(AST _t) throws RecognitionException {
+		
+		AST arguments_AST_in = (AST)_t;
+		
+		try {      // for error handling
+			expr(_t);
+			_t = _retTree;
+			{
+			_loop163:
+			do {
+				if (_t==null) _t=ASTNULL;
+				if ((_tokenSet_3.member(_t.getType()))) {
+					if ( inputState.guessing==0 ) {
+						commaBetweenParameters(", ");
+					}
+					expr(_t);
+					_t = _retTree;
+				}
+				else {
+					break _loop163;
+				}
+				
+			} while (true);
+			}
+		}
+		catch (RecognitionException ex) {
+			if (inputState.guessing==0) {
+				reportError(ex);
+				if (_t!=null) {_t = _t.getNextSibling();}
+			} else {
+			  throw ex;
+			}
+		}
+		_retTree = _t;
+	}
+	
+	
+	public static final String[] _tokenNames = {
+		"<0>",
+		"EOF",
+		"<2>",
+		"NULL_TREE_LOOKAHEAD",
+		"\"all\"",
+		"\"any\"",
+		"\"and\"",
+		"\"as\"",
+		"\"asc\"",
+		"\"avg\"",
+		"\"between\"",
+		"\"class\"",
+		"\"count\"",
+		"\"delete\"",
+		"\"desc\"",
+		"DOT",
+		"\"distinct\"",
+		"\"elements\"",
+		"\"escape\"",
+		"\"exists\"",
+		"\"false\"",
+		"\"fetch\"",
+		"\"from\"",
+		"\"full\"",
+		"\"group\"",
+		"\"having\"",
+		"\"in\"",
+		"\"indices\"",
+		"\"inner\"",
+		"\"insert\"",
+		"\"into\"",
+		"\"is\"",
+		"\"join\"",
+		"\"left\"",
+		"\"like\"",
+		"\"max\"",
+		"\"min\"",
+		"\"new\"",
+		"\"not\"",
+		"\"null\"",
+		"\"or\"",
+		"\"order\"",
+		"\"outer\"",
+		"\"properties\"",
+		"\"right\"",
+		"\"select\"",
+		"\"set\"",
+		"\"some\"",
+		"\"sum\"",
+		"\"true\"",
+		"\"union\"",
+		"\"update\"",
+		"\"versioned\"",
+		"\"where\"",
+		"\"case\"",
+		"\"end\"",
+		"\"else\"",
+		"\"then\"",
+		"\"when\"",
+		"\"on\"",
+		"\"with\"",
+		"\"both\"",
+		"\"empty\"",
+		"\"leading\"",
+		"\"member\"",
+		"\"object\"",
+		"\"of\"",
+		"\"trailing\"",
+		"AGGREGATE",
+		"ALIAS",
+		"CONSTRUCTOR",
+		"CASE2",
+		"EXPR_LIST",
+		"FILTER_ENTITY",
+		"IN_LIST",
+		"INDEX_OP",
+		"IS_NOT_NULL",
+		"IS_NULL",
+		"METHOD_CALL",
+		"NOT_BETWEEN",
+		"NOT_IN",
+		"NOT_LIKE",
+		"ORDER_ELEMENT",
+		"QUERY",
+		"RANGE",
+		"ROW_STAR",
+		"SELECT_FROM",
+		"UNARY_MINUS",
+		"UNARY_PLUS",
+		"VECTOR_EXPR",
+		"WEIRD_IDENT",
+		"CONSTANT",
+		"NUM_DOUBLE",
+		"NUM_FLOAT",
+		"NUM_LONG",
+		"JAVA_CONSTANT",
+		"COMMA",
+		"EQ",
+		"OPEN",
+		"CLOSE",
+		"\"by\"",
+		"\"ascending\"",
+		"\"descending\"",
+		"NE",
+		"SQL_NE",
+		"LT",
+		"GT",
+		"LE",
+		"GE",
+		"CONCAT",
+		"PLUS",
+		"MINUS",
+		"STAR",
+		"DIV",
+		"OPEN_BRACKET",
+		"CLOSE_BRACKET",
+		"COLON",
+		"PARAM",
+		"NUM_INT",
+		"QUOTED_STRING",
+		"IDENT",
+		"ID_START_LETTER",
+		"ID_LETTER",
+		"ESCqs",
+		"WS",
+		"HEX_DIGIT",
+		"EXPONENT",
+		"FLOAT_SUFFIX",
+		"FROM_FRAGMENT",
+		"IMPLIED_FROM",
+		"JOIN_FRAGMENT",
+		"SELECT_CLAUSE",
+		"LEFT_OUTER",
+		"RIGHT_OUTER",
+		"ALIAS_REF",
+		"PROPERTY_REF",
+		"SQL_TOKEN",
+		"SELECT_COLUMNS",
+		"SELECT_EXPR",
+		"THETA_JOINS",
+		"FILTERS",
+		"METHOD_NAME",
+		"NAMED_PARAM",
+		"BOGUS",
+		"SQL_NODE"
+	};
+	
+	private static final long[] mk_tokenSet_0() {
+		long[] data = { 18612532836077568L, 136163524152934608L, 66880L, 0L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
+	private static final long[] mk_tokenSet_1() {
+		long[] data = { 17247503360L, 33543694823424L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
+	private static final long[] mk_tokenSet_2() {
+		long[] data = { 1391637038144L, 33543694823424L, 256L, 0L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
+	private static final long[] mk_tokenSet_3() {
+		long[] data = { 18753820080246832L, 136163524186491024L, 16704L, 0L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
+	private static final long[] mk_tokenSet_4() {
+		long[] data = { 18577898219802624L, 136163524152936592L, 16704L, 0L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
+	private static final long[] mk_tokenSet_5() {
+		long[] data = { 18014398509481984L, 1055531171053696L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
+	}
+	


Property changes on: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlGeneratorBase.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.java	                        (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -0,0 +1,154 @@
+// $ANTLR 2.7.2: "sql-gen.g" -> "SqlGeneratorBase.java"$
+
+//   $Id: sql-gen.g 15746 2009-01-06 17:14:14Z cbredesen $
+package org.hibernate.hql.antlr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+public interface SqlTokenTypes {
+	int EOF = 1;
+	int NULL_TREE_LOOKAHEAD = 3;
+	int ALL = 4;
+	int ANY = 5;
+	int AND = 6;
+	int AS = 7;
+	int ASCENDING = 8;
+	int AVG = 9;
+	int BETWEEN = 10;
+	int CLASS = 11;
+	int COUNT = 12;
+	int DELETE = 13;
+	int DESCENDING = 14;
+	int DOT = 15;
+	int DISTINCT = 16;
+	int ELEMENTS = 17;
+	int ESCAPE = 18;
+	int EXISTS = 19;
+	int FALSE = 20;
+	int FETCH = 21;
+	int FROM = 22;
+	int FULL = 23;
+	int GROUP = 24;
+	int HAVING = 25;
+	int IN = 26;
+	int INDICES = 27;
+	int INNER = 28;
+	int INSERT = 29;
+	int INTO = 30;
+	int IS = 31;
+	int JOIN = 32;
+	int LEFT = 33;
+	int LIKE = 34;
+	int MAX = 35;
+	int MIN = 36;
+	int NEW = 37;
+	int NOT = 38;
+	int NULL = 39;
+	int OR = 40;
+	int ORDER = 41;
+	int OUTER = 42;
+	int PROPERTIES = 43;
+	int RIGHT = 44;
+	int SELECT = 45;
+	int SET = 46;
+	int SOME = 47;
+	int SUM = 48;
+	int TRUE = 49;
+	int UNION = 50;
+	int UPDATE = 51;
+	int VERSIONED = 52;
+	int WHERE = 53;
+	int CASE = 54;
+	int END = 55;
+	int ELSE = 56;
+	int THEN = 57;
+	int WHEN = 58;
+	int ON = 59;
+	int WITH = 60;
+	int BOTH = 61;
+	int EMPTY = 62;
+	int LEADING = 63;
+	int MEMBER = 64;
+	int OBJECT = 65;
+	int OF = 66;
+	int TRAILING = 67;
+	int AGGREGATE = 68;
+	int ALIAS = 69;
+	int CONSTRUCTOR = 70;
+	int CASE2 = 71;
+	int EXPR_LIST = 72;
+	int FILTER_ENTITY = 73;
+	int IN_LIST = 74;
+	int INDEX_OP = 75;
+	int IS_NOT_NULL = 76;
+	int IS_NULL = 77;
+	int METHOD_CALL = 78;
+	int NOT_BETWEEN = 79;
+	int NOT_IN = 80;
+	int NOT_LIKE = 81;
+	int ORDER_ELEMENT = 82;
+	int QUERY = 83;
+	int RANGE = 84;
+	int ROW_STAR = 85;
+	int SELECT_FROM = 86;
+	int UNARY_MINUS = 87;
+	int UNARY_PLUS = 88;
+	int VECTOR_EXPR = 89;
+	int WEIRD_IDENT = 90;
+	int CONSTANT = 91;
+	int NUM_DOUBLE = 92;
+	int NUM_FLOAT = 93;
+	int NUM_LONG = 94;
+	int JAVA_CONSTANT = 95;
+	int COMMA = 96;
+	int EQ = 97;
+	int OPEN = 98;
+	int CLOSE = 99;
+	int LITERAL_by = 100;
+	int LITERAL_ascending = 101;
+	int LITERAL_descending = 102;
+	int NE = 103;
+	int SQL_NE = 104;
+	int LT = 105;
+	int GT = 106;
+	int LE = 107;
+	int GE = 108;
+	int CONCAT = 109;
+	int PLUS = 110;
+	int MINUS = 111;
+	int STAR = 112;
+	int DIV = 113;
+	int OPEN_BRACKET = 114;
+	int CLOSE_BRACKET = 115;
+	int COLON = 116;
+	int PARAM = 117;
+	int NUM_INT = 118;
+	int QUOTED_STRING = 119;
+	int IDENT = 120;
+	int ID_START_LETTER = 121;
+	int ID_LETTER = 122;
+	int ESCqs = 123;
+	int WS = 124;
+	int HEX_DIGIT = 125;
+	int EXPONENT = 126;
+	int FLOAT_SUFFIX = 127;
+	int FROM_FRAGMENT = 128;
+	int IMPLIED_FROM = 129;
+	int JOIN_FRAGMENT = 130;
+	int SELECT_CLAUSE = 131;
+	int LEFT_OUTER = 132;
+	int RIGHT_OUTER = 133;
+	int ALIAS_REF = 134;
+	int PROPERTY_REF = 135;
+	int SQL_TOKEN = 136;
+	int SELECT_COLUMNS = 137;
+	int SELECT_EXPR = 138;
+	int THETA_JOINS = 139;
+	int FILTERS = 140;
+	int METHOD_NAME = 141;
+	int NAMED_PARAM = 142;
+	int BOGUS = 143;
+	int SQL_NODE = 144;
+}


Property changes on: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.txt
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.txt	                        (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.txt	2009-08-03 02:58:24 UTC (rev 17224)
@@ -0,0 +1,143 @@
+// $ANTLR 2.7.2: sql-gen.g -> SqlTokenTypes.txt$
+Sql    // output token vocab name
+ALL="all"=4
+ANY="any"=5
+AND="and"=6
+AS="as"=7
+ASCENDING="asc"=8
+AVG="avg"=9
+BETWEEN="between"=10
+CLASS="class"=11
+COUNT="count"=12
+DELETE="delete"=13
+DESCENDING="desc"=14
+DOT=15
+DISTINCT="distinct"=16
+ELEMENTS="elements"=17
+ESCAPE="escape"=18
+EXISTS="exists"=19
+FALSE="false"=20
+FETCH="fetch"=21
+FROM="from"=22
+FULL="full"=23
+GROUP="group"=24
+HAVING="having"=25
+IN="in"=26
+INDICES="indices"=27
+INNER="inner"=28
+INSERT="insert"=29
+INTO="into"=30
+IS="is"=31
+JOIN="join"=32
+LEFT="left"=33
+LIKE="like"=34
+MAX="max"=35
+MIN="min"=36
+NEW="new"=37
+NOT="not"=38
+NULL="null"=39
+OR="or"=40
+ORDER="order"=41
+OUTER="outer"=42
+PROPERTIES="properties"=43
+RIGHT="right"=44
+SELECT="select"=45
+SET="set"=46
+SOME="some"=47
+SUM="sum"=48
+TRUE="true"=49
+UNION="union"=50
+UPDATE="update"=51
+VERSIONED="versioned"=52
+WHERE="where"=53
+CASE="case"=54
+END="end"=55
+ELSE="else"=56
+THEN="then"=57
+WHEN="when"=58
+ON="on"=59
+WITH="with"=60
+BOTH="both"=61
+EMPTY="empty"=62
+LEADING="leading"=63
+MEMBER="member"=64
+OBJECT="object"=65
+OF="of"=66
+TRAILING="trailing"=67
+AGGREGATE=68
+ALIAS=69
+CONSTRUCTOR=70
+CASE2=71
+EXPR_LIST=72
+FILTER_ENTITY=73
+IN_LIST=74
+INDEX_OP=75
+IS_NOT_NULL=76
+IS_NULL=77
+METHOD_CALL=78
+NOT_BETWEEN=79
+NOT_IN=80
+NOT_LIKE=81
+ORDER_ELEMENT=82
+QUERY=83
+RANGE=84
+ROW_STAR=85
+SELECT_FROM=86
+UNARY_MINUS=87
+UNARY_PLUS=88
+VECTOR_EXPR=89
+WEIRD_IDENT=90
+CONSTANT=91
+NUM_DOUBLE=92
+NUM_FLOAT=93
+NUM_LONG=94
+JAVA_CONSTANT=95
+COMMA=96
+EQ=97
+OPEN=98
+CLOSE=99
+LITERAL_by="by"=100
+LITERAL_ascending="ascending"=101
+LITERAL_descending="descending"=102
+NE=103
+SQL_NE=104
+LT=105
+GT=106
+LE=107
+GE=108
+CONCAT=109
+PLUS=110
+MINUS=111
+STAR=112
+DIV=113
+OPEN_BRACKET=114
+CLOSE_BRACKET=115
+COLON=116
+PARAM=117
+NUM_INT=118
+QUOTED_STRING=119
+IDENT=120
+ID_START_LETTER=121
+ID_LETTER=122
+ESCqs=123
+WS=124
+HEX_DIGIT=125
+EXPONENT=126
+FLOAT_SUFFIX=127
+FROM_FRAGMENT=128
+IMPLIED_FROM=129
+JOIN_FRAGMENT=130
+SELECT_CLAUSE=131
+LEFT_OUTER=132
+RIGHT_OUTER=133
+ALIAS_REF=134
+PROPERTY_REF=135
+SQL_TOKEN=136
+SELECT_COLUMNS=137
+SELECT_EXPR=138
+THETA_JOINS=139
+FILTERS=140
+METHOD_NAME=141
+NAMED_PARAM=142
+BOGUS=143
+SQL_NODE=144


Property changes on: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/antlr/SqlTokenTypes.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/SqlASTFactory.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/SqlASTFactory.java	2009-08-01 19:58:59 UTC (rev 17223)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/SqlASTFactory.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -1,13 +1,14 @@
 // $Id$
 package org.hibernate.hql.ast;
 
-import antlr.ASTFactory;
-import antlr.Token;
-import antlr.collections.AST;
+import java.lang.reflect.Constructor;
+
 import org.hibernate.hql.antlr.HqlSqlTokenTypes;
 import org.hibernate.hql.ast.tree.AggregateNode;
+import org.hibernate.hql.ast.tree.BetweenOperatorNode;
 import org.hibernate.hql.ast.tree.BinaryArithmeticOperatorNode;
 import org.hibernate.hql.ast.tree.BinaryLogicOperatorNode;
+import org.hibernate.hql.ast.tree.BooleanLiteralNode;
 import org.hibernate.hql.ast.tree.Case2Node;
 import org.hibernate.hql.ast.tree.CaseNode;
 import org.hibernate.hql.ast.tree.CollectionFunction;
@@ -19,10 +20,14 @@
 import org.hibernate.hql.ast.tree.FromElement;
 import org.hibernate.hql.ast.tree.IdentNode;
 import org.hibernate.hql.ast.tree.ImpliedFromElement;
+import org.hibernate.hql.ast.tree.InLogicOperatorNode;
 import org.hibernate.hql.ast.tree.IndexNode;
 import org.hibernate.hql.ast.tree.InitializeableNode;
 import org.hibernate.hql.ast.tree.InsertStatement;
 import org.hibernate.hql.ast.tree.IntoClause;
+import org.hibernate.hql.ast.tree.IsNotNullLogicOperatorNode;
+import org.hibernate.hql.ast.tree.IsNullLogicOperatorNode;
+import org.hibernate.hql.ast.tree.JavaConstantNode;
 import org.hibernate.hql.ast.tree.LiteralNode;
 import org.hibernate.hql.ast.tree.MethodNode;
 import org.hibernate.hql.ast.tree.OrderByClause;
@@ -30,18 +35,16 @@
 import org.hibernate.hql.ast.tree.QueryNode;
 import org.hibernate.hql.ast.tree.SelectClause;
 import org.hibernate.hql.ast.tree.SelectExpressionImpl;
+import org.hibernate.hql.ast.tree.SessionFactoryAwareNode;
 import org.hibernate.hql.ast.tree.SqlFragment;
 import org.hibernate.hql.ast.tree.SqlNode;
 import org.hibernate.hql.ast.tree.UnaryArithmeticNode;
+import org.hibernate.hql.ast.tree.UnaryLogicOperatorNode;
 import org.hibernate.hql.ast.tree.UpdateStatement;
-import org.hibernate.hql.ast.tree.BetweenOperatorNode;
-import org.hibernate.hql.ast.tree.UnaryLogicOperatorNode;
-import org.hibernate.hql.ast.tree.InLogicOperatorNode;
-import org.hibernate.hql.ast.tree.JavaConstantNode;
-import org.hibernate.hql.ast.tree.SessionFactoryAwareNode;
-import org.hibernate.hql.ast.tree.BooleanLiteralNode;
 
-import java.lang.reflect.Constructor;
+import antlr.ASTFactory;
+import antlr.Token;
+import antlr.collections.AST;
 
 /**
  * Custom AST factory the intermediate tree that causes ANTLR to create specialized
@@ -157,7 +160,9 @@
 			case NOT_BETWEEN:
 				return BetweenOperatorNode.class;
 			case IS_NULL:
+				return IsNullLogicOperatorNode.class;
 			case IS_NOT_NULL:
+				return IsNotNullLogicOperatorNode.class;
 			case EXISTS:
 				return UnaryLogicOperatorNode.class;
 			default:

Added: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java	                        (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A 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, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Steve Ebersole
+ */
+package org.hibernate.hql.ast.tree;
+
+import antlr.collections.AST;
+
+import org.hibernate.type.Type;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.hql.antlr.HqlSqlTokenTypes;
+import org.hibernate.util.StringHelper;
+import org.hibernate.HibernateException;
+
+/**
+ * AbstractNullnessCheckNode implementation
+ *
+ * @author Steve Ebersole
+ */
+public abstract class AbstractNullnessCheckNode extends UnaryLogicOperatorNode {
+	public void initialize() {
+		// TODO : this really needs to be delayed unitl after we definitively know the operand node type;
+		// where this is currently a problem is parameters for which where we cannot unequivocally
+		// resolve an expected type
+		Type operandType = extractDataType( getOperand() );
+		if ( operandType == null ) {
+			return;
+		}
+		SessionFactoryImplementor sessionFactory = getSessionFactoryHelper().getFactory();
+		int operandColumnSpan = operandType.getColumnSpan( sessionFactory );
+		if ( operandColumnSpan > 1 ) {
+			mutateRowValueConstructorSyntax( operandColumnSpan );
+		}
+	}
+
+	protected abstract int getExpansionConnectorType();
+	protected abstract String getExpansionConnectorText();
+
+	private void mutateRowValueConstructorSyntax(int operandColumnSpan) {
+		final int comparisonType = getType();
+		final String comparisonText = getText();
+
+		final int expansionConnectorType = getExpansionConnectorType();
+		final String expansionConnectorText = getExpansionConnectorText();
+
+		setType( expansionConnectorType );
+		setText( expansionConnectorText );
+
+		String[] mutationTexts = extractMutationTexts( getOperand(), operandColumnSpan );
+
+		AST container = this;
+		for ( int i = operandColumnSpan - 1; i > 0; i-- ) {
+			if ( i == 1 ) {
+				AST op1 = getASTFactory().create( comparisonType, comparisonText );
+				AST operand1 = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, mutationTexts[0] );
+				op1.setFirstChild( operand1 );
+				container.setFirstChild( op1 );
+				AST op2 = getASTFactory().create( comparisonType, comparisonText );
+				AST operand2 = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, mutationTexts[1] );
+				op2.setFirstChild( operand2 );
+				op1.setNextSibling( op2 );
+			}
+			else {
+				AST op = getASTFactory().create( comparisonType, comparisonText );
+				AST operand = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, mutationTexts[i] );
+				op.setFirstChild( operand );
+				AST newContainer = getASTFactory().create( expansionConnectorType, expansionConnectorText );
+				container.setFirstChild( newContainer );
+				newContainer.setNextSibling( op );
+				container = newContainer;
+			}
+		}
+	}
+
+	protected Type extractDataType(Node operand) {
+		Type type = null;
+		if ( operand instanceof SqlNode ) {
+			type = ( ( SqlNode ) operand ).getDataType();
+		}
+		if ( type == null && operand instanceof ExpectedTypeAwareNode ) {
+			type = ( ( ExpectedTypeAwareNode ) operand ).getExpectedType();
+		}
+		return type;
+	}
+
+	private static String[] extractMutationTexts(Node operand, int count) {
+		if ( operand instanceof ParameterNode ) {
+			String[] rtn = new String[count];
+			for ( int i = 0; i < count; i++ ) {
+				rtn[i] = "?";
+			}
+			return rtn;
+		}
+		else if ( operand.getType() == HqlSqlTokenTypes.VECTOR_EXPR ) {
+			String[] rtn = new String[ operand.getNumberOfChildren() ];
+			int x = 0;
+			AST node = operand.getFirstChild();
+			while ( node != null ) {
+				rtn[ x++ ] = node.getText();
+				node = node.getNextSibling();
+			}
+			return rtn;
+		}
+		else if ( operand instanceof SqlNode ) {
+			String nodeText = operand.getText();
+			if ( nodeText.startsWith( "(" ) ) {
+				nodeText = nodeText.substring( 1 );
+			}
+			if ( nodeText.endsWith( ")" ) ) {
+				nodeText = nodeText.substring( 0, nodeText.length() - 1 );
+			}
+			String[] splits = StringHelper.split( ", ", nodeText );
+			if ( count != splits.length ) {
+				throw new HibernateException( "SqlNode's text did not reference expected number of columns" );
+			}
+			return splits;
+		}
+		else {
+			throw new HibernateException( "dont know how to extract row value elements from node : " + operand );
+		}
+	}
+}


Property changes on: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNotNullLogicOperatorNode.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNotNullLogicOperatorNode.java	                        (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNotNullLogicOperatorNode.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A 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, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Steve Ebersole
+ */
+package org.hibernate.hql.ast.tree;
+
+import org.hibernate.hql.antlr.HqlSqlTokenTypes;
+
+/**
+ * IsNotNullLogicOperatorNode implementation
+ *
+ * @author Steve Ebersole
+ */
+public class IsNotNullLogicOperatorNode extends AbstractNullnessCheckNode {
+	protected int getExpansionConnectorType() {
+		return HqlSqlTokenTypes.OR;
+	}
+
+	protected String getExpansionConnectorText() {
+		return "OR";
+	}
+}


Property changes on: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNotNullLogicOperatorNode.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNullLogicOperatorNode.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNullLogicOperatorNode.java	                        (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNullLogicOperatorNode.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A 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, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Steve Ebersole
+ */
+package org.hibernate.hql.ast.tree;
+
+import org.hibernate.hql.antlr.HqlSqlTokenTypes;
+
+/**
+ * Represents a 'is null' check. 
+ *
+ * @author Steve Ebersole
+ */
+public class IsNullLogicOperatorNode extends AbstractNullnessCheckNode {
+	protected int getExpansionConnectorType() {
+		return HqlSqlTokenTypes.AND;
+	}
+
+	protected String getExpansionConnectorText() {
+		return "AND";
+	}
+}


Property changes on: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/IsNullLogicOperatorNode.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/UnaryLogicOperatorNode.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/UnaryLogicOperatorNode.java	2009-08-01 19:58:59 UTC (rev 17223)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/hql/ast/tree/UnaryLogicOperatorNode.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -4,9 +4,11 @@
 import org.hibernate.Hibernate;
 
 /**
- * @author <a href="mailto:steve at hibernate.org">Steve Ebersole </a>
+ * Represents a unary operator node.
+ *
+ * @author Steve Ebersole
  */
-public class UnaryLogicOperatorNode extends SqlNode implements UnaryOperatorNode {
+public class UnaryLogicOperatorNode extends HqlSqlWalkerNode implements UnaryOperatorNode {
 	public Node getOperand() {
 		return ( Node ) getFirstChild();
 	}

Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java	2009-08-01 19:58:59 UTC (rev 17223)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hql/ASTParserLoadingTest.java	2009-08-03 02:58:24 UTC (rev 17224)
@@ -104,6 +104,41 @@
 		return new FunctionalTestClassTestSuite( ASTParserLoadingTest.class );
 	}
 
+	public void testComponentNullnessChecks() {
+		Session s = openSession();
+		s.beginTransaction();
+		Human h = new Human();
+		h.setName( new Name( "Johnny", 'B', "Goode" ) );
+		s.save( h );
+		h = new Human();
+		h.setName( new Name( "Steve", null, "Ebersole" ) );
+		s.save( h );
+		h = new Human();
+		h.setName( new Name( "Bono", null, null ) );
+		s.save( h );
+		h = new Human();
+		h.setName( new Name( null, null, null ) );
+		s.save( h );
+		s.getTransaction().commit();
+		s.close();
+
+		s = openSession();
+		s.beginTransaction();
+		List results = s.createQuery( "from Human where name is null" ).list();
+		assertEquals( 1, results.size() );
+		results = s.createQuery( "from Human where name is not null" ).list();
+		assertEquals( 3, results.size() );
+		s.createQuery( "from Human where ? is null" ).setParameter( 0, null ).list();
+		s.getTransaction().commit();
+		s.close();
+
+		s = openSession();
+		s.beginTransaction();
+		s.createQuery( "delete Human" ).executeUpdate();
+		s.getTransaction().commit();
+		s.close();
+	}
+
 	public void testInvalidCollectionDereferencesFail() {
 		Session s = openSession();
 		s.beginTransaction();



More information about the hibernate-commits mailing list