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

public final Class HqlParser

extends HqlBaseParser
Class Inheritance
Imports
java.io.PrintStream, .PrintWriter, .StringReader, java.util.Collections, .HashMap, .HashSet, .Map, .Set, org.hibernate.QueryException, org.hibernate.hql.internal.antlr.HqlBaseParser, .HqlTokenTypes, org.hibernate.hql.internal.ast.util.ASTUtil, .TokenPrinters, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.internal.util.StringHelper, antlr.ASTPair, .MismatchedTokenException, .RecognitionException, .Token, .TokenStreamException, antlr.collections.AST

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 CoreMessageLogger
private final ParseErrorHandler
private int
private Map<String, Set<String>>
Inherited from org.hibernate.hql.internal.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_36_tokenSet_37_tokenSet_38_tokenSet_39_tokenSet_4_tokenSet_40_tokenSet_41_tokenSet_42_tokenSet_43_tokenSet_44_tokenSet_45_tokenSet_46_tokenSet_47_tokenSet_48_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
public void
public void
public static HqlParser

Returns:

The parser.
getInstance
(String
The HQL query string
hql
)

Get a HqlParser instance for the given HQL string.

public ParseErrorHandler
public Map<String, Set<String>>
public void
handleDotIdent()

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

This method looks ahead and converts .
public AST

Returns:

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

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

Overrides the base behavior to retry keywords as identifiers.
public void
public void
matchOptionalFrom()

Overrides org.hibernate.hql.internal.antlr.HqlBaseParser.matchOptionalFrom.

Manages the case of an optional FROM allowing the path to start with the "from" keyword
public AST

Returns:

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

Overrides org.hibernate.hql.internal.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:

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

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

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

public void
protected 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
private String
public void
public void
public void
Inherited from org.hibernate.hql.internal.antlr.HqlBaseParser:
additiveExpressionaggregatealiasaliasedExpressionasAliasascendingOrDescendingassignmentatombetweenListbuildTokenTypeASTClassMapcaseExpressioncastedIdentPrimaryBasecastedJoinPathcastFunctioncastTargetTypecollectionExprcollectionPathcollectionPathQualifiercollectionSizeFunctioncompoundExprconcatenationconstantdeleteStatementelseClauseequalityExpressionexpressionexpressionOrVectorexprListfkRefPathfromClassOrOuterQueryPathfromClausefromJoinfromRangegroupByClausehavingClauseidentifieridentPrimaryidentPrimaryBaseinClassDeclarationinCollectionDeclarationinCollectionElementsDeclarationinListinsertablePropertySpecinsertStatementintoClauseisFilterjoinPathjpaFunctionSyntaxlikeEscapelogicalAndExpressionlogicalExpressionlogicalOrExpressionmemberOfPathmultiplyExpressionnegatedExpressionnewExpressionnewValuenullOrderingnullPrecedenceoptionalFromTokenFromClauseoptionalVersionedorderByClauseorderElementparameterpathprimaryExpressionpropertyFetchquantifiedExpressionqueryRulerelationalExpressionretrieveLookAheadTextsearchedCaseStatementsearchedCaseWhenClauseselectClauseselectedPropertiesListselectFromselectObjectselectStatementsetClausesetFiltersimpleCaseStatementsimpleCaseWhenClausestateFieldstatementsubQueryunaryExpressionunquoteupdateStatementvalidateLookAheadTextvalidateSoftKeywordvectorExprwhereClausewithClause

Field Detail

LOGback to summary
private static final CoreMessageLogger LOG
parseErrorHandlerback to summary
private final ParseErrorHandler parseErrorHandler
traceDepthback to summary
private int traceDepth

Hides antlr.Parser.traceDepth.

treatMapback to summary
private Map<String, Set<String>> treatMap

Constructor Detail

HqlParserback to summary
private HqlParser(String hql)

Method Detail

createIsNullParentback to summary
private AST createIsNullParent(AST node, boolean negated)
createSubqueryback to summary
private AST createSubquery(AST node)
expectNamedParameterNameback to summary
public void expectNamedParameterName() throws TokenStreamException

Overrides org.hibernate.hql.internal.antlr.HqlBaseParser.expectNamedParameterName.

Doc from org.hibernate.hql.internal.antlr.HqlBaseParser.expectNamedParameterName.

Called after we have recognized ':'. The expectation is to handle converting any non-IDENT token where possibleID == true into an IDENT

Annotations
@Override
firstPathTokenWeakKeywordsback to summary
public void firstPathTokenWeakKeywords() throws TokenStreamException

Overrides org.hibernate.hql.internal.antlr.HqlBaseParser.firstPathTokenWeakKeywords.

Annotations
@Override
getInstanceback to summary
public static HqlParser getInstance(String hql)

Get a HqlParser instance for the given HQL string.

Parameters
hql:String

The HQL query string

Returns:HqlParser

The parser.

getParseErrorHandlerback to summary
public ParseErrorHandler getParseErrorHandler()
getTreatMapback to summary
public Map<String, Set<String>> getTreatMap()
handleDotIdentback to summary
public void handleDotIdent() throws TokenStreamException

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

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

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

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

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

Overrides the base behavior to retry keywords as identifiers.

Parameters
token:Token

The token.

ex:RecognitionException

The recognition exception.

Returns:AST

The new AST.

Annotations
@Override
Exceptions
RecognitionException:
if the substitution was not possible.
TokenStreamException:
if the substitution was not possible.
handlePrimaryExpressionDotIdentback to summary
public void handlePrimaryExpressionDotIdent() throws TokenStreamException

Overrides org.hibernate.hql.internal.antlr.HqlBaseParser.handlePrimaryExpressionDotIdent.

Annotations
@Override
matchOptionalFromback to summary
public void matchOptionalFrom() throws RecognitionException, TokenStreamException

Overrides org.hibernate.hql.internal.antlr.HqlBaseParser.matchOptionalFrom.

Doc from org.hibernate.hql.internal.antlr.HqlBaseParser.matchOptionalFrom.

Manages the case of an optional FROM allowing the path to start with the "from" keyword

Annotations
@Override
negateNodeback to summary
public AST negateNode(AST x)

Overrides org.hibernate.hql.internal.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

The equivalent sub-tree.

Annotations
@Override
panicback to summary
public static void panic()

Hides antlr.Parser.panic.

processEqualityExpressionback to summary
public AST processEqualityExpression(AST x)

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

Post process equality expressions, clean up the subtree.

Parameters
x:AST

The equality expression.

Returns:AST

The clean sub-tree.

Annotations
@Override
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.internal.antlr.HqlBaseParser.processMemberOf.

Annotations
@Override
registerTreatback to summary
protected void registerTreat(AST pathToTreat, AST treatAs)

Overrides org.hibernate.hql.internal.antlr.HqlBaseParser.registerTreat.

Annotations
@Override
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

Annotations
@Override
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

Annotations
@Override
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

Annotations
@Override
showAstback to summary
public void showAst(AST ast, PrintStream out)
showAstback to summary
private void showAst(AST ast, PrintWriter pw)
toPathTextback to summary
private String toPathText(AST node)
traceInback to summary
public void traceIn(String ruleName)

Overrides antlr.LLkParser.traceIn.

Annotations
@Override
traceOutback to summary
public void traceOut(String ruleName)

Overrides antlr.LLkParser.traceOut.

Annotations
@Override
weakKeywordsback to summary
public void weakKeywords() throws TokenStreamException

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

Annotations
@Override