org.hibernate.sql.ordering.antlr
Class OrderByFragmentParser

java.lang.Object
  extended by antlr.Parser
      extended by antlr.LLkParser
          extended by org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser
              extended by org.hibernate.sql.ordering.antlr.OrderByFragmentParser
All Implemented Interfaces:
OrderByTemplateTokenTypes

public class OrderByFragmentParser
extends GeneratedOrderByFragmentParser

Extension of the Antlr-generated parser for the purpose of adding our custom parsing behavior.


Field Summary
 
Fields inherited from class org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser
_tokenNames, _tokenSet_0, _tokenSet_1, _tokenSet_2, _tokenSet_3, _tokenSet_4, _tokenSet_5, _tokenSet_6, _tokenSet_7, _tokenSet_8
 
Fields inherited from class antlr.Parser
astFactory, inputState, returnAST, tokenNames, tokenTypeToASTClassMap
 
Fields inherited from interface org.hibernate.sql.ordering.antlr.OrderByTemplateTokenTypes
ASCENDING, CLOSE_PAREN, COLLATE, COLUMN_REF, COMMA, DESCENDING, DOT, EOF, ESCqs, EXPONENT, EXPR_LIST, FLOAT_SUFFIX, HARD_QUOTE, HEX_DIGIT, ID_LETTER, ID_START_LETTER, IDENT, IDENT_LIST, LITERAL_ascending, LITERAL_descending, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OPEN_PAREN, ORDER_BY, ORDER_SPEC, QUOTED_STRING, SORT_KEY, SORT_SPEC, WS
 
Constructor Summary
OrderByFragmentParser(antlr.TokenStream lexer, TranslationContext context)
           
 
Method Summary
protected  boolean isFunctionName(antlr.collections.AST ast)
          A check to see if the text of the given node represents a known function name.
protected  antlr.collections.AST postProcessSortSpecification(antlr.collections.AST sortSpec)
          Allow post processing of each sort specification
protected  antlr.collections.AST quotedIdentifier(antlr.collections.AST ident)
          Process the given node as a quote identifier.
protected  antlr.collections.AST quotedString(antlr.collections.AST ident)
          Process the given node as a quote string.
protected  antlr.collections.AST resolveFunction(antlr.collections.AST ast)
          Process the given node as a function.
protected  antlr.collections.AST resolveIdent(antlr.collections.AST ident)
          Process the given node as an IDENT.
protected  void trace(String msg)
          Method for logging execution trace information.
 void traceIn(String ruleName)
           
 void traceOut(String ruleName)
           
 
Methods inherited from class org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser
buildTokenTypeASTClassMap, collationName, collationSpecification, expression, extractText, functionCall, functionCallCheck, functionName, functionParameter, functionParameterList, orderByFragment, orderingSpecification, simplePropertyPath, sortKey, sortSpecification
 
Methods inherited from class antlr.LLkParser
consume, LA, LT
 
Methods inherited from class antlr.Parser
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, defaultDebuggingSetup, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, recover, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderByFragmentParser

public OrderByFragmentParser(antlr.TokenStream lexer,
                             TranslationContext context)
Method Detail

traceIn

public void traceIn(String ruleName)
Overrides:
traceIn in class antlr.LLkParser

traceOut

public void traceOut(String ruleName)
Overrides:
traceOut in class antlr.LLkParser

trace

protected void trace(String msg)
Method for logging execution trace information.

Overrides:
trace in class GeneratedOrderByFragmentParser
Parameters:
msg - The trace message.

quotedIdentifier

protected antlr.collections.AST quotedIdentifier(antlr.collections.AST ident)
Process the given node as a quote identifier. These need to be quoted in the dialect-specific way.

Overrides:
quotedIdentifier in class GeneratedOrderByFragmentParser
Parameters:
ident - The quoted-identifier node.
Returns:
The processed node.
See Also:
Dialect.quote(java.lang.String)

quotedString

protected antlr.collections.AST quotedString(antlr.collections.AST ident)
Process the given node as a quote string.

Overrides:
quotedString in class GeneratedOrderByFragmentParser
Parameters:
ident - The quoted string. This is used from within function param recognition, and represents a SQL-quoted string.
Returns:
The processed node.

isFunctionName

protected boolean isFunctionName(antlr.collections.AST ast)
A check to see if the text of the given node represents a known function name.

Overrides:
isFunctionName in class GeneratedOrderByFragmentParser
Parameters:
ast - The node whose text we want to check.
Returns:
True if the node's text is a known function name, false otherwise.
See Also:
SQLFunctionRegistry

resolveFunction

protected antlr.collections.AST resolveFunction(antlr.collections.AST ast)
Process the given node as a function.

Overrides:
resolveFunction in class GeneratedOrderByFragmentParser
Returns:
The processed node.

resolveIdent

protected antlr.collections.AST resolveIdent(antlr.collections.AST ident)
Process the given node as an IDENT. May represent either a column reference or a property reference.

Overrides:
resolveIdent in class GeneratedOrderByFragmentParser
Parameters:
ident - The node whose text represents either a column or property reference.
Returns:
The processed node.

postProcessSortSpecification

protected antlr.collections.AST postProcessSortSpecification(antlr.collections.AST sortSpec)
Allow post processing of each sort specification

Overrides:
postProcessSortSpecification in class GeneratedOrderByFragmentParser
Returns:
The processed sort specification subtree.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.