net.sf.csutils.core.query.antlr
Class CsqlBaseParser

java.lang.Object
  extended by antlr.Parser
      extended by antlr.LLkParser
          extended by net.sf.csutils.core.query.antlr.CsqlBaseParser
All Implemented Interfaces:
CsqlTokenTypes

public class CsqlBaseParser
extends antlr.LLkParser
implements CsqlTokenTypes

Hibernate Query Language Grammar
This grammar parses the query language for Hibernate (an Open Source, Object-Relational mapping library). A partial BNF grammar description is available for reference here: http://www.hibernate.org/Documentation/HQLBNF Text from the original reference BNF is prefixed with '//##'.

Author:
Joshua Davis (pgmjsd@sourceforge.net)

Field Summary
static java.lang.String[] _tokenNames
           
static antlr.collections.impl.BitSet _tokenSet_0
           
static antlr.collections.impl.BitSet _tokenSet_1
           
static antlr.collections.impl.BitSet _tokenSet_10
           
static antlr.collections.impl.BitSet _tokenSet_11
           
static antlr.collections.impl.BitSet _tokenSet_12
           
static antlr.collections.impl.BitSet _tokenSet_13
           
static antlr.collections.impl.BitSet _tokenSet_14
           
static antlr.collections.impl.BitSet _tokenSet_15
           
static antlr.collections.impl.BitSet _tokenSet_2
           
static antlr.collections.impl.BitSet _tokenSet_3
           
static antlr.collections.impl.BitSet _tokenSet_4
           
static antlr.collections.impl.BitSet _tokenSet_5
           
static antlr.collections.impl.BitSet _tokenSet_6
           
static antlr.collections.impl.BitSet _tokenSet_7
           
static antlr.collections.impl.BitSet _tokenSet_8
           
static antlr.collections.impl.BitSet _tokenSet_9
           
 
Fields inherited from class antlr.Parser
astFactory, inputState, returnAST, tokenNames, tokenTypeToASTClassMap, traceDepth
 
Fields inherited from interface net.sf.csutils.core.query.antlr.CsqlTokenTypes
AGGREGATE, ALIAS, ALL, AND, ANY, AS, ASCENDING, AVG, BETWEEN, BOTH, CASE, CASE2, CLASS, CLOSE, CLOSE_BRACKET, COLON, COMMA, CONCAT, CONSTANT, CONSTRUCTOR, COUNT, DECLARE, 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, ID_LETTER, ID_START_LETTER, IDENT, IN, IN_LIST, INDEX_OP, INDICES, INNER, INSERT, INTO, IS, IS_NOT_NULL, IS_NULL, JAVA_CONSTANT, JOIN, LE, LEADING, LEFT, LIKE, LT, MAX, MEMBER, METHOD_CALL, MIN, MINUS, NAMESPACE, 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
 
Constructor Summary
  CsqlBaseParser(antlr.ParserSharedInputState state)
           
  CsqlBaseParser(antlr.TokenBuffer tokenBuf)
           
protected CsqlBaseParser(antlr.TokenBuffer tokenBuf, int k)
           
  CsqlBaseParser(antlr.TokenStream lexer)
           
protected CsqlBaseParser(antlr.TokenStream lexer, int k)
           
 
Method Summary
 java.lang.Object additiveExpression()
           
 java.lang.String alias()
           
 java.lang.String asAlias()
           
 java.lang.Object atom()
           
 java.lang.Object concatenation()
           
 java.lang.Object constant()
           
 java.lang.Object equalityExpression()
           
 java.lang.Object expression()
           
 java.lang.Object expressionOrVector()
           
 java.util.List<java.lang.Object> exprList()
           
 ObjectType fromClassOrOuterQueryPath()
           
 void fromClause(SelectStatement st)
           
 ObjectType fromJoin()
           
 ObjectType fromRange()
           
 void handleDotIdent()
          This method looks ahead and converts .
 antlr.collections.AST handleIdentifierError(antlr.Token token, antlr.RecognitionException ex)
          This method is overriden in the sub class in order to provide the 'keyword as identifier' hack.
 Identifier identifier()
           
 java.lang.Object identPrimary()
           
 java.util.List inList()
           
 boolean isFilter()
          Returns true if this is a filter query, false if not.
 java.lang.Object logicalAndExpression()
           
 java.lang.Object logicalExpression()
           
 java.lang.Object logicalOrExpression()
           
 java.lang.Object multiplyExpression()
           
 NamespaceDeclarationSet namespaceDeclarations()
           
 java.lang.Object negatedExpression()
           
 Identifier objectTypePath()
           
 Identifier path()
           
 java.lang.Object primaryExpression()
           
 void queryRule(SelectStatement st)
           
 java.lang.Object relationalExpression()
           
 void selectFrom(SelectStatement st)
           
 SelectStatement selectStatement(NamespaceDeclarationSet nds)
           
 void setFilter(boolean f)
          Sets the filter flag.
 Statement statement()
           
 java.lang.String stringConstant()
           
 java.lang.Object unaryExpression()
           
 void weakKeywords()
           
 java.lang.Object whereClause()
           
 
Methods inherited from class antlr.LLkParser
consume, LA, LT, traceIn, traceOut
 
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
 

Field Detail

_tokenNames

public static final java.lang.String[] _tokenNames

_tokenSet_0

public static final antlr.collections.impl.BitSet _tokenSet_0

_tokenSet_1

public static final antlr.collections.impl.BitSet _tokenSet_1

_tokenSet_2

public static final antlr.collections.impl.BitSet _tokenSet_2

_tokenSet_3

public static final antlr.collections.impl.BitSet _tokenSet_3

_tokenSet_4

public static final antlr.collections.impl.BitSet _tokenSet_4

_tokenSet_5

public static final antlr.collections.impl.BitSet _tokenSet_5

_tokenSet_6

public static final antlr.collections.impl.BitSet _tokenSet_6

_tokenSet_7

public static final antlr.collections.impl.BitSet _tokenSet_7

_tokenSet_8

public static final antlr.collections.impl.BitSet _tokenSet_8

_tokenSet_9

public static final antlr.collections.impl.BitSet _tokenSet_9

_tokenSet_10

public static final antlr.collections.impl.BitSet _tokenSet_10

_tokenSet_11

public static final antlr.collections.impl.BitSet _tokenSet_11

_tokenSet_12

public static final antlr.collections.impl.BitSet _tokenSet_12

_tokenSet_13

public static final antlr.collections.impl.BitSet _tokenSet_13

_tokenSet_14

public static final antlr.collections.impl.BitSet _tokenSet_14

_tokenSet_15

public static final antlr.collections.impl.BitSet _tokenSet_15
Constructor Detail

CsqlBaseParser

protected CsqlBaseParser(antlr.TokenBuffer tokenBuf,
                         int k)

CsqlBaseParser

public CsqlBaseParser(antlr.TokenBuffer tokenBuf)

CsqlBaseParser

protected CsqlBaseParser(antlr.TokenStream lexer,
                         int k)

CsqlBaseParser

public CsqlBaseParser(antlr.TokenStream lexer)

CsqlBaseParser

public CsqlBaseParser(antlr.ParserSharedInputState state)
Method Detail

setFilter

public void setFilter(boolean f)
Sets the filter flag.

Parameters:
f - True for a filter query, false for a normal query.

isFilter

public boolean isFilter()
Returns true if this is a filter query, false if not.

Returns:
true if this is a filter query, false if not.

handleIdentifierError

public antlr.collections.AST handleIdentifierError(antlr.Token token,
                                                   antlr.RecognitionException ex)
                                            throws antlr.RecognitionException,
                                                   antlr.TokenStreamException
This method is overriden in the sub class in order to provide the 'keyword as identifier' hack.

Parameters:
token - The token to retry as an identifier.
ex - The exception to throw if it cannot be retried as an identifier.
Throws:
antlr.RecognitionException
antlr.TokenStreamException

handleDotIdent

public void handleDotIdent()
                    throws antlr.TokenStreamException
This method looks ahead and converts . into . IDENT when appropriate.

Throws:
antlr.TokenStreamException

weakKeywords

public void weakKeywords()
                  throws antlr.TokenStreamException
Throws:
antlr.TokenStreamException

statement

public final Statement statement()
                          throws antlr.RecognitionException,
                                 antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

namespaceDeclarations

public final NamespaceDeclarationSet namespaceDeclarations()
                                                    throws antlr.RecognitionException,
                                                           antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

selectStatement

public final SelectStatement selectStatement(NamespaceDeclarationSet nds)
                                      throws antlr.RecognitionException,
                                             antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

identifier

public final Identifier identifier()
                            throws antlr.RecognitionException,
                                   antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

stringConstant

public final java.lang.String stringConstant()
                                      throws antlr.RecognitionException,
                                             antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

queryRule

public final void queryRule(SelectStatement st)
                     throws antlr.RecognitionException,
                            antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

selectFrom

public final void selectFrom(SelectStatement st)
                      throws antlr.RecognitionException,
                             antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

whereClause

public final java.lang.Object whereClause()
                                   throws antlr.RecognitionException,
                                          antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

fromClause

public final void fromClause(SelectStatement st)
                      throws antlr.RecognitionException,
                             antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

fromRange

public final ObjectType fromRange()
                           throws antlr.RecognitionException,
                                  antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

fromJoin

public final ObjectType fromJoin()
                          throws antlr.RecognitionException,
                                 antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

path

public final Identifier path()
                      throws antlr.RecognitionException,
                             antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

asAlias

public final java.lang.String asAlias()
                               throws antlr.RecognitionException,
                                      antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

fromClassOrOuterQueryPath

public final ObjectType fromClassOrOuterQueryPath()
                                           throws antlr.RecognitionException,
                                                  antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

objectTypePath

public final Identifier objectTypePath()
                                throws antlr.RecognitionException,
                                       antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

alias

public final java.lang.String alias()
                             throws antlr.RecognitionException,
                                    antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

logicalExpression

public final java.lang.Object logicalExpression()
                                         throws antlr.RecognitionException,
                                                antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

expression

public final java.lang.Object expression()
                                  throws antlr.RecognitionException,
                                         antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

logicalOrExpression

public final java.lang.Object logicalOrExpression()
                                           throws antlr.RecognitionException,
                                                  antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

logicalAndExpression

public final java.lang.Object logicalAndExpression()
                                            throws antlr.RecognitionException,
                                                   antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

negatedExpression

public final java.lang.Object negatedExpression()
                                         throws antlr.RecognitionException,
                                                antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

equalityExpression

public final java.lang.Object equalityExpression()
                                          throws antlr.RecognitionException,
                                                 antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

relationalExpression

public final java.lang.Object relationalExpression()
                                            throws antlr.RecognitionException,
                                                   antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

concatenation

public final java.lang.Object concatenation()
                                     throws antlr.RecognitionException,
                                            antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

additiveExpression

public final java.lang.Object additiveExpression()
                                          throws antlr.RecognitionException,
                                                 antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

inList

public final java.util.List inList()
                            throws antlr.RecognitionException,
                                   antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

multiplyExpression

public final java.lang.Object multiplyExpression()
                                          throws antlr.RecognitionException,
                                                 antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

unaryExpression

public final java.lang.Object unaryExpression()
                                       throws antlr.RecognitionException,
                                              antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

atom

public final java.lang.Object atom()
                            throws antlr.RecognitionException,
                                   antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

primaryExpression

public final java.lang.Object primaryExpression()
                                         throws antlr.RecognitionException,
                                                antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

identPrimary

public final java.lang.Object identPrimary()
                                    throws antlr.RecognitionException,
                                           antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

constant

public final java.lang.Object constant()
                                throws antlr.RecognitionException,
                                       antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

expressionOrVector

public final java.lang.Object expressionOrVector()
                                          throws antlr.RecognitionException,
                                                 antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException

exprList

public final java.util.List<java.lang.Object> exprList()
                                                throws antlr.RecognitionException,
                                                       antlr.TokenStreamException
Throws:
antlr.RecognitionException
antlr.TokenStreamException


Copyright © 2009-2010. All Rights Reserved.