org.hibernate.hql.antlr
Class HqlSqlBaseWalker

java.lang.Object
  extended byantlr.TreeParser
      extended byorg.hibernate.hql.antlr.HqlSqlBaseWalker
All Implemented Interfaces:
HqlSqlTokenTypes
Direct Known Subclasses:
HqlSqlWalker

public class HqlSqlBaseWalker
extends antlr.TreeParser
implements HqlSqlTokenTypes

Hibernate Query Language to SQL Tree Transform.
This is a tree grammar that transforms an HQL AST into a intermediate SQL AST with bindings to Hibernate interfaces (Queryable, etc.). The Hibernate specific methods are all implemented in the HqlSqlWalker subclass, allowing the ANTLR-generated class to have only the minimum dependencies on the Hibernate code base. This will also allow the sub-class to be easily edited using an IDE (most IDE's don't support ANTLR).
NOTE: The java class is generated from hql-sql.g by ANTLR. DO NOT EDIT THE GENERATED JAVA SOURCE CODE.

Author:
Joshua Davis (joshua@hibernate.org)

Field Summary
static String[] _tokenNames
           
static antlr.collections.impl.BitSet _tokenSet_0
           
 
Fields inherited from class antlr.TreeParser
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth
 
Fields inherited from interface org.hibernate.hql.antlr.HqlSqlTokenTypes
AGGREGATE, ALIAS, ALIAS_REF, ALL, AND, ANY, AS, ASCENDING, AVG, BETWEEN, BOGUS, BOTH, CASE, CASE2, CLASS, CLOSE, CLOSE_BRACKET, COLON, COMMA, CONCAT, CONSTANT, CONSTRUCTOR, COUNT, DELETE, DESCENDING, DISTINCT, DIV, DOT, ELEMENTS, ELSE, EMPTY, END, EOF, EQ, ESCAPE, ESCqs, EXISTS, EXPONENT, EXPR_LIST, FALSE, FETCH, FILTER_ENTITY, FILTERS, FLOAT_SUFFIX, FROM, FROM_FRAGMENT, FULL, GE, GROUP, GT, HAVING, HEX_DIGIT, IDENT, IMPLIED_FROM, IN, IN_LIST, INDEX_OP, INDICES, INNER, IS, IS_NOT_NULL, IS_NULL, JOIN, JOIN_FRAGMENT, LE, LEADING, LEFT, LEFT_OUTER, LIKE, LITERAL_ascending, LITERAL_by, LITERAL_descending, LT, MAX, MEMBER, METHOD_CALL, METHOD_NAME, MIN, MINUS, NAMED_PARAM, NE, NEW, NOT, NOT_BETWEEN, NOT_IN, NOT_LIKE, NULL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJECT, OF, ON, OPEN, OPEN_BRACKET, OR, ORDER, ORDER_ELEMENT, OUTER, PARAM, PLUS, PROPERTIES, PROPERTY_REF, QUERY, QUOTED_STRING, RANGE, RIGHT, RIGHT_OUTER, ROW_STAR, SELECT, SELECT_CLAUSE, SELECT_COLUMNS, SELECT_EXPR, SELECT_FROM, SET, SOME, SQL_NE, SQL_TOKEN, STAR, SUM, THEN, THETA_JOINS, TRAILING, TRUE, UNARY_MINUS, UNARY_PLUS, UNION, UPDATE, VECTOR_EXPR, WEIRD_IDENT, WHEN, WHERE, WS
 
Constructor Summary
HqlSqlBaseWalker()
           
 
Method Summary
 void addrExpr(antlr.collections.AST _t, boolean root)
           
 void addrExprLhs(antlr.collections.AST _t)
           
protected  void afterQuery(String ruleName, antlr.collections.AST s, antlr.collections.AST query)
           
 void aggregateExpr(antlr.collections.AST _t)
           
 void aliasedSelectExpr(antlr.collections.AST _t)
           
 void aliasRef(antlr.collections.AST _t)
           
 void arithmeticExpr(antlr.collections.AST _t)
           
 void assignment(antlr.collections.AST _t)
           
protected  void beforeQuery(String ruleName)
           
protected  void beforeSelectClause()
           
 void caseExpr(antlr.collections.AST _t)
           
 void collectionFunction(antlr.collections.AST _t)
           
 void collectionFunctionOrSubselect(antlr.collections.AST _t)
           
 void comparisonExpr(antlr.collections.AST _t)
           
 void constant(antlr.collections.AST _t)
           
 void constructor(antlr.collections.AST _t)
           
 void count(antlr.collections.AST _t)
           
protected  antlr.collections.AST createFromElement(String path, antlr.collections.AST alias, antlr.collections.AST propertyFetch)
           
protected  antlr.collections.AST createFromFilterElement(antlr.collections.AST filterEntity, antlr.collections.AST alias)
           
protected  void createFromJoinElement(antlr.collections.AST path, antlr.collections.AST alias, int joinType, antlr.collections.AST fetch, antlr.collections.AST propertyFetch)
           
 void deleteStatement(antlr.collections.AST _t)
           
 void expr(antlr.collections.AST _t)
           
 void exprOrSubquery(antlr.collections.AST _t)
           
 void fromClause(antlr.collections.AST _t)
           
 void fromElement(antlr.collections.AST _t)
           
 void fromElementList(antlr.collections.AST _t)
           
 void functionCall(antlr.collections.AST _t)
           
 int getStatementType()
           
 void groupClause(antlr.collections.AST _t)
           
 void identifier(antlr.collections.AST _t)
           
 void inLhs(antlr.collections.AST _t)
           
 void inRhs(antlr.collections.AST _t)
           
 boolean isInFrom()
           
 boolean isInFunctionCall()
           
 boolean isInSelect()
           
 boolean isSelectStatement()
           
 boolean isSubQuery()
           
 void joinElement(antlr.collections.AST _t)
           
 int joinType(antlr.collections.AST _t)
           
 void literal(antlr.collections.AST _t)
           
 void logicalExpr(antlr.collections.AST _t)
           
protected  void lookupAlias(antlr.collections.AST ident)
           
protected  antlr.collections.AST lookupProperty(antlr.collections.AST dot, boolean root, boolean inSelect)
           
protected  void namedParameter(antlr.collections.AST namedParameter)
           
 void newValue(antlr.collections.AST _t)
           
 void nonNestedPropertyRef(antlr.collections.AST _t)
           
 void orderClause(antlr.collections.AST _t)
           
 void orderExprs(antlr.collections.AST _t)
           
 void parameter(antlr.collections.AST _t)
           
 String path(antlr.collections.AST _t)
           
protected  void positionalParameter(antlr.collections.AST namedParameter)
           
protected  void postProcessDelete(antlr.collections.AST delete)
           
protected  void postProcessUpdate(antlr.collections.AST update)
           
protected  void prepareFromClauseInputTree(antlr.collections.AST fromClauseInput)
          Pre-process the from clause input tree.
protected  void processBoolean(antlr.collections.AST constant)
           
protected  void processConstant(antlr.collections.AST constant)
           
protected  void processConstructor(antlr.collections.AST constructor)
           
protected  void processFunction(antlr.collections.AST functionCall, boolean inSelect)
           
protected  void processIndex(antlr.collections.AST indexOp)
           
protected  void processQuery(antlr.collections.AST select, antlr.collections.AST query)
           
 void propertyName(antlr.collections.AST _t)
           
 void propertyRef(antlr.collections.AST _t)
           
 void propertyRefLhs(antlr.collections.AST _t)
           
protected  void pushFromClause(antlr.collections.AST fromClause, antlr.collections.AST inputFromNode)
          Sets the current 'FROM' context.
 void query(antlr.collections.AST _t)
           
protected  void resolve(antlr.collections.AST node)
           
protected  void resolveSelectExpression(antlr.collections.AST dotNode)
           
 void selectClause(antlr.collections.AST _t)
           
 void selectExpr(antlr.collections.AST _t)
           
 void selectExprList(antlr.collections.AST _t)
           
 void selectStatement(antlr.collections.AST _t)
           
 void setClause(antlr.collections.AST _t)
           
protected  void setImpliedJoinType(int joinType)
           
 void statement(antlr.collections.AST _t)
           
 void updateStatement(antlr.collections.AST _t)
           
 void whereClause(antlr.collections.AST _t)
           
 
Methods inherited from class antlr.TreeParser
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportError, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tokenNames

public static final String[] _tokenNames

_tokenSet_0

public static final antlr.collections.impl.BitSet _tokenSet_0
Constructor Detail

HqlSqlBaseWalker

public HqlSqlBaseWalker()
Method Detail

isSubQuery

public boolean isSubQuery()

isInFrom

public boolean isInFrom()

isInFunctionCall

public boolean isInFunctionCall()

isInSelect

public boolean isInSelect()

getStatementType

public int getStatementType()

isSelectStatement

public boolean isSelectStatement()

prepareFromClauseInputTree

protected void prepareFromClauseInputTree(antlr.collections.AST fromClauseInput)
Pre-process the from clause input tree.


pushFromClause

protected void pushFromClause(antlr.collections.AST fromClause,
                              antlr.collections.AST inputFromNode)
Sets the current 'FROM' context.


createFromElement

protected antlr.collections.AST createFromElement(String path,
                                                  antlr.collections.AST alias,
                                                  antlr.collections.AST propertyFetch)
                                           throws antlr.SemanticException
Throws:
antlr.SemanticException

createFromJoinElement

protected void createFromJoinElement(antlr.collections.AST path,
                                     antlr.collections.AST alias,
                                     int joinType,
                                     antlr.collections.AST fetch,
                                     antlr.collections.AST propertyFetch)
                              throws antlr.SemanticException
Throws:
antlr.SemanticException

createFromFilterElement

protected antlr.collections.AST createFromFilterElement(antlr.collections.AST filterEntity,
                                                        antlr.collections.AST alias)
                                                 throws antlr.SemanticException
Throws:
antlr.SemanticException

processQuery

protected void processQuery(antlr.collections.AST select,
                            antlr.collections.AST query)
                     throws antlr.SemanticException
Throws:
antlr.SemanticException

postProcessUpdate

protected void postProcessUpdate(antlr.collections.AST update)
                          throws antlr.SemanticException
Throws:
antlr.SemanticException

postProcessDelete

protected void postProcessDelete(antlr.collections.AST delete)
                          throws antlr.SemanticException
Throws:
antlr.SemanticException

beforeSelectClause

protected void beforeSelectClause()
                           throws antlr.SemanticException
Throws:
antlr.SemanticException

processIndex

protected void processIndex(antlr.collections.AST indexOp)
                     throws antlr.SemanticException
Throws:
antlr.SemanticException

processConstant

protected void processConstant(antlr.collections.AST constant)
                        throws antlr.SemanticException
Throws:
antlr.SemanticException

processBoolean

protected void processBoolean(antlr.collections.AST constant)
                       throws antlr.SemanticException
Throws:
antlr.SemanticException

resolve

protected void resolve(antlr.collections.AST node)
                throws antlr.SemanticException
Throws:
antlr.SemanticException

resolveSelectExpression

protected void resolveSelectExpression(antlr.collections.AST dotNode)
                                throws antlr.SemanticException
Throws:
antlr.SemanticException

processFunction

protected void processFunction(antlr.collections.AST functionCall,
                               boolean inSelect)
                        throws antlr.SemanticException
Throws:
antlr.SemanticException

processConstructor

protected void processConstructor(antlr.collections.AST constructor)
                           throws antlr.SemanticException
Throws:
antlr.SemanticException

namedParameter

protected void namedParameter(antlr.collections.AST namedParameter)
                       throws antlr.SemanticException
Throws:
antlr.SemanticException

positionalParameter

protected void positionalParameter(antlr.collections.AST namedParameter)
                            throws antlr.SemanticException
Throws:
antlr.SemanticException

lookupAlias

protected void lookupAlias(antlr.collections.AST ident)
                    throws antlr.SemanticException
Throws:
antlr.SemanticException

lookupProperty

protected antlr.collections.AST lookupProperty(antlr.collections.AST dot,
                                               boolean root,
                                               boolean inSelect)
                                        throws antlr.SemanticException
Throws:
antlr.SemanticException

setImpliedJoinType

protected void setImpliedJoinType(int joinType)

beforeQuery

protected void beforeQuery(String ruleName)
                    throws antlr.SemanticException
Throws:
antlr.SemanticException

afterQuery

protected void afterQuery(String ruleName,
                          antlr.collections.AST s,
                          antlr.collections.AST query)
                   throws antlr.SemanticException
Throws:
antlr.SemanticException

statement

public final void statement(antlr.collections.AST _t)
                     throws antlr.RecognitionException
Throws:
antlr.RecognitionException

selectStatement

public final void selectStatement(antlr.collections.AST _t)
                           throws antlr.RecognitionException
Throws:
antlr.RecognitionException

updateStatement

public final void updateStatement(antlr.collections.AST _t)
                           throws antlr.RecognitionException
Throws:
antlr.RecognitionException

deleteStatement

public final void deleteStatement(antlr.collections.AST _t)
                           throws antlr.RecognitionException
Throws:
antlr.RecognitionException

query

public final void query(antlr.collections.AST _t)
                 throws antlr.RecognitionException
Throws:
antlr.RecognitionException

fromClause

public final void fromClause(antlr.collections.AST _t)
                      throws antlr.RecognitionException
Throws:
antlr.RecognitionException

setClause

public final void setClause(antlr.collections.AST _t)
                     throws antlr.RecognitionException
Throws:
antlr.RecognitionException

whereClause

public final void whereClause(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

assignment

public final void assignment(antlr.collections.AST _t)
                      throws antlr.RecognitionException
Throws:
antlr.RecognitionException

nonNestedPropertyRef

public final void nonNestedPropertyRef(antlr.collections.AST _t)
                                throws antlr.RecognitionException
Throws:
antlr.RecognitionException

newValue

public final void newValue(antlr.collections.AST _t)
                    throws antlr.RecognitionException
Throws:
antlr.RecognitionException

addrExpr

public final void addrExpr(antlr.collections.AST _t,
                           boolean root)
                    throws antlr.RecognitionException
Throws:
antlr.RecognitionException

expr

public final void expr(antlr.collections.AST _t)
                throws antlr.RecognitionException
Throws:
antlr.RecognitionException

selectClause

public final void selectClause(antlr.collections.AST _t)
                        throws antlr.RecognitionException
Throws:
antlr.RecognitionException

groupClause

public final void groupClause(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

orderClause

public final void orderClause(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

orderExprs

public final void orderExprs(antlr.collections.AST _t)
                      throws antlr.RecognitionException
Throws:
antlr.RecognitionException

logicalExpr

public final void logicalExpr(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

selectExprList

public final void selectExprList(antlr.collections.AST _t)
                          throws antlr.RecognitionException
Throws:
antlr.RecognitionException

selectExpr

public final void selectExpr(antlr.collections.AST _t)
                      throws antlr.RecognitionException
Throws:
antlr.RecognitionException

aliasedSelectExpr

public final void aliasedSelectExpr(antlr.collections.AST _t)
                             throws antlr.RecognitionException
Throws:
antlr.RecognitionException

identifier

public final void identifier(antlr.collections.AST _t)
                      throws antlr.RecognitionException
Throws:
antlr.RecognitionException

propertyRef

public final void propertyRef(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

aliasRef

public final void aliasRef(antlr.collections.AST _t)
                    throws antlr.RecognitionException
Throws:
antlr.RecognitionException

constructor

public final void constructor(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

functionCall

public final void functionCall(antlr.collections.AST _t)
                        throws antlr.RecognitionException
Throws:
antlr.RecognitionException

count

public final void count(antlr.collections.AST _t)
                 throws antlr.RecognitionException
Throws:
antlr.RecognitionException

collectionFunction

public final void collectionFunction(antlr.collections.AST _t)
                              throws antlr.RecognitionException
Throws:
antlr.RecognitionException

literal

public final void literal(antlr.collections.AST _t)
                   throws antlr.RecognitionException
Throws:
antlr.RecognitionException

arithmeticExpr

public final void arithmeticExpr(antlr.collections.AST _t)
                          throws antlr.RecognitionException
Throws:
antlr.RecognitionException

aggregateExpr

public final void aggregateExpr(antlr.collections.AST _t)
                         throws antlr.RecognitionException
Throws:
antlr.RecognitionException

path

public final String path(antlr.collections.AST _t)
                  throws antlr.RecognitionException
Throws:
antlr.RecognitionException

fromElementList

public final void fromElementList(antlr.collections.AST _t)
                           throws antlr.RecognitionException
Throws:
antlr.RecognitionException

fromElement

public final void fromElement(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

joinElement

public final void joinElement(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

joinType

public final int joinType(antlr.collections.AST _t)
                   throws antlr.RecognitionException
Throws:
antlr.RecognitionException

comparisonExpr

public final void comparisonExpr(antlr.collections.AST _t)
                          throws antlr.RecognitionException
Throws:
antlr.RecognitionException

exprOrSubquery

public final void exprOrSubquery(antlr.collections.AST _t)
                          throws antlr.RecognitionException
Throws:
antlr.RecognitionException

inLhs

public final void inLhs(antlr.collections.AST _t)
                 throws antlr.RecognitionException
Throws:
antlr.RecognitionException

inRhs

public final void inRhs(antlr.collections.AST _t)
                 throws antlr.RecognitionException
Throws:
antlr.RecognitionException

collectionFunctionOrSubselect

public final void collectionFunctionOrSubselect(antlr.collections.AST _t)
                                         throws antlr.RecognitionException
Throws:
antlr.RecognitionException

constant

public final void constant(antlr.collections.AST _t)
                    throws antlr.RecognitionException
Throws:
antlr.RecognitionException

parameter

public final void parameter(antlr.collections.AST _t)
                     throws antlr.RecognitionException
Throws:
antlr.RecognitionException

caseExpr

public final void caseExpr(antlr.collections.AST _t)
                    throws antlr.RecognitionException
Throws:
antlr.RecognitionException

addrExprLhs

public final void addrExprLhs(antlr.collections.AST _t)
                       throws antlr.RecognitionException
Throws:
antlr.RecognitionException

propertyName

public final void propertyName(antlr.collections.AST _t)
                        throws antlr.RecognitionException
Throws:
antlr.RecognitionException

propertyRefLhs

public final void propertyRefLhs(antlr.collections.AST _t)
                          throws antlr.RecognitionException
Throws:
antlr.RecognitionException