Package org.hibernate.hql.antlr
Class HqlSqlBaseWalker
java.lang.Object
antlr.TreeParser
org.hibernate.hql.antlr.HqlSqlBaseWalker
- All Implemented Interfaces:
HqlSqlTokenTypes
- Direct Known Subclasses:
HqlSqlWalker
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.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]static final antlr.collections.impl.BitSetstatic final antlr.collections.impl.BitSetFields inherited from class antlr.TreeParser
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepthFields 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, ENTRY, 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, ID_LETTER, ID_START_LETTER, IDENT, IMPLIED_FROM, IN, IN_LIST, INDEX_OP, INDICES, INNER, INSERT, INTO, IS, IS_NOT_NULL, IS_NULL, JAVA_CONSTANT, JOIN, JOIN_FRAGMENT, KEY, LE, LEADING, LEFT, LEFT_OUTER, LIKE, LITERAL_ascending, LITERAL_by, LITERAL_descending, LT, MAX, MEMBER, METHOD_CALL, METHOD_NAME, MIN, MINUS, MOD, NAMED_PARAM, NE, NEW, NOT, NOT_BETWEEN, NOT_IN, NOT_LIKE, NULL, NULL_TREE_LOOKAHEAD, NUM_BIG_DECIMAL, NUM_BIG_INTEGER, 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, RESULT_VARIABLE_REF, 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, VALUE, VECTOR_EXPR, VERSIONED, WEIRD_IDENT, WHEN, WHERE, WITH, WS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddrExpr(antlr.collections.AST _t, boolean root) final voidfinal voidfinal voidfinal voidfinal voidfinal voidprotected voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidprotected antlr.collections.ASTcreateFromElement(String path, antlr.collections.AST alias, antlr.collections.AST propertyFetch) protected antlr.collections.ASTcreateFromFilterElement(antlr.collections.AST filterEntity, antlr.collections.AST alias) protected voidcreateFromJoinElement(antlr.collections.AST path, antlr.collections.AST alias, int joinType, antlr.collections.AST fetch, antlr.collections.AST propertyFetch, antlr.collections.AST with) protected antlr.collections.ASTcreateIntoClause(String path, antlr.collections.AST propertySpec) final voidprotected voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidprotected antlr.collections.ASTgenerateNamedParameter(antlr.collections.AST delimiterNode, antlr.collections.AST nameNode) protected antlr.collections.ASTgeneratePositionalParameter(antlr.collections.AST inputNode) final intfinal intfinal intfinal intfinal voidprotected voidhandleResultVariableRef(antlr.collections.AST resultVariableRef) final voidfinal voidfinal voidfinal voidfinal voidfinal booleanfinal booleanisInCase()final booleanisInFrom()final booleanfinal booleanprotected booleanprotected booleanfinal booleanfinal booleanfinal voidfinal intfinal voidfinal voidprotected voidlookupAlias(antlr.collections.AST ident) protected antlr.collections.ASTprotected antlr.collections.ASTlookupProperty(antlr.collections.AST dot, boolean root, boolean inSelect) final voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal Stringfinal voidprotected voidprotected voidprotected voidprotected voidprotected voidprepareFromClauseInputTree(antlr.collections.AST fromClauseInput) Pre-process the from clause input tree.protected voidprepareLogicOperator(antlr.collections.AST operator) protected voidprepareVersioned(antlr.collections.AST updateNode, antlr.collections.AST versionedNode) protected voidprocessAggregation(antlr.collections.AST node, boolean inSelect) protected voidprocessBoolean(antlr.collections.AST constant) protected voidprocessConstant(antlr.collections.AST constant) protected voidprocessConstructor(antlr.collections.AST constructor) protected voidprocessFunction(antlr.collections.AST functionCall, boolean inSelect) protected voidprocessIndex(antlr.collections.AST indexOp) protected voidprotected voidprotected voidprocessQuery(antlr.collections.AST select, antlr.collections.AST query) final voidfinal voidfinal voidprotected voidpushFromClause(antlr.collections.AST fromClause, antlr.collections.AST inputFromNode) Sets the current 'FROM' context.final voidprotected voidresolve(antlr.collections.AST node) protected voidfinal voidfinal voidfinal voidfinal voidfinal voidprotected voidsetAlias(antlr.collections.AST selectExpr, antlr.collections.AST ident) final voidprotected voidsetImpliedJoinType(int joinType) final voidfinal voidprotected voidfinal voidfinal voidMethods inherited from class antlr.TreeParser
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportError, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut
-
Field Details
-
_tokenNames
-
_tokenSet_0
-
_tokenSet_1
-
-
Constructor Details
-
HqlSqlBaseWalker
public HqlSqlBaseWalker()
-
-
Method Details
-
isSubQuery
public final boolean isSubQuery() -
isInFrom
public final boolean isInFrom() -
isInFunctionCall
public final boolean isInFunctionCall() -
isInSelect
public final boolean isInSelect() -
isInCase
public final boolean isInCase() -
getStatementType
public final int getStatementType() -
getCurrentClauseType
public final int getCurrentClauseType() -
getCurrentTopLevelClauseType
public final int getCurrentTopLevelClauseType() -
getCurrentStatementType
public final int getCurrentStatementType() -
isComparativeExpressionClause
public final boolean isComparativeExpressionClause() -
isSelectStatement
public final boolean isSelectStatement() -
evaluateAssignment
- Throws:
antlr.SemanticException
-
prepareFromClauseInputTree
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, antlr.collections.AST with) 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
- Throws:
antlr.SemanticException
-
postProcessDelete
- Throws:
antlr.SemanticException
-
postProcessInsert
- Throws:
antlr.SemanticException
-
beforeSelectClause
- Throws:
antlr.SemanticException
-
processIndex
- Throws:
antlr.SemanticException
-
processConstant
- Throws:
antlr.SemanticException
-
processBoolean
- Throws:
antlr.SemanticException
-
processNumericLiteral
- Throws:
antlr.SemanticException
-
resolve
- 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
-
processAggregation
protected void processAggregation(antlr.collections.AST node, boolean inSelect) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
processConstructor
- Throws:
antlr.SemanticException
-
generateNamedParameter
protected antlr.collections.AST generateNamedParameter(antlr.collections.AST delimiterNode, antlr.collections.AST nameNode) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
generatePositionalParameter
protected antlr.collections.AST generatePositionalParameter(antlr.collections.AST inputNode) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
lookupAlias
- Throws:
antlr.SemanticException
-
setAlias
-
isOrderExpressionResultVariableRef
protected boolean isOrderExpressionResultVariableRef(antlr.collections.AST ident) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
handleResultVariableRef
protected void handleResultVariableRef(antlr.collections.AST resultVariableRef) 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
-
isNonQualifiedPropertyRef
-
lookupNonQualifiedProperty
protected antlr.collections.AST lookupNonQualifiedProperty(antlr.collections.AST property) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
setImpliedJoinType
protected void setImpliedJoinType(int joinType) -
createIntoClause
protected antlr.collections.AST createIntoClause(String path, antlr.collections.AST propertySpec) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
prepareVersioned
protected void prepareVersioned(antlr.collections.AST updateNode, antlr.collections.AST versionedNode) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
prepareLogicOperator
- Throws:
antlr.SemanticException
-
prepareArithmeticOperator
protected void prepareArithmeticOperator(antlr.collections.AST operator) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
processMapComponentReference
protected void processMapComponentReference(antlr.collections.AST node) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
validateMapPropertyExpression
protected void validateMapPropertyExpression(antlr.collections.AST node) throws antlr.SemanticException - Throws:
antlr.SemanticException
-
statement
- Throws:
antlr.RecognitionException
-
selectStatement
- Throws:
antlr.RecognitionException
-
updateStatement
- Throws:
antlr.RecognitionException
-
deleteStatement
- Throws:
antlr.RecognitionException
-
insertStatement
- Throws:
antlr.RecognitionException
-
query
- Throws:
antlr.RecognitionException
-
fromClause
- Throws:
antlr.RecognitionException
-
setClause
- Throws:
antlr.RecognitionException
-
whereClause
- Throws:
antlr.RecognitionException
-
intoClause
- Throws:
antlr.RecognitionException
-
path
- Throws:
antlr.RecognitionException
-
insertablePropertySpec
public final void insertablePropertySpec(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
assignment
- Throws:
antlr.RecognitionException
-
propertyRef
- Throws:
antlr.RecognitionException
-
newValue
- Throws:
antlr.RecognitionException
-
expr
- Throws:
antlr.RecognitionException
-
selectClause
- Throws:
antlr.RecognitionException
-
groupClause
- Throws:
antlr.RecognitionException
-
orderClause
- Throws:
antlr.RecognitionException
-
orderExprs
- Throws:
antlr.RecognitionException
-
orderExpr
- Throws:
antlr.RecognitionException
-
resultVariableRef
- Throws:
antlr.RecognitionException
-
identifier
- Throws:
antlr.RecognitionException
-
logicalExpr
- Throws:
antlr.RecognitionException
-
selectExprList
- Throws:
antlr.RecognitionException
-
selectExpr
- Throws:
antlr.RecognitionException
-
aliasedSelectExpr
- Throws:
antlr.RecognitionException
-
aliasRef
- Throws:
antlr.RecognitionException
-
constructor
- Throws:
antlr.RecognitionException
-
functionCall
- Throws:
antlr.RecognitionException
-
count
- Throws:
antlr.RecognitionException
-
collectionFunction
- Throws:
antlr.RecognitionException
-
literal
- Throws:
antlr.RecognitionException
-
arithmeticExpr
- Throws:
antlr.RecognitionException
-
aggregateExpr
- Throws:
antlr.RecognitionException
-
fromElementList
- Throws:
antlr.RecognitionException
-
fromElement
- Throws:
antlr.RecognitionException
-
joinElement
- Throws:
antlr.RecognitionException
-
joinType
- Throws:
antlr.RecognitionException
-
pathAsIdent
- Throws:
antlr.RecognitionException
-
withClause
- Throws:
antlr.RecognitionException
-
comparisonExpr
- Throws:
antlr.RecognitionException
-
exprOrSubquery
- Throws:
antlr.RecognitionException
-
inRhs
- Throws:
antlr.RecognitionException
-
collectionFunctionOrSubselect
public final void collectionFunctionOrSubselect(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
-
constant
- Throws:
antlr.RecognitionException
-
parameter
- Throws:
antlr.RecognitionException
-
caseExpr
- Throws:
antlr.RecognitionException
-
addrExprLhs
- Throws:
antlr.RecognitionException
-
propertyName
- Throws:
antlr.RecognitionException
-
mapComponentReference
- Throws:
antlr.RecognitionException
-
propertyRefLhs
- Throws:
antlr.RecognitionException
-
mapPropertyExpression
- Throws:
antlr.RecognitionException
-
numericInteger
- Throws:
antlr.RecognitionException
-