org.hibernate.hql.antlr

Class HqlSqlBaseWalker

Implemented Interfaces:
HqlSqlTokenTypes
Known Direct Subclasses:
HqlSqlWalker

public class HqlSqlBaseWalker
extends 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 BitSet
_tokenSet_0

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, FILTERS, FILTER_ENTITY, FLOAT_SUFFIX, FROM, FROM_FRAGMENT, FULL, GE, GROUP, GT, HAVING, HEX_DIGIT, IDENT, ID_LETTER, ID_START_LETTER, IMPLIED_FROM, IN, INDEX_OP, INDICES, INNER, INSERT, INTO, IN_LIST, IS, IS_NOT_NULL, IS_NULL, JAVA_CONSTANT, 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, VERSIONED, WEIRD_IDENT, WHEN, WHERE, WITH, WS

Constructor Summary

HqlSqlBaseWalker()

Method Summary

void
addrExpr(AST _t, boolean root)
void
addrExprLhs(AST _t)
void
aggregateExpr(AST _t)
void
aliasRef(AST _t)
void
aliasedSelectExpr(AST _t)
void
arithmeticExpr(AST _t)
void
assignment(AST _t)
protected void
beforeSelectClause()
void
caseExpr(AST _t)
void
collectionFunction(AST _t)
void
collectionFunctionOrSubselect(AST _t)
void
comparisonExpr(AST _t)
void
constant(AST _t)
void
constructor(AST _t)
void
count(AST _t)
protected AST
createFromElement(String path, AST alias, AST propertyFetch)
protected AST
createFromFilterElement(AST filterEntity, AST alias)
protected void
createFromJoinElement(AST path, AST alias, int joinType, AST fetch, AST propertyFetch, AST with)
protected AST
createIntoClause(String path, AST propertySpec)
void
deleteStatement(AST _t)
protected void
evaluateAssignment(AST eq)
void
expr(AST _t)
void
exprOrSubquery(AST _t)
void
fromClause(AST _t)
void
fromElement(AST _t)
void
fromElementList(AST _t)
void
functionCall(AST _t)
protected AST
generateNamedParameter(AST delimiterNode, AST nameNode)
protected AST
generatePositionalParameter(AST inputNode)
int
getCurrentClauseType()
int
getCurrentStatementType()
int
getCurrentTopLevelClauseType()
int
getStatementType()
void
groupClause(AST _t)
void
identifier(AST _t)
void
inRhs(AST _t)
void
insertStatement(AST _t)
void
insertablePropertySpec(AST _t)
void
intoClause(AST _t)
boolean
isComparativeExpressionClause()
boolean
isInCase()
boolean
isInFrom()
boolean
isInFunctionCall()
boolean
isInSelect()
protected boolean
isNonQualifiedPropertyRef(AST ident)
boolean
isSelectStatement()
boolean
isSubQuery()
void
joinElement(AST _t)
int
joinType(AST _t)
void
literal(AST _t)
void
logicalExpr(AST _t)
protected void
lookupAlias(AST ident)
protected AST
lookupNonQualifiedProperty(AST property)
protected AST
lookupProperty(AST dot, boolean root, boolean inSelect)
void
newValue(AST _t)
void
numericInteger(AST _t)
void
orderClause(AST _t)
void
orderExprs(AST _t)
void
parameter(AST _t)
String
path(AST _t)
void
pathAsIdent(AST _t)
protected void
postProcessDelete(AST delete)
protected void
postProcessInsert(AST insert)
protected void
postProcessUpdate(AST update)
protected void
prepareArithmeticOperator(AST operator)
protected void
prepareFromClauseInputTree(AST fromClauseInput)
Pre-process the from clause input tree.
protected void
prepareLogicOperator(AST operator)
protected void
prepareVersioned(AST updateNode, AST versionedNode)
protected void
processBoolean(AST constant)
protected void
processConstant(AST constant)
protected void
processConstructor(AST constructor)
protected void
processFunction(AST functionCall, boolean inSelect)
protected void
processIndex(AST indexOp)
protected void
processNumericLiteral(AST literal)
protected void
processQuery(AST select, AST query)
void
propertyName(AST _t)
void
propertyRef(AST _t)
void
propertyRefLhs(AST _t)
protected void
pushFromClause(AST fromClause, AST inputFromNode)
Sets the current 'FROM' context.
void
query(AST _t)
protected void
resolve(AST node)
protected void
resolveSelectExpression(AST dotNode)
void
selectClause(AST _t)
void
selectExpr(AST _t)
void
selectExprList(AST _t)
void
selectStatement(AST _t)
protected void
setAlias(AST selectExpr, AST ident)
void
setClause(AST _t)
protected void
setImpliedJoinType(int joinType)
void
statement(AST _t)
void
updateStatement(AST _t)
void
whereClause(AST _t)
void
withClause(AST _t)

Field Details

_tokenNames

public static final String[] _tokenNames

_tokenSet_0

public static final BitSet _tokenSet_0

Constructor Details

HqlSqlBaseWalker

public HqlSqlBaseWalker()

Method Details

addrExpr

public final void addrExpr(AST _t,
                           boolean root)
            throws RecognitionException

addrExprLhs

public final void addrExprLhs(AST _t)
            throws RecognitionException

aggregateExpr

public final void aggregateExpr(AST _t)
            throws RecognitionException

aliasRef

public final void aliasRef(AST _t)
            throws RecognitionException

aliasedSelectExpr

public final void aliasedSelectExpr(AST _t)
            throws RecognitionException

arithmeticExpr

public final void arithmeticExpr(AST _t)
            throws RecognitionException

assignment

public final void assignment(AST _t)
            throws RecognitionException

beforeSelectClause

protected void beforeSelectClause()
            throws SemanticException

caseExpr

public final void caseExpr(AST _t)
            throws RecognitionException

collectionFunction

public final void collectionFunction(AST _t)
            throws RecognitionException

collectionFunctionOrSubselect

public final void collectionFunctionOrSubselect(AST _t)
            throws RecognitionException

comparisonExpr

public final void comparisonExpr(AST _t)
            throws RecognitionException

constant

public final void constant(AST _t)
            throws RecognitionException

constructor

public final void constructor(AST _t)
            throws RecognitionException

count

public final void count(AST _t)
            throws RecognitionException

createFromElement

protected AST createFromElement(String path,
                                AST alias,
                                AST propertyFetch)
            throws SemanticException

createFromFilterElement

protected AST createFromFilterElement(AST filterEntity,
                                      AST alias)
            throws SemanticException

createFromJoinElement

protected void createFromJoinElement(AST path,
                                     AST alias,
                                     int joinType,
                                     AST fetch,
                                     AST propertyFetch,
                                     AST with)
            throws SemanticException

createIntoClause

protected AST createIntoClause(String path,
                               AST propertySpec)
            throws SemanticException

deleteStatement

public final void deleteStatement(AST _t)
            throws RecognitionException

evaluateAssignment

protected void evaluateAssignment(AST eq)
            throws SemanticException

expr

public final void expr(AST _t)
            throws RecognitionException

exprOrSubquery

public final void exprOrSubquery(AST _t)
            throws RecognitionException

fromClause

public final void fromClause(AST _t)
            throws RecognitionException

fromElement

public final void fromElement(AST _t)
            throws RecognitionException

fromElementList

public final void fromElementList(AST _t)
            throws RecognitionException

functionCall

public final void functionCall(AST _t)
            throws RecognitionException

generateNamedParameter

protected AST generateNamedParameter(AST delimiterNode,
                                     AST nameNode)
            throws SemanticException

generatePositionalParameter

protected AST generatePositionalParameter(AST inputNode)
            throws SemanticException

getCurrentClauseType

public final int getCurrentClauseType()

getCurrentStatementType

public final int getCurrentStatementType()

getCurrentTopLevelClauseType

public final int getCurrentTopLevelClauseType()

getStatementType

public final int getStatementType()

groupClause

public final void groupClause(AST _t)
            throws RecognitionException

identifier

public final void identifier(AST _t)
            throws RecognitionException

inRhs

public final void inRhs(AST _t)
            throws RecognitionException

insertStatement

public final void insertStatement(AST _t)
            throws RecognitionException

insertablePropertySpec

public final void insertablePropertySpec(AST _t)
            throws RecognitionException

intoClause

public final void intoClause(AST _t)
            throws RecognitionException

isComparativeExpressionClause

public final boolean isComparativeExpressionClause()

isInCase

public final boolean isInCase()

isInFrom

public final boolean isInFrom()

isInFunctionCall

public final boolean isInFunctionCall()

isInSelect

public final boolean isInSelect()

isNonQualifiedPropertyRef

protected boolean isNonQualifiedPropertyRef(AST ident)

isSelectStatement

public final boolean isSelectStatement()

isSubQuery

public final boolean isSubQuery()

joinElement

public final void joinElement(AST _t)
            throws RecognitionException

joinType

public final int joinType(AST _t)
            throws RecognitionException

literal

public final void literal(AST _t)
            throws RecognitionException

logicalExpr

public final void logicalExpr(AST _t)
            throws RecognitionException

lookupAlias

protected void lookupAlias(AST ident)
            throws SemanticException

lookupNonQualifiedProperty

protected AST lookupNonQualifiedProperty(AST property)
            throws SemanticException

lookupProperty

protected AST lookupProperty(AST dot,
                             boolean root,
                             boolean inSelect)
            throws SemanticException

newValue

public final void newValue(AST _t)
            throws RecognitionException

numericInteger

public final void numericInteger(AST _t)
            throws RecognitionException

orderClause

public final void orderClause(AST _t)
            throws RecognitionException

orderExprs

public final void orderExprs(AST _t)
            throws RecognitionException

parameter

public final void parameter(AST _t)
            throws RecognitionException

path

public final String path(AST _t)
            throws RecognitionException

pathAsIdent

public final void pathAsIdent(AST _t)
            throws RecognitionException

postProcessDelete

protected void postProcessDelete(AST delete)
            throws SemanticException

postProcessInsert

protected void postProcessInsert(AST insert)
            throws SemanticException

postProcessUpdate

protected void postProcessUpdate(AST update)
            throws SemanticException

prepareArithmeticOperator

protected void prepareArithmeticOperator(AST operator)
            throws SemanticException

prepareFromClauseInputTree

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

prepareLogicOperator

protected void prepareLogicOperator(AST operator)
            throws SemanticException

prepareVersioned

protected void prepareVersioned(AST updateNode,
                                AST versionedNode)
            throws SemanticException

processBoolean

protected void processBoolean(AST constant)
            throws SemanticException

processConstant

protected void processConstant(AST constant)
            throws SemanticException

processConstructor

protected void processConstructor(AST constructor)
            throws SemanticException

processFunction

protected void processFunction(AST functionCall,
                               boolean inSelect)
            throws SemanticException

processIndex

protected void processIndex(AST indexOp)
            throws SemanticException

processNumericLiteral

protected void processNumericLiteral(AST literal)
            throws SemanticException

processQuery

protected void processQuery(AST select,
                            AST query)
            throws SemanticException

propertyName

public final void propertyName(AST _t)
            throws RecognitionException

propertyRef

public final void propertyRef(AST _t)
            throws RecognitionException

propertyRefLhs

public final void propertyRefLhs(AST _t)
            throws RecognitionException

pushFromClause

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

query

public final void query(AST _t)
            throws RecognitionException

resolve

protected void resolve(AST node)
            throws SemanticException

resolveSelectExpression

protected void resolveSelectExpression(AST dotNode)
            throws SemanticException

selectClause

public final void selectClause(AST _t)
            throws RecognitionException

selectExpr

public final void selectExpr(AST _t)
            throws RecognitionException

selectExprList

public final void selectExprList(AST _t)
            throws RecognitionException

selectStatement

public final void selectStatement(AST _t)
            throws RecognitionException

setAlias

protected void setAlias(AST selectExpr,
                        AST ident)

setClause

public final void setClause(AST _t)
            throws RecognitionException

setImpliedJoinType

protected void setImpliedJoinType(int joinType)

statement

public final void statement(AST _t)
            throws RecognitionException

updateStatement

public final void updateStatement(AST _t)
            throws RecognitionException

whereClause

public final void whereClause(AST _t)
            throws RecognitionException

withClause

public final void withClause(AST _t)
            throws RecognitionException