Top Description Fields Constructors Methods
org.hibernate.hql.ast

public final Class HqlParser

extends HqlBaseParser
Class Inheritance
Imports
java.io.PrintStream, .PrintWriter, .StringReader, antlr.ASTPair, .MismatchedTokenException, .RecognitionException, .Token, .TokenStream, .TokenStreamException, antlr.collections.AST, org.slf4j.Logger, .LoggerFactory, org.hibernate.hql.antlr.HqlBaseParser, .HqlTokenTypes, org.hibernate.hql.ast.util.ASTPrinter, .ASTUtil, org.hibernate.QueryException, org.hibernate.util.StringHelper

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 ([email protected])

Field Summary

Modifier and TypeField and Description
private static final Logger
log

A logger for this class.

private ParseErrorHandler
private ASTPrinter
private final boolean
private int
Inherited from 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

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private AST
createIsNullParent(AST node, boolean negated)

private AST
private static ASTPrinter
public static HqlParser
public ParseErrorHandler
public void
handleDotIdent()

Overrides org.hibernate.hql.antlr.HqlBaseParser.handleDotIdent.

This method looks ahead and converts .
public AST

Returns:

AST - The new AST.
handleIdentifierError
(Token
The token.
token
,
RecognitionException
The recognition exception.
ex
)

Overrides org.hibernate.hql.antlr.HqlBaseParser.handleIdentifierError.

Overrides the base behavior to retry keywords as identifiers.
private void
public AST

Returns:

AST - The equivalent sub-tree.
negateNode
(AST
The sub tree to transform, the parent is assumed to be NOT.
x
)

Overrides org.hibernate.hql.antlr.HqlBaseParser.negateNode.

Returns an equivalent tree for (NOT (a relop b) ), for example:
(NOT (GT a b) ) => (LE a b)
public static void
public AST

Returns:

AST - The clean sub-tree.
processEqualityExpression
(AST
The equality expression.
x
)

Overrides org.hibernate.hql.antlr.HqlBaseParser.processEqualityExpression.

Post process equality expressions, clean up the subtree.
private AST
processIsEmpty(AST node, boolean negated)

public void
public void
reportError(RecognitionException e)

Overrides antlr.Parser.reportError.

Parser error-reporting function can be overridden in subclass
public void
reportError(String s)

Overrides antlr.Parser.reportError.

Parser error-reporting function can be overridden in subclass
public void
reportWarning(String s)

Overrides antlr.Parser.reportWarning.

Parser warning-reporting function can be overridden in subclass
public void
private void
public void
public void
public void
Inherited from org.hibernate.hql.antlr.HqlBaseParser:
additiveExpressionaggregatealiasaliasedExpressionaltWhenClauseasAliasascendingOrDescendingassignmentatombetweenListbuildTokenTypeASTClassMapcaseExpressioncollectionExprcompoundExprconcatenationconstantdeleteStatementelseClauseequalityExpressionexpressionexpressionOrVectorexprListfromClassOrOuterQueryPathfromClausefromJoinfromRangegroupByClausehavingClauseidentifieridentPrimaryinClassDeclarationinCollectionDeclarationinCollectionElementsDeclarationinListinsertablePropertySpecinsertStatementintoClauseisFilterlikeEscapelogicalAndExpressionlogicalExpressionlogicalOrExpressionmultiplyExpressionnegatedExpressionnewExpressionnewValueoptionalFromTokenFromClauseorderByClauseorderElementparameterpathprimaryExpressionpropertyFetchquantifiedExpressionqueryRulerelationalExpressionselectClauseselectedPropertiesListselectFromselectObjectselectStatementsetClausesetFilterstateFieldstatementsubQueryunaryExpressionunionupdateStatementvectorExprwhenClausewhereClausewithClause

Field Detail

logback to summary
private static final Logger log

A logger for this class.

parseErrorHandlerback to summary
private ParseErrorHandler parseErrorHandler
printerback to summary
private ASTPrinter printer
traceback to summary
private final boolean trace
traceDepthback to summary
private int traceDepth

Hides antlr.Parser.traceDepth.

Constructor Detail

HqlParserback to summary
private HqlParser(TokenStream lexer)

Method Detail

createIsNullParentback to summary
private AST createIsNullParent(AST node, boolean negated)
createSubqueryback to summary
private AST createSubquery(AST node)
getASTPrinterback to summary
private static ASTPrinter getASTPrinter()
getInstanceback to summary
public static HqlParser getInstance(String hql)
getParseErrorHandlerback to summary
public ParseErrorHandler getParseErrorHandler()
handleDotIdentback to summary
public void handleDotIdent() throws TokenStreamException

Overrides org.hibernate.hql.antlr.HqlBaseParser.handleDotIdent.

Doc from org.hibernate.hql.antlr.HqlBaseParser.handleDotIdent.

This method looks ahead and converts . into . IDENT when appropriate.

handleIdentifierErrorback to summary
public AST handleIdentifierError(Token token, RecognitionException ex) throws RecognitionException, TokenStreamException

Overrides org.hibernate.hql.antlr.HqlBaseParser.handleIdentifierError.

Overrides the base behavior to retry keywords as identifiers.

Parameters
token:Token

The token.

ex:RecognitionException

The recognition exception.

Returns:AST

AST - The new AST.

Exceptions
RecognitionException:
if the substitution was not possible.
TokenStreamException:
if the substitution was not possible.
initializeback to summary
private void initialize()
negateNodeback to summary
public AST negateNode(AST x)

Overrides org.hibernate.hql.antlr.HqlBaseParser.negateNode.

Returns an equivalent tree for (NOT (a relop b) ), for example:

(NOT (GT a b) ) => (LE a b)
Parameters
x:AST

The sub tree to transform, the parent is assumed to be NOT.

Returns:AST

AST - The equivalent sub-tree.

panicback to summary
public static void panic()

Hides antlr.Parser.panic.

processEqualityExpressionback to summary
public AST processEqualityExpression(AST x)

Overrides org.hibernate.hql.antlr.HqlBaseParser.processEqualityExpression.

Post process equality expressions, clean up the subtree.

Parameters
x:AST

The equality expression.

Returns:AST

AST - The clean sub-tree.

processIsEmptyback to summary
private AST processIsEmpty(AST node, boolean negated)
processMemberOfback to summary
public void processMemberOf(Token n, AST p, ASTPair currentAST)

Overrides org.hibernate.hql.antlr.HqlBaseParser.processMemberOf.

reportErrorback to summary
public void reportError(RecognitionException e)

Overrides antlr.Parser.reportError.

Doc from antlr.Parser.reportError.

Parser error-reporting function can be overridden in subclass

reportErrorback to summary
public void reportError(String s)

Overrides antlr.Parser.reportError.

Doc from antlr.Parser.reportError.

Parser error-reporting function can be overridden in subclass

reportWarningback to summary
public void reportWarning(String s)

Overrides antlr.Parser.reportWarning.

Doc from antlr.Parser.reportWarning.

Parser warning-reporting function can be overridden in subclass

showAstback to summary
public void showAst(AST ast, PrintStream out)
showAstback to summary
private void showAst(AST ast, PrintWriter pw)
traceInback to summary
public void traceIn(String ruleName)

Overrides antlr.LLkParser.traceIn.

traceOutback to summary
public void traceOut(String ruleName)

Overrides antlr.LLkParser.traceOut.

weakKeywordsback to summary
public void weakKeywords() throws TokenStreamException

Overrides org.hibernate.hql.antlr.HqlBaseParser.weakKeywords.