[hibernate-commits] Hibernate SVN: r16425 - in core/branches/antlr3/src: main/antlr3/org/hibernate/sql/ast/phase/hql/resolve and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Apr 23 11:27:36 EDT 2009


Author: porcelli
Date: 2009-04-23 11:27:36 -0400 (Thu, 23 Apr 2009)
New Revision: 16425

Added:
   core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolver.g
Removed:
   core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g
   core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java
Modified:
   core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/parse/HQL.g
   core/branches/antlr3/src/test/java/org/hibernate/sql/ast/phase/hql/resolve/TestHQLResolver.java
Log:
recent changes on hql parser and treewalker

Modified: core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/parse/HQL.g
===================================================================
--- core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/parse/HQL.g	2009-04-23 14:51:55 UTC (rev 16424)
+++ core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/parse/HQL.g	2009-04-23 15:27:36 UTC (rev 16425)
@@ -475,6 +475,7 @@
 		-> {	generateUpdateStatementTree($udpate_key.tree, $entityName.tree, $aliasClause.tree, $setClause.tree, $whereClause.tree )	}
 	;
 
+//TODO: check what is necessary to generate at versioned field
 setClause
 	:	set_key assignment (COMMA assignment)*
 		-> {$updateStatement::generateVersionedField}? ^(set_key assignment+ ^(EQUALS VERSIONED_VALUE STRING_LITERAL))

Deleted: core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g
===================================================================
--- core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g	2009-04-23 14:51:55 UTC (rev 16424)
+++ core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolution.g	2009-04-23 15:27:36 UTC (rev 16425)
@@ -1,621 +0,0 @@
-tree grammar GeneratedHQLResolution;
-
-options{
-	output=AST;
-	rewrite=true;
-	tokenVocab=HQL;
-	ASTLabelType=CommonTree;
-	TokenLabelType=CommonToken;
-}
-
- at header {
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- *
- * Portions of SQL grammar parsing copyright (C) 2003 by Lubos Vnuk.  All rights
- * reserved.  These portions are distributed under license by Red Hat Middleware
- * LLC and are covered by the above LGPL notice.  If you redistribute this material,
- * with or without modification, you must preserve this copyright notice in its
- * entirety.
- */
-package org.hibernate.sql.ast.phase.hql.resolve;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.hibernate.sql.ast.common.JoinType;
-import org.hibernate.sql.ast.phase.hql.resolve.path.PathedPropertyReferenceSource;
-}
-
- at members{
-    protected void registerPersisterSpace(CommonTree entityName,
-                                       CommonTree alias) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-    }
-    
-	protected boolean isUnqualifiedPropertyReference() {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}	
-
-	protected Tree normalizeUnqualifiedPropertyReference(CommonTree property) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-	
-	protected boolean isPersisterReferenceAlias() {
-        throw new UnsupportedOperationException( "must be overridden!" );
-    }
-
-    protected PathedPropertyReferenceSource normalizeUnqualifiedRoot( CommonTree identifier382 ) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-
-	protected PathedPropertyReferenceSource normalizeQualifiedRoot( CommonTree identifier381 ) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-
-    protected PathedPropertyReferenceSource normalizePropertyPathIntermediary( PathedPropertyReferenceSource source, CommonTree propertyName ) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-
-    protected void normalizeIntermediateIndexOperation( CommonTree commonTree,
-			CommonTree commonTree2 ) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-
-    protected void normalizeUnqualifiedPropertyReferenceSource(
-			CommonTree identifier394 ) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-
-    protected void normalizeTerminalIndexOperation(CommonTree collectionPath, CommonTree selector) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-    }
-
-    protected void normalizePropertyPathTerminus(PathedPropertyReferenceSource source, CommonTree propertyNameNode) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-    }
-
-	protected void pushFromStrategy( JoinType joinType,
-			CommonTree assosiationFetchTree, CommonTree propertyFetchTree,
-			CommonTree alias ) {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-	
-	protected void pushSelectStrategy() {
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-	
-
-	protected void popStrategy(){
-        throw new UnsupportedOperationException( "must be overridden!" );
-	}
-}
-
-filterStatement[String collectionRole]
-	:	^(QUERY ^(QUERY_SPEC FILTER 
-				selectClause? whereClause? ( groupByClause havingClause?)? orderByClause?))
-	;
-
-statement
-	:	updateStatementSet
-	|	deleteStatementSet
-	|	insertStatementSet
-	|	queryStatementSet
-	;
-
-updateStatementSet
-	:	updateStatement+
-	;
-
-updateStatement
-	:	^(UPDATE entityName ^(SET assignment+) whereClause?)
-	;
-
-assignment
-	:	^(EQUALS propertyReference valueExpression)
-	|	^(EQUALS VERSIONED_VALUE STRING_LITERAL)
-	;
-
-deleteStatementSet
-	:	deleteStatement+
-	;
-
-deleteStatement
-	:	^(DELETE entityName whereClause?)
-	;
-
-insertStatementSet
-	:	insertStatement+
-	;
-
-insertStatement
-	:	^(INSERT intoClause queryStatementSet)
-	;
-
-intoClause
-	:	^(INTO entityName ^(INSERTABILITY_SPEC propertyReference+ ) )
-	;
-
-queryStatementSet
-	:	queryStatement+
-	;
-
-queryStatement
-	:	^(QUERY queryExpression orderByClause?)
-	;
-
-queryExpression
-	:	^(UNION ALL? queryExpression queryExpression)
-	|	^(INTERSECT ALL? queryExpression queryExpression)
-	|	^(EXCEPT ALL? queryExpression queryExpression)
-	|	querySpec	
-	;
-
-querySpec
-	:	^(QUERY_SPEC selectFrom whereClause? groupByClause? havingClause?)
-	;
-
-whereClause
-	:	^(WHERE searchCondition)
-	;
-
-groupByClause
-	:	^(GROUP_BY groupingValue+)
-	;
-
-groupingValue
-	:	^(GROUPING_VALUE valueExpression COLLATE?)
-	;
-
-havingClause
-	:	^(HAVING searchCondition)
-	;
-
-selectFrom
-	:	^(SELECT_FROM fromClause selectClause)
-	;
-
-fromClause
-	:	^(FROM persisterSpaces+)
-	;
-
-persisterSpaces
-	:	^(PERSISTER_SPACE persisterSpace)
-	;
-
-persisterSpace
-	:	persisterSpaceRoot joins*
-	;
-
-persisterSpaceRoot
-	:	^(ENTITY_PERSISTER_REF entityName PROP_FETCH?)
-	;
-
-joins
-	:	^(PROPERTY_JOIN jt=joinType ft=FETCH? an=ALIAS_NAME pf=PROP_FETCH? 
-		{	pushFromStrategy($jt.joinType, $ft, $pf, $an );	}	
-		(collectionExpression|propertyReference) withClause?)
-		{	popStrategy();	}
-	|	^(PERSISTER_JOIN joinType persisterSpaceRoot onClause?)
-	;
-
-withClause
-	:	^(WITH searchCondition)
-	;
-
-onClause
-	:	^(ON searchCondition)
-	;
-
-joinType returns [JoinType joinType]
-	:	CROSS {	$joinType = JoinType.CROSS;	}
-	|	INNER {	$joinType = JoinType.INNER;	}
-	|	(LEFT {	$joinType = JoinType.LEFT;	} |	RIGHT {	$joinType = JoinType.RIGHT;	} | FULL {	$joinType = JoinType.FULL;	}) OUTER?
-	;
-
-selectClause
- at init	{	if (state.backtracking == 0) pushSelectStrategy();	}
- at after	{	popStrategy();	}
-	:	^(SELECT DISTINCT? rootSelectExpression) 
-	;
-
-rootSelectExpression
-	:	^(SELECT_LIST rootSelectExpression+)
-	|	^(SELECT_ITEM rootSelectExpression)
-	|	^(DYNAMIC_INSTANTIATION rootSelectExpression+)
-	|	^(DYNAMIC_INSTANTIATION_ARG rootSelectExpression)
-	|	valueExpression ALIAS_NAME?
-	;
-
-orderByClause
-	:	^(ORDER_BY sortSpecification+)
-	;
-
-sortSpecification
-	:	^(SORT_SPEC valueExpression COLLATE? (ASC|DESC))
-	;
-
-searchCondition
-	:	^( OR searchCondition searchCondition )
-	|	^( AND searchCondition searchCondition )
-	|	^( NOT searchCondition )
-	|	predicate
-	;
-
-predicate
-	:	^( EQUALS rowValueConstructor comparativePredicateValue )
-	|	^( NOT_EQUAL rowValueConstructor comparativePredicateValue )
-	|	^( LESS rowValueConstructor comparativePredicateValue )
-	|	^( LESS_EQUAL rowValueConstructor comparativePredicateValue )
-	|	^( GREATER rowValueConstructor comparativePredicateValue )
-	|	^( GREATER_EQUAL rowValueConstructor comparativePredicateValue )
-	|	^( IS_NULL rowValueConstructor )
-	|	^( IS_NOT_NULL rowValueConstructor )
-	|	^( LIKE valueExpression valueExpression escapeSpecification? )
-	|	^( NOT_LIKE valueExpression valueExpression escapeSpecification? )
-	|	^( BETWEEN rowValueConstructor betweenList )
-	|	^( NOT_BETWEEN rowValueConstructor betweenList )
-	|	^( IN rowValueConstructor inPredicateValue )
-	|	^( NOT_IN rowValueConstructor inPredicateValue )
-	|	^( MEMBER_OF rowValueConstructor rowValueConstructor )
-	|	^( NOT_MEMBER_OF rowValueConstructor rowValueConstructor  )
-	|	^( IS_EMPTY rowValueConstructor )
-	|	^( IS_NOT_EMPTY rowValueConstructor )
-	|	rowValueConstructor
-	;
-
-betweenList
-	:	^( BETWEEN_LIST rowValueConstructor rowValueConstructor )
-	;	
-
-comparativePredicateValue
-	:	rowValueConstructor
-	;
-
-rowValueConstructor
-	:	valueExpression
-	;
-
-escapeSpecification
-	:	^(ESCAPE characterValueExpression)
-	;
-
-inPredicateValue
-	:	^(IN_LIST valueExpression+)
-	;
-
-numericValueExpression
-	:	valueExpression
-	;
-
-characterValueExpression
-	:	valueExpression
-	;
-
-datetimeValueExpression
-	:	valueExpression
-	;
-
-valueExpression
-	:	^( DOUBLE_PIPE characterValueExpression+ )
-	|	^( UNARY_MINUS numericValueExpression )
-	|	^( UNARY_PLUS numericValueExpression )
-	|	^( PLUS valueExpression valueExpression )
-	|	^( MINUS valueExpression valueExpression )
-	|	^( ASTERISK numericValueExpression numericValueExpression )
-	|	^( SOLIDUS numericValueExpression numericValueExpression )
-	|	^( EXISTS rowValueConstructor)
-    |	^( SOME valueExpression )
-    |	^( ALL valueExpression )
-    |	^( ANY valueExpression )
-	|	^( VECTOR_EXPR valueExpression+) // or a tuples or ^(AND or IN statement 
-	|	valueExpressionPrimary
-	;
-
-valueExpressionPrimary
-	:	caseExpression
-	|	function
-	|	collectionFunction
-	|	collectionExpression
-	|	constant
-	|	parameter
-	|	propertyReference
-	|	^(SUB_QUERY queryStatementSet)
-	|	ALIAS_REF //ID COLUMN, full property column list 
-	|	^(DOT_CLASS path) // crazy 
-	|	^(GENERAL_FUNCTION_CALL path)
-	|	^(JAVA_CONSTANT path) //It will generate at SQL a parameter element (?) -> 'cos we do not need to care about char escaping
-	|	^(PATH propertyReferencePath)
-	;
-
-caseExpression
-	:	^(NULLIF valueExpression valueExpression)
-	|	^(COALESCE valueExpression valueExpression*)
-	|	^(SIMPLE_CASE valueExpression simpleCaseWhenClause+ elseClause?)
-	|	^(SEARCHED_CASE searchedWhenClause+ elseClause?)
-	;
-
-simpleCaseWhenClause
-	:	^(WHEN valueExpression valueExpression)
-	;
-
-searchedWhenClause
-	:	^(WHEN searchCondition valueExpression)
-	;
-
-elseClause
-	:	^(ELSE valueExpression)
-	;
-
-function
-	:	standardFunction
-	|	setFunction
-	;
-
-standardFunction
-	:	castFunction
-	|	concatFunction
-	|	substringFunction
-	|	trimFunction
-	|	upperFunction
-	|	lowerFunction
-	|	lengthFunction
-	|	locateFunction
-	|	absFunction
-	|	sqrtFunction
-	|	modFunction
-	|	sizeFunction
-	|	indexFunction
-	|	currentDateFunction
-	|	currentTimeFunction
-	|	currentTimestampFunction
-	|	extractFunction
-	|	positionFunction
-	|	charLengthFunction
-	|	octetLengthFunction
-	|	bitLengthFunction
-	;
-
-castFunction
-	:	^(CAST valueExpression IDENTIFIER)
-	;
-
-concatFunction
-	:	^(CONCAT valueExpression+)
-	;
-
-substringFunction
-	:	^(SUBSTRING characterValueExpression numericValueExpression numericValueExpression?)
-	;
-
-trimFunction
-	:	^(TRIM trimOperands)
-	;
-
-trimOperands
-	:	^((LEADING|TRAILING|BOTH) characterValueExpression characterValueExpression)
-	;
-
-upperFunction
-	:	^(UPPER characterValueExpression)
-	;
-
-lowerFunction
-	:	^(LOWER characterValueExpression)
-	;
-
-lengthFunction
-	:	^(LENGTH characterValueExpression)
-	;
-
-locateFunction
-	:	^(LOCATE characterValueExpression characterValueExpression numericValueExpression?)
-	;
-
-absFunction
-	:	^(ABS numericValueExpression)
-	;
-
-sqrtFunction
-	:	^(SQRT numericValueExpression)
-	;
-
-modFunction
-	:	^(MOD numericValueExpression numericValueExpression)
-	;
-
-sizeFunction
-	:	^(SIZE propertyReference)
-	;
-
-indexFunction
-	:	^(INDEX ALIAS_REF)
-	;
-
-currentDateFunction
-	:	CURRENT_DATE
-	;
-
-currentTimeFunction
-	:	CURRENT_TIME
-	;
-
-currentTimestampFunction
-	:	CURRENT_TIMESTAMP
-	;
-
-extractFunction
-	:	^(EXTRACT extractField datetimeValueExpression)
-	;
-
-extractField
-	:	datetimeField
-	|	timeZoneField
-	;
-
-datetimeField
-	:	YEAR
-	|	MONTH
-	|	DAY
-	|	HOUR
-	|	MINUTE
-	|	SECOND
-	;
-
-timeZoneField
-	:	TIMEZONE_HOUR
-	|	TIMEZONE_MINUTE
-	;
-
-positionFunction
-	:	^(POSITION characterValueExpression characterValueExpression)
-	;
-
-charLengthFunction
-	:	^(CHARACTER_LENGTH characterValueExpression)
-	;
-
-octetLengthFunction
-	:	^(OCTET_LENGTH characterValueExpression)	
-	;
-
-bitLengthFunction
-	:	^(BIT_LENGTH characterValueExpression)
-	;
-
-setFunction
-	:	^(SUM numericValueExpression)
-	|	^(AVG numericValueExpression)
-	|	^(MAX numericValueExpression)
-	|	^(MIN numericValueExpression)
-	|	^(COUNT (ASTERISK | (DISTINCT|ALL) countFunctionArguments))
-	;
-
-countFunctionArguments
-	:	collectionExpression
-	|	propertyReference
-	|	numeric_literal
-	;
-
-collectionFunction
-	:	^((MAXELEMENT|MAXINDEX|MINELEMENT|MININDEX) collectionPropertyReference)
-		//it will generate a SELECT MAX (m.column) form Table xxx -> it is realted to Hibernate mappings to Table->Map
-	;
-
-collectionPropertyReference
-	:	propertyReference
-	;
-
-collectionExpression
-	:	^(ELEMENTS propertyReference) //it will generate a SELECT m.column form Table xxx -> it is realted to Hibernate mappings to Table->Map
-	|	^(INDICES propertyReference)
-	;
-
-parameter
-	:	NAMED_PARAM
-	|	JPA_PARAM
-	|	PARAM
-	;
-
-constant
-	:	literal
-	|	NULL
-	|	TRUE
-	|	FALSE
-	;
-
-literal
-	:	numeric_literal
-	|	HEX_LITERAL
-	|	OCTAL_LITERAL
-	|	CHARACTER_LITERAL
-	|	STRING_LITERAL
-	;
-
-numeric_literal
-	:	INTEGER_LITERAL
-	|	DECIMAL_LITERAL
-	|	FLOATING_POINT_LITERAL
-	;
-
-entityName
-	:	ENTITY_NAME ALIAS_NAME
-	{	registerPersisterSpace($ENTITY_NAME, $ALIAS_NAME);	}
-	;
-
-propertyReference
-	:	^(PROPERTY_REFERENCE propertyReferencePath)
-	;
-
-propertyReferencePath
-	: 	{isUnqualifiedPropertyReference()}? unqualifiedPropertyReference
-	|	pathedPropertyReference
-    |	terminalIndexOperation
-	;
-
-unqualifiedPropertyReference
-	:	IDENTIFIER
-	{	normalizeUnqualifiedPropertyReference( $IDENTIFIER ); }
-	;
-
-pathedPropertyReference
-	:	^(DOT pathedPropertyReferenceSource IDENTIFIER)
-	{	normalizePropertyPathTerminus( $pathedPropertyReferenceSource.propertyReferenceSource, $IDENTIFIER );	}
-	;
-
-pathedPropertyReferenceSource returns [PathedPropertyReferenceSource propertyReferenceSource]
-	:	{(isPersisterReferenceAlias())}?=> IDENTIFIER { $propertyReferenceSource = normalizeQualifiedRoot( $IDENTIFIER ); }
-    |	{(isUnqualifiedPropertyReference())}?=> IDENTIFIER { $propertyReferenceSource = normalizeUnqualifiedRoot( $IDENTIFIER ); }
-    |	intermediatePathedPropertyReference { $propertyReferenceSource = $intermediatePathedPropertyReference.propertyReferenceSource; }
-    |	intermediateIndexOperation { $propertyReferenceSource = null; }
-    ;
-
-intermediatePathedPropertyReference returns [PathedPropertyReferenceSource propertyReferenceSource]
-	:	^(DOT source=pathedPropertyReferenceSource IDENTIFIER )
-	{	$propertyReferenceSource = normalizePropertyPathIntermediary( $pathedPropertyReferenceSource.propertyReferenceSource, $IDENTIFIER );	}
-	;
-
-intermediateIndexOperation
-	:	^( LEFT_SQUARE indexOperationSource indexSelector ) 
-	{	normalizeIntermediateIndexOperation( $indexOperationSource.tree, $indexSelector.tree );	}
-	;
-
-indexOperationSource
-	:	^(DOT pathedPropertyReferenceSource IDENTIFIER )
-    |	{(isUnqualifiedPropertyReference())}?=> IDENTIFIER
-    {	normalizeUnqualifiedPropertyReferenceSource( $IDENTIFIER );	}
-	;
-
-indexSelector
-	:	valueExpression
-	;
-
-terminalIndexOperation
-	:	^( INDEX_OP indexOperationSource indexSelector ) 
-	{	normalizeTerminalIndexOperation( $indexOperationSource.tree, $indexSelector.tree );	}
-	;
-
-path
-	: 	IDENTIFIER
-	|	^(DOT path path )
-	|	^(LEFT_SQUARE path valueExpression* )
-	|	^(LEFT_PAREN path valueExpression* )
-	;

Added: core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolver.g
===================================================================
--- core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolver.g	                        (rev 0)
+++ core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolver.g	2009-04-23 15:27:36 UTC (rev 16425)
@@ -0,0 +1,621 @@
+tree grammar GeneratedHQLResolver;
+
+options{
+	output=AST;
+	rewrite=true;
+	tokenVocab=HQL;
+	ASTLabelType=CommonTree;
+	TokenLabelType=CommonToken;
+}
+
+ at header {
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * 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, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ *
+ * Portions of SQL grammar parsing copyright (C) 2003 by Lubos Vnuk.  All rights
+ * reserved.  These portions are distributed under license by Red Hat Middleware
+ * LLC and are covered by the above LGPL notice.  If you redistribute this material,
+ * with or without modification, you must preserve this copyright notice in its
+ * entirety.
+ */
+package org.hibernate.sql.ast.phase.hql.resolve;
+
+import org.antlr.runtime.tree.CommonTree;
+import org.hibernate.sql.ast.common.JoinType;
+import org.hibernate.sql.ast.phase.hql.resolve.path.PathedPropertyReferenceSource;
+}
+
+ at members{
+    protected void registerPersisterSpace(CommonTree entityName,
+                                       CommonTree alias) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+    }
+    
+	protected boolean isUnqualifiedPropertyReference() {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}	
+
+	protected PathedPropertyReferenceSource normalizeUnqualifiedPropertyReference(CommonTree property) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+	
+	protected boolean isPersisterReferenceAlias() {
+        throw new UnsupportedOperationException( "must be overridden!" );
+    }
+
+    protected PathedPropertyReferenceSource normalizeUnqualifiedRoot( CommonTree identifier382 ) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+
+	protected PathedPropertyReferenceSource normalizeQualifiedRoot( CommonTree identifier381 ) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+
+    protected PathedPropertyReferenceSource normalizePropertyPathIntermediary( PathedPropertyReferenceSource source, CommonTree propertyName ) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+
+    protected void normalizeIntermediateIndexOperation( CommonTree commonTree,
+			CommonTree commonTree2 ) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+
+    protected PathedPropertyReferenceSource normalizeUnqualifiedPropertyReferenceSource(
+			CommonTree identifier394 ) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+
+    protected void normalizeTerminalIndexOperation(CommonTree collectionPath, CommonTree selector) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+    }
+
+    protected Tree normalizePropertyPathTerminus(PathedPropertyReferenceSource source, CommonTree propertyNameNode) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+    }
+
+	protected void pushFromStrategy( JoinType joinType,
+			CommonTree assosiationFetchTree, CommonTree propertyFetchTree,
+			CommonTree alias ) {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+	
+	protected void pushSelectStrategy() {
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+	
+
+	protected void popStrategy(){
+        throw new UnsupportedOperationException( "must be overridden!" );
+	}
+}
+
+filterStatement[String collectionRole]
+	:	^(QUERY ^(QUERY_SPEC FILTER 
+				selectClause? whereClause? ( groupByClause havingClause?)? orderByClause?))
+	;
+
+statement
+	:	updateStatementSet
+	|	deleteStatementSet
+	|	insertStatementSet
+	|	queryStatementSet
+	;
+
+updateStatementSet
+	:	updateStatement+
+	;
+
+updateStatement
+	:	^(UPDATE entityName ^(SET assignment+) whereClause?)
+	;
+
+assignment
+	:	^(EQUALS propertyReference valueExpression)
+	|	^(EQUALS VERSIONED_VALUE STRING_LITERAL)
+	;
+
+deleteStatementSet
+	:	deleteStatement+
+	;
+
+deleteStatement
+	:	^(DELETE entityName whereClause?)
+	;
+
+insertStatementSet
+	:	insertStatement+
+	;
+
+insertStatement
+	:	^(INSERT intoClause queryStatementSet)
+	;
+
+intoClause
+	:	^(INTO entityName ^(INSERTABILITY_SPEC propertyReference+ ) )
+	;
+
+queryStatementSet
+	:	queryStatement+
+	;
+
+queryStatement
+	:	^(QUERY queryExpression orderByClause?)
+	;
+
+queryExpression
+	:	^(UNION ALL? queryExpression queryExpression)
+	|	^(INTERSECT ALL? queryExpression queryExpression)
+	|	^(EXCEPT ALL? queryExpression queryExpression)
+	|	querySpec	
+	;
+
+querySpec
+	:	^(QUERY_SPEC selectFrom whereClause? groupByClause? havingClause?)
+	;
+
+whereClause
+	:	^(WHERE searchCondition)
+	;
+
+groupByClause
+	:	^(GROUP_BY groupingValue+)
+	;
+
+groupingValue
+	:	^(GROUPING_VALUE valueExpression COLLATE?)
+	;
+
+havingClause
+	:	^(HAVING searchCondition)
+	;
+
+selectFrom
+	:	^(SELECT_FROM fromClause selectClause)
+	;
+
+fromClause
+	:	^(FROM persisterSpaces+)
+	;
+
+persisterSpaces
+	:	^(PERSISTER_SPACE persisterSpace)
+	;
+
+persisterSpace
+	:	persisterSpaceRoot joins*
+	;
+
+persisterSpaceRoot
+	:	^(ENTITY_PERSISTER_REF entityName PROP_FETCH?)
+	;
+
+joins
+	:	^(PROPERTY_JOIN jt=joinType ft=FETCH? an=ALIAS_NAME pf=PROP_FETCH? 
+		{	pushFromStrategy($jt.joinType, $ft, $pf, $an );	}	
+		(collectionExpression|propertyReference) withClause?)
+		{	popStrategy();	}
+	|	^(PERSISTER_JOIN joinType persisterSpaceRoot onClause?)
+	;
+
+withClause
+	:	^(WITH searchCondition)
+	;
+
+onClause
+	:	^(ON searchCondition)
+	;
+
+joinType returns [JoinType joinType]
+	:	CROSS {	$joinType = JoinType.CROSS;	}
+	|	INNER {	$joinType = JoinType.INNER;	}
+	|	(LEFT {	$joinType = JoinType.LEFT;	} |	RIGHT {	$joinType = JoinType.RIGHT;	} | FULL {	$joinType = JoinType.FULL;	}) OUTER?
+	;
+
+selectClause
+ at init	{	if (state.backtracking == 0) pushSelectStrategy();	}
+ at after	{	popStrategy();	}
+	:	^(SELECT DISTINCT? rootSelectExpression) 
+	;
+
+rootSelectExpression
+	:	^(SELECT_LIST rootSelectExpression+)
+	|	^(SELECT_ITEM rootSelectExpression)
+	|	^(DYNAMIC_INSTANTIATION rootSelectExpression+)
+	|	^(DYNAMIC_INSTANTIATION_ARG rootSelectExpression)
+	|	valueExpression ALIAS_NAME?
+	;
+
+orderByClause
+	:	^(ORDER_BY sortSpecification+)
+	;
+
+sortSpecification
+	:	^(SORT_SPEC valueExpression COLLATE? (ASC|DESC))
+	;
+
+searchCondition
+	:	^( OR searchCondition searchCondition )
+	|	^( AND searchCondition searchCondition )
+	|	^( NOT searchCondition )
+	|	predicate
+	;
+
+predicate
+	:	^( EQUALS rowValueConstructor comparativePredicateValue )
+	|	^( NOT_EQUAL rowValueConstructor comparativePredicateValue )
+	|	^( LESS rowValueConstructor comparativePredicateValue )
+	|	^( LESS_EQUAL rowValueConstructor comparativePredicateValue )
+	|	^( GREATER rowValueConstructor comparativePredicateValue )
+	|	^( GREATER_EQUAL rowValueConstructor comparativePredicateValue )
+	|	^( IS_NULL rowValueConstructor )
+	|	^( IS_NOT_NULL rowValueConstructor )
+	|	^( LIKE valueExpression valueExpression escapeSpecification? )
+	|	^( NOT_LIKE valueExpression valueExpression escapeSpecification? )
+	|	^( BETWEEN rowValueConstructor betweenList )
+	|	^( NOT_BETWEEN rowValueConstructor betweenList )
+	|	^( IN rowValueConstructor inPredicateValue )
+	|	^( NOT_IN rowValueConstructor inPredicateValue )
+	|	^( MEMBER_OF rowValueConstructor rowValueConstructor )
+	|	^( NOT_MEMBER_OF rowValueConstructor rowValueConstructor  )
+	|	^( IS_EMPTY rowValueConstructor )
+	|	^( IS_NOT_EMPTY rowValueConstructor )
+	|	rowValueConstructor
+	;
+
+betweenList
+	:	^( BETWEEN_LIST rowValueConstructor rowValueConstructor )
+	;	
+
+comparativePredicateValue
+	:	rowValueConstructor
+	;
+
+rowValueConstructor
+	:	valueExpression
+	;
+
+escapeSpecification
+	:	^(ESCAPE characterValueExpression)
+	;
+
+inPredicateValue
+	:	^(IN_LIST valueExpression+)
+	;
+
+numericValueExpression
+	:	valueExpression
+	;
+
+characterValueExpression
+	:	valueExpression
+	;
+
+datetimeValueExpression
+	:	valueExpression
+	;
+
+valueExpression
+	:	^( DOUBLE_PIPE characterValueExpression+ )
+	|	^( UNARY_MINUS numericValueExpression )
+	|	^( UNARY_PLUS numericValueExpression )
+	|	^( PLUS valueExpression valueExpression )
+	|	^( MINUS valueExpression valueExpression )
+	|	^( ASTERISK numericValueExpression numericValueExpression )
+	|	^( SOLIDUS numericValueExpression numericValueExpression )
+	|	^( EXISTS rowValueConstructor)
+    |	^( SOME valueExpression )
+    |	^( ALL valueExpression )
+    |	^( ANY valueExpression )
+	|	^( VECTOR_EXPR valueExpression+) // or a tuples or ^(AND or IN statement 
+	|	valueExpressionPrimary
+	;
+
+valueExpressionPrimary
+	:	caseExpression
+	|	function
+	|	collectionFunction
+	|	collectionExpression
+	|	constant
+	|	parameter
+	|	propertyReference
+	|	^(SUB_QUERY queryStatementSet)
+	|	ALIAS_REF //ID COLUMN, full property column list 
+	|	^(DOT_CLASS path) // crazy 
+	|	^(GENERAL_FUNCTION_CALL path)
+	|	^(JAVA_CONSTANT path) //It will generate at SQL a parameter element (?) -> 'cos we do not need to care about char escaping
+	|	^(PATH propertyReferencePath)
+	;
+
+caseExpression
+	:	^(NULLIF valueExpression valueExpression)
+	|	^(COALESCE valueExpression valueExpression*)
+	|	^(SIMPLE_CASE valueExpression simpleCaseWhenClause+ elseClause?)
+	|	^(SEARCHED_CASE searchedWhenClause+ elseClause?)
+	;
+
+simpleCaseWhenClause
+	:	^(WHEN valueExpression valueExpression)
+	;
+
+searchedWhenClause
+	:	^(WHEN searchCondition valueExpression)
+	;
+
+elseClause
+	:	^(ELSE valueExpression)
+	;
+
+function
+	:	standardFunction
+	|	setFunction
+	;
+
+standardFunction
+	:	castFunction
+	|	concatFunction
+	|	substringFunction
+	|	trimFunction
+	|	upperFunction
+	|	lowerFunction
+	|	lengthFunction
+	|	locateFunction
+	|	absFunction
+	|	sqrtFunction
+	|	modFunction
+	|	sizeFunction
+	|	indexFunction
+	|	currentDateFunction
+	|	currentTimeFunction
+	|	currentTimestampFunction
+	|	extractFunction
+	|	positionFunction
+	|	charLengthFunction
+	|	octetLengthFunction
+	|	bitLengthFunction
+	;
+
+castFunction
+	:	^(CAST valueExpression IDENTIFIER)
+	;
+
+concatFunction
+	:	^(CONCAT valueExpression+)
+	;
+
+substringFunction
+	:	^(SUBSTRING characterValueExpression numericValueExpression numericValueExpression?)
+	;
+
+trimFunction
+	:	^(TRIM trimOperands)
+	;
+
+trimOperands
+	:	^((LEADING|TRAILING|BOTH) characterValueExpression characterValueExpression)
+	;
+
+upperFunction
+	:	^(UPPER characterValueExpression)
+	;
+
+lowerFunction
+	:	^(LOWER characterValueExpression)
+	;
+
+lengthFunction
+	:	^(LENGTH characterValueExpression)
+	;
+
+locateFunction
+	:	^(LOCATE characterValueExpression characterValueExpression numericValueExpression?)
+	;
+
+absFunction
+	:	^(ABS numericValueExpression)
+	;
+
+sqrtFunction
+	:	^(SQRT numericValueExpression)
+	;
+
+modFunction
+	:	^(MOD numericValueExpression numericValueExpression)
+	;
+
+sizeFunction
+	:	^(SIZE propertyReference)
+	;
+
+indexFunction
+	:	^(INDEX ALIAS_REF)
+	;
+
+currentDateFunction
+	:	CURRENT_DATE
+	;
+
+currentTimeFunction
+	:	CURRENT_TIME
+	;
+
+currentTimestampFunction
+	:	CURRENT_TIMESTAMP
+	;
+
+extractFunction
+	:	^(EXTRACT extractField datetimeValueExpression)
+	;
+
+extractField
+	:	datetimeField
+	|	timeZoneField
+	;
+
+datetimeField
+	:	YEAR
+	|	MONTH
+	|	DAY
+	|	HOUR
+	|	MINUTE
+	|	SECOND
+	;
+
+timeZoneField
+	:	TIMEZONE_HOUR
+	|	TIMEZONE_MINUTE
+	;
+
+positionFunction
+	:	^(POSITION characterValueExpression characterValueExpression)
+	;
+
+charLengthFunction
+	:	^(CHARACTER_LENGTH characterValueExpression)
+	;
+
+octetLengthFunction
+	:	^(OCTET_LENGTH characterValueExpression)	
+	;
+
+bitLengthFunction
+	:	^(BIT_LENGTH characterValueExpression)
+	;
+
+setFunction
+	:	^(SUM numericValueExpression)
+	|	^(AVG numericValueExpression)
+	|	^(MAX numericValueExpression)
+	|	^(MIN numericValueExpression)
+	|	^(COUNT (ASTERISK | (DISTINCT|ALL) countFunctionArguments))
+	;
+
+countFunctionArguments
+	:	collectionExpression
+	|	propertyReference
+	|	numeric_literal
+	;
+
+collectionFunction
+	:	^((MAXELEMENT|MAXINDEX|MINELEMENT|MININDEX) collectionPropertyReference)
+		//it will generate a SELECT MAX (m.column) form Table xxx -> it is realted to Hibernate mappings to Table->Map
+	;
+
+collectionPropertyReference
+	:	propertyReference
+	;
+
+collectionExpression
+	:	^(ELEMENTS propertyReference) //it will generate a SELECT m.column form Table xxx -> it is realted to Hibernate mappings to Table->Map
+	|	^(INDICES propertyReference)
+	;
+
+parameter
+	:	NAMED_PARAM
+	|	JPA_PARAM
+	|	PARAM
+	;
+
+constant
+	:	literal
+	|	NULL
+	|	TRUE
+	|	FALSE
+	;
+
+literal
+	:	numeric_literal
+	|	HEX_LITERAL
+	|	OCTAL_LITERAL
+	|	CHARACTER_LITERAL
+	|	STRING_LITERAL
+	;
+
+numeric_literal
+	:	INTEGER_LITERAL
+	|	DECIMAL_LITERAL
+	|	FLOATING_POINT_LITERAL
+	;
+
+entityName
+	:	ENTITY_NAME ALIAS_NAME
+	{	registerPersisterSpace($ENTITY_NAME, $ALIAS_NAME);	}
+	;
+
+propertyReference
+	:	^(PROPERTY_REFERENCE propertyReferencePath)
+	;
+
+propertyReferencePath
+	: 	{isUnqualifiedPropertyReference()}? unqualifiedPropertyReference
+	|	pathedPropertyReference
+    |	terminalIndexOperation
+	;
+
+unqualifiedPropertyReference returns [PathedPropertyReferenceSource propertyReferenceSource]
+	:	IDENTIFIER
+	{	$propertyReferenceSource = normalizeUnqualifiedPropertyReference( $IDENTIFIER ); }
+	;
+
+pathedPropertyReference
+	:	^(DOT pathedPropertyReferenceSource IDENTIFIER)
+	{	normalizePropertyPathTerminus( $pathedPropertyReferenceSource.propertyReferenceSource, $IDENTIFIER );	}
+	;
+
+pathedPropertyReferenceSource returns [PathedPropertyReferenceSource propertyReferenceSource]
+	:	{(isPersisterReferenceAlias())}?=> IDENTIFIER { $propertyReferenceSource = normalizeQualifiedRoot( $IDENTIFIER ); }
+    |	{(isUnqualifiedPropertyReference())}?=> IDENTIFIER { $propertyReferenceSource = normalizeUnqualifiedRoot( $IDENTIFIER ); }
+    |	intermediatePathedPropertyReference { $propertyReferenceSource = $intermediatePathedPropertyReference.propertyReferenceSource; }
+    |	intermediateIndexOperation { $propertyReferenceSource = null; }
+    ;
+
+intermediatePathedPropertyReference returns [PathedPropertyReferenceSource propertyReferenceSource]
+	:	^(DOT source=pathedPropertyReferenceSource IDENTIFIER )
+	{	$propertyReferenceSource = normalizePropertyPathIntermediary( $pathedPropertyReferenceSource.propertyReferenceSource, $IDENTIFIER );	}
+	;
+
+intermediateIndexOperation
+	:	^( LEFT_SQUARE indexOperationSource indexSelector ) 
+	{	normalizeIntermediateIndexOperation( $indexOperationSource.tree, $indexSelector.tree );	}
+	;
+
+terminalIndexOperation
+	:	^( LEFT_SQUARE indexOperationSource indexSelector ) 
+	{	normalizeTerminalIndexOperation( $indexOperationSource.tree, $indexSelector.tree );	}
+	;
+
+indexOperationSource returns [PathedPropertyReferenceSource propertyReferenceSource, Tree collectionProperty]
+	:	^(DOT pathedPropertyReferenceSource IDENTIFIER )
+    |	{(isUnqualifiedPropertyReference())}?=> IDENTIFIER
+    {	$propertyReferenceSource = normalizeUnqualifiedPropertyReferenceSource( $IDENTIFIER );	}
+	;
+
+indexSelector
+	:	valueExpression
+	;
+
+path
+	: 	IDENTIFIER
+	|	^(DOT path path )
+	|	^(LEFT_SQUARE path valueExpression* )
+	|	^(LEFT_PAREN path valueExpression* )
+	;


Property changes on: core/branches/antlr3/src/main/antlr3/org/hibernate/sql/ast/phase/hql/resolve/GeneratedHQLResolver.g
___________________________________________________________________
Name: svn:eol-style
   + native

Deleted: core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java
===================================================================
--- core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java	2009-04-23 14:51:55 UTC (rev 16424)
+++ core/branches/antlr3/src/main/java/org/hibernate/sql/ast/phase/hql/resolve/HQLResolution.java	2009-04-23 15:27:36 UTC (rev 16425)
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors.  All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA  02110-1301  USA
- */
-package org.hibernate.sql.ast.phase.hql.resolve;
-
-import org.antlr.runtime.RecognizerSharedState;
-import org.antlr.runtime.tree.CommonTree;
-import org.antlr.runtime.tree.Tree;
-import org.antlr.runtime.tree.TreeNodeStream;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.persister.entity.Queryable;
-import org.hibernate.sql.ast.alias.DefaultTableAliasGenerator;
-import org.hibernate.sql.ast.alias.TableAliasGenerator;
-import org.hibernate.sql.ast.common.JoinType;
-import org.hibernate.sql.ast.phase.hql.parse.HQLParser;
-import org.hibernate.sql.ast.phase.hql.resolve.path.PathResolutionStrategy;
-import org.hibernate.sql.ast.phase.hql.resolve.path.PathResolutionStrategyStack;
-import org.hibernate.sql.ast.phase.hql.resolve.path.PathedPropertyReferenceSource;
-import org.hibernate.sql.ast.phase.hql.resolve.path.impl.BasicPathResolutionStrategySupport;
-import org.hibernate.sql.ast.phase.hql.resolve.path.impl.FromClausePathResolutionStrategy;
-import org.hibernate.sql.ast.phase.hql.resolve.path.impl.SelectClausePathResolutionStrategy;
-import org.hibernate.sql.ast.tree.Table;
-import org.hibernate.sql.ast.tree.Table.EntityTableSpace;
-import org.hibernate.sql.ast.util.TreePrinter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class HQLResolution extends GeneratedHQLResolution implements
-		ResolutionContext {
-	private static final Logger log = LoggerFactory
-			.getLogger( HQLResolution.class );
-
-	private final SessionFactoryImplementor sessionFactory;
-	private final PersisterSpaceContext persisterSpaceContext;
-	private final DefaultTableAliasGenerator defaultTableAliasGenerator;
-	private final PathResolutionStrategyStack pathResolutionStrategyStack;
-	private final TreePrinter printer;
-
-	private boolean isProcessingFunction = false;
-
-	public HQLResolution( TreeNodeStream input,
-			SessionFactoryImplementor sessionFactory ) {
-		this( input, new RecognizerSharedState(), sessionFactory );
-	}
-
-	public HQLResolution( TreeNodeStream input, RecognizerSharedState state,
-			SessionFactoryImplementor sessionFactory ) {
-		super( input, state );
-		this.sessionFactory = sessionFactory;
-		this.persisterSpaceContext = new RootPersisterSpaceContext();
-		this.defaultTableAliasGenerator = new DefaultTableAliasGenerator(
-				sessionFactory.getDialect() );
-		this.printer = new TreePrinter( HQLParser.class );
-		this.pathResolutionStrategyStack = new PathResolutionStrategyStack();
-		this.pathResolutionStrategyStack
-				.push( new BasicPathResolutionStrategySupport( this ) );
-	}
-
-	protected void registerPersisterSpace( CommonTree entityName,
-			CommonTree alias ) {
-		String entityPersisterName = sessionFactory
-				.getImportedClassName( entityName.getText() );
-		Queryable entityPersister = ( Queryable ) sessionFactory
-				.getEntityPersister( entityPersisterName );
-
-		TableAliasGenerator.TableAliasRoot tableAliasRoot = getTableAliasGenerator()
-				.generateSqlAliasRoot( entityPersister, alias.getText() );
-		EntityTableSpace tableSpace = new Table.EntityTableSpace(
-				entityPersister, tableAliasRoot );
-		registerPersisterSpace( tableSpace.getPersisterSpace() );
-	}
-
-	public PersisterSpaceContext getCurrentPersisterSpaceContext() {
-		return persisterSpaceContext;
-	}
-
-	public SessionFactoryImplementor getSessionFactoryImplementor() {
-		return sessionFactory;
-	}
-
-	public TableAliasGenerator getTableAliasGenerator() {
-		return defaultTableAliasGenerator;
-	}
-
-	public TreePrinter getTreePrinter() {
-		return printer;
-	}
-
-	public boolean isCurrentlyProcessingFunction() {
-		return isProcessingFunction;
-	}
-
-	public PathResolutionStrategyStack getPathResolutionStrategyStack() {
-		return pathResolutionStrategyStack;
-	}
-
-	public PathResolutionStrategy getCurrentPathResolutionStrategy() {
-		return pathResolutionStrategyStack.getCurrent();
-	}
-
-	public void registerAssociationFetch( PersisterSpace persisterSpace ) {
-		// TODO Auto-generated method stub
-		persisterSpaceContext.registerPersisterSpace( persisterSpace );
-	}
-
-	public void registerPropertyFetch( PersisterSpace persisterSpace ) {
-		// TODO Auto-generated method stub
-	}
-
-	protected void pushFromStrategy( JoinType joinType,
-			CommonTree assosiationFetchTree, CommonTree propertyFetchTree,
-			CommonTree alias ) {
-		boolean assosiationFetch = assosiationFetchTree != null ? true : false;
-		boolean propertyFetch = propertyFetchTree != null ? true : false;
-		pathResolutionStrategyStack.push( new FromClausePathResolutionStrategy(
-				this, joinType, assosiationFetch, propertyFetch, alias
-						.getText() ) );
-	}
-
-	protected void pushSelectStrategy() {
-		pathResolutionStrategyStack
-				.push( new SelectClausePathResolutionStrategy( this ) );
-	}
-
-	protected void popStrategy() {
-		pathResolutionStrategyStack.pop();
-	}
-
-	protected void registerEntityPersisterSpace( CommonTree entityName,
-			CommonTree alias ) {
-		// String entityPersisterName = sessionFactory
-		// .getImportedClassName( entityName.getText() );
-		// EntityPersister entityPersister = sessionFactory
-		// .getEntityPersister( entityPersisterName );
-		//
-		// EntityTableSpace tableSpace = new Table.EntityTableSpace(
-		// ( Queryable ) entityPersister, getTableAliasGenerator()
-		// .generateSqlAliasRoot( ( Queryable ) entityPersister,
-		// alias.getText() ) );
-		// registerPersisterSpace( tableSpace.getPersisterSpace() );
-	}
-
-	private void registerPersisterSpace( PersisterSpace persisterSpace ) {
-		persisterSpaceContext.registerPersisterSpace( persisterSpace );
-	}
-
-	protected boolean isUnqualifiedPropertyReference() {
-		return locateOwningPersisterAlias( ( Tree ) input.LT( 1 ) ) != null;
-	}
-
-	protected String locateOwningPersisterAlias( Tree property ) {
-		PersisterSpace persisterReference = getCurrentPersisterSpaceContext()
-				.locatePersisterSpaceExposingProperty( property.getText() );
-		return persisterReference == null ? null : persisterReference
-				.getSourceAlias();
-	}
-
-	protected boolean isPersisterReferenceAlias() {
-		Tree alias = ( Tree ) input.LT( 1 );
-		log.trace( "Checking [" + textOrNull( alias )
-				+ "] as persister-ref alias" );
-		return getCurrentPersisterSpaceContext().isContainedAlias(
-				alias.getText() );
-	}
-
-	protected Tree normalizeUnqualifiedPropertyReference( CommonTree property ) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	protected PathedPropertyReferenceSource normalizeUnqualifiedRoot(
-			CommonTree identifier ) {
-		System.out
-				.println( "normalizeUnqualifiedRoot: " + identifier.getText() );
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	protected PathedPropertyReferenceSource normalizeQualifiedRoot(
-			CommonTree alias ) {
-		log.debug( "normalizing path expression root as alias ["
-				+ alias.getText() + "]" );
-
-		return getCurrentPathResolutionStrategy().handleRoot(
-				getCurrentPersisterSpaceContext().locatePersisterSpaceByAlias(
-						alias.getText() ) );
-	}
-
-	protected void normalizePropertyPathTerminus(
-			PathedPropertyReferenceSource source, CommonTree propertyNameNode ) {
-		log.trace( "normalizing terminal path expression ["
-				+ textOrNull( propertyNameNode ) + "]" );
-		getCurrentPathResolutionStrategy().handleTerminalPathPart( source,
-				propertyNameNode.getText() );
-	}
-
-	protected PathedPropertyReferenceSource normalizePropertyPathIntermediary(
-			PathedPropertyReferenceSource source, CommonTree propertyName ) {
-		log.trace( "normalizing intermediate path expression ["
-				+ textOrNull( propertyName ) + "]" );
-		return getCurrentPathResolutionStrategy().handleIntermediatePathPart(
-				( PathedPropertyReferenceSource ) source,
-				propertyName.getText() );
-	}
-
-	protected void normalizeIntermediateIndexOperation( CommonTree identifier1,
-			CommonTree identifier2 ) {
-		System.out.println( "normalizeIntermediateIndexOperation: "
-				+ identifier1.getText() + ":" + identifier2.getText() );
-		// TODO Auto-generated method stub
-	}
-
-	protected void normalizeUnqualifiedPropertyReferenceSource(
-			CommonTree identifier ) {
-		System.out.println( "normalizeUnqualifiedPropertyReferenceSource: "
-				+ identifier.getText() );
-		// TODO Auto-generated method stub
-	}
-
-	protected void normalizeTerminalIndexOperation( CommonTree collectionPath,
-			CommonTree selector ) {
-		// TODO Auto-generated method stub
-	}
-
-	private String textOrNull( Tree tree ) {
-		return tree == null ? null : tree.getText();
-	}
-
-}
\ No newline at end of file

Modified: core/branches/antlr3/src/test/java/org/hibernate/sql/ast/phase/hql/resolve/TestHQLResolver.java
===================================================================
--- core/branches/antlr3/src/test/java/org/hibernate/sql/ast/phase/hql/resolve/TestHQLResolver.java	2009-04-23 14:51:55 UTC (rev 16424)
+++ core/branches/antlr3/src/test/java/org/hibernate/sql/ast/phase/hql/resolve/TestHQLResolver.java	2009-04-23 15:27:36 UTC (rev 16425)
@@ -44,7 +44,7 @@
 	}
 
 	public void testBasicSelectStructure() throws Throwable {
-		Tree queryTree = normalize( "select a.id from Animal a" );
+		Tree queryTree = normalize( "from Zoo z where mammals['dog'] = ?" );
 	}
 
 	public Tree normalize( String hql ) throws RecognitionException {
@@ -62,7 +62,7 @@
 		CommonTreeNodeStream nodes = new CommonTreeNodeStream( result );
 		nodes.setTokenStream( tokens );
 
-		HQLResolution resololution = new HQLResolution( nodes, sessionFactory );
+		HQLResolver resololution = new HQLResolver( nodes, sessionFactory );
 
 		System.out.println( resololution.getTreePrinter().renderAsString(
 				result, "Parser Result" ) );




More information about the hibernate-commits mailing list