org.hibernate.hql.ast

Class HqlParser

Implemented Interfaces:
HqlTokenTypes

public final class HqlParser
extends HqlBaseParser

Implements the semantic action methods defined in the HQL base parser to keep the grammar source file a little cleaner. Extends the parser class generated by ANTLR.
Author:
Joshua Davis (pgmjsd@sourceforge.net)

Field Summary

Fields inherited from class org.hibernate.hql.antlr.HqlBaseParser

_tokenNames, _tokenSet_0, _tokenSet_1, _tokenSet_10, _tokenSet_11, _tokenSet_12, _tokenSet_13, _tokenSet_14, _tokenSet_15, _tokenSet_16, _tokenSet_17, _tokenSet_18, _tokenSet_19, _tokenSet_2, _tokenSet_20, _tokenSet_21, _tokenSet_22, _tokenSet_23, _tokenSet_24, _tokenSet_25, _tokenSet_26, _tokenSet_27, _tokenSet_28, _tokenSet_29, _tokenSet_3, _tokenSet_30, _tokenSet_31, _tokenSet_32, _tokenSet_33, _tokenSet_34, _tokenSet_35, _tokenSet_4, _tokenSet_5, _tokenSet_6, _tokenSet_7, _tokenSet_8, _tokenSet_9

Fields inherited from interface org.hibernate.hql.antlr.HqlTokenTypes

AGGREGATE, ALIAS, ALL, AND, ANY, AS, ASCENDING, AVG, BETWEEN, 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, FLOAT_SUFFIX, FROM, FULL, GE, GROUP, GT, HAVING, HEX_DIGIT, IDENT, ID_LETTER, ID_START_LETTER, IN, INDEX_OP, INDICES, INNER, INSERT, INTO, IN_LIST, IS, IS_NOT_NULL, IS_NULL, JAVA_CONSTANT, JOIN, LE, LEADING, LEFT, LIKE, LITERAL_ascending, LITERAL_by, LITERAL_descending, LT, MAX, MEMBER, METHOD_CALL, MIN, MINUS, 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, QUERY, QUOTED_STRING, RANGE, RIGHT, ROW_STAR, SELECT, SELECT_FROM, SET, SOME, SQL_NE, STAR, SUM, THEN, TRAILING, TRUE, UNARY_MINUS, UNARY_PLUS, UNION, UPDATE, VECTOR_EXPR, VERSIONED, WEIRD_IDENT, WHEN, WHERE, WITH, WS

Method Summary

static HqlParser
getInstance(String hql)
ParseErrorHandler
getParseErrorHandler()
void
handleDotIdent()
This method looks ahead and converts .
AST
handleIdentifierError(Token token, RecognitionException ex)
Overrides the base behavior to retry keywords as identifiers.
AST
negateNode(AST x)
Returns an equivalent tree for (NOT (a relop b) ), for example:
 (NOT (GT a b) ) => (LE a b)
 
static void
panic()
AST
processEqualityExpression(AST x)
Post process equality expressions, clean up the subtree.
void
processMemberOf(Token n, AST p, ASTPair currentAST)
void
reportError(RecognitionException e)
void
reportError(String s)
void
reportWarning(String s)
void
showAst(AST ast, PrintStream out)
void
weakKeywords()

Methods inherited from class org.hibernate.hql.antlr.HqlBaseParser

additiveExpression, aggregate, alias, aliasedExpression, altWhenClause, asAlias, ascendingOrDescending, assignment, atom, betweenList, buildTokenTypeASTClassMap, caseExpression, collectionExpr, compoundExpr, concatenation, constant, deleteStatement, elseClause, equalityExpression, exprList, expression, expressionOrVector, fromClassOrOuterQueryPath, fromClause, fromJoin, fromRange, groupByClause, handleDotIdent, handleIdentifierError, havingClause, identPrimary, identifier, inClassDeclaration, inCollectionDeclaration, inCollectionElementsDeclaration, inList, insertStatement, insertablePropertySpec, intoClause, isFilter, likeEscape, logicalAndExpression, logicalExpression, logicalOrExpression, multiplyExpression, negateNode, negatedExpression, newExpression, newValue, optionalFromTokenFromClause, orderByClause, orderElement, path, primaryExpression, processEqualityExpression, processMemberOf, propertyFetch, quantifiedExpression, queryRule, relationalExpression, selectClause, selectFrom, selectObject, selectStatement, selectedPropertiesList, setClause, setFilter, stateField, statement, subQuery, unaryExpression, union, updateStatement, vectorExpr, weakKeywords, whenClause, whereClause, withClause

Method Details

getInstance

public static HqlParser getInstance(String hql)

getParseErrorHandler

public ParseErrorHandler getParseErrorHandler()

handleDotIdent

public void handleDotIdent()
            throws TokenStreamException
This method looks ahead and converts . into . IDENT when appropriate.
Overrides:
handleDotIdent in interface HqlBaseParser

handleIdentifierError

public AST handleIdentifierError(Token token,
                                 RecognitionException ex)
            throws RecognitionException,
                   TokenStreamException
Overrides the base behavior to retry keywords as identifiers.
Overrides:
handleIdentifierError in interface HqlBaseParser
Parameters:
token - The token.
ex - The recognition exception.
Returns:
AST - The new AST.

negateNode

public AST negateNode(AST x)
Returns an equivalent tree for (NOT (a relop b) ), for example:
 (NOT (GT a b) ) => (LE a b)
 
Overrides:
negateNode in interface HqlBaseParser
Parameters:
x - The sub tree to transform, the parent is assumed to be NOT.
Returns:
AST - The equivalent sub-tree.

panic

public static void panic()

processEqualityExpression

public AST processEqualityExpression(AST x)
Post process equality expressions, clean up the subtree.
Overrides:
processEqualityExpression in interface HqlBaseParser
Parameters:
x - The equality expression.
Returns:
AST - The clean sub-tree.

processMemberOf

public void processMemberOf(Token n,
                            AST p,
                            ASTPair currentAST)
Overrides:
processMemberOf in interface HqlBaseParser

reportError

public void reportError(RecognitionException e)

reportError

public void reportError(String s)

reportWarning

public void reportWarning(String s)

showAst

public void showAst(AST ast,
                    PrintStream out)

weakKeywords

public void weakKeywords()
            throws TokenStreamException
Overrides:
weakKeywords in interface HqlBaseParser