Class JPQLParser
- java.lang.Object
-
- org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer
-
- org.eclipse.persistence.internal.libraries.antlr.runtime.Parser
-
- org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser
-
- Direct Known Subclasses:
JPQLParser
public abstract class JPQLParser extends org.eclipse.persistence.internal.libraries.antlr.runtime.ParserEJBQLParser is the superclass of the ANTLR generated parser.
-
-
Field Summary
Fields Modifier and Type Field Description protected NodeFactoryfactoryThe factory to create parse tree nodes.
-
Constructor Summary
Constructors Modifier Constructor Description protectedJPQLParser(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream stream)JPQLParser(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream input, org.eclipse.persistence.internal.libraries.antlr.runtime.RecognizerSharedState state)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddError(java.lang.Exception e)INTERNAL Add the exception to the list of errors.static java.lang.StringANTLRVersion()INTERNAL Returns the ANTLR version currently used.static JPQLParserbuildParserFor(java.lang.String queryText)INTERNAL Creates a parser for the specified query string.static JPQLParserbuildParserFor(java.lang.String queryName, java.lang.String queryText)INTERNAL Creates a parser for the specified query string.static JPQLParseTreebuildParseTree(java.lang.String queryText)INTERNAL Builds a parser, parses the specified query string and returns the parse tree.static JPQLParseTreebuildParseTree(java.lang.String queryName, java.lang.String queryText)INTERNAL Builds a parser, parses the specified query string and returns the parse tree.abstract voiddocument()This is the parser start method.protected JPQLExceptiongenerateException()INTERNAL Generate an exception which encapsulates all the exceptions generated by this parser.java.util.ListgetErrors()INTERNAL Returns the list of errors found during the parsing process.NodeFactorygetNodeFactory()INTERNAL Returns the factory used by the parser to create a parse tree and parse tree nodes.JPQLParseTreegetParseTree()INTERNAL Returns the parse tree created by a successful run of the parse method.java.lang.StringgetQueryInfo()INTERNAL Return the the query text prefixed by the query name in case of a named query.java.lang.StringgetQueryName()INTERNAL Return the name of the current query being compiled.java.lang.StringgetQueryText()INTERNAL Return the text of the current query being compiled.abstract java.lang.ObjectgetRootNode()Returns the root node after representing the parse tree for the current query string.protected JPQLExceptionhandleRecognitionException(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)INTERNAL Map an exception thrown by the ANTLR generated code to an JPQLException.booleanhasErrors()INTERNAL Returns true if there were errors during the parsing process.JPQLParseTreeparse()INTERNAL Parse the query string that was specified on parser creation.voidreportError(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)Method called by the ANTLR generated code in case of an error.voidsetNodeFactory(NodeFactory factory)INTERNAL Set the factory used by the parser to create a parse tree and parse tree nodes.voidsetQueryName(java.lang.String queryName)INTERNAL Set the name of the current query being compiled.voidsetQueryText(java.lang.String queryText)INTERNAL Set the text of the current query being compiled.-
Methods inherited from class org.eclipse.persistence.internal.libraries.antlr.runtime.Parser
getCurrentInputSymbol, getMissingSymbol, getSourceName, getTokenStream, reset, setTokenStream, traceIn, traceOut
-
Methods inherited from class org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer
alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getErrorHeader, getErrorMessage, getGrammarFileName, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, matchAny, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, recoverFromMismatchedToken, setBacktrackingLevel, toStrings, traceIn, traceOut
-
-
-
-
Field Detail
-
factory
protected NodeFactory factory
The factory to create parse tree nodes.
-
-
Constructor Detail
-
JPQLParser
protected JPQLParser(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream stream)
-
JPQLParser
public JPQLParser(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream input, org.eclipse.persistence.internal.libraries.antlr.runtime.RecognizerSharedState state)
-
-
Method Detail
-
ANTLRVersion
public static java.lang.String ANTLRVersion() throws java.lang.ExceptionINTERNAL Returns the ANTLR version currently used.- Throws:
java.lang.Exception
-
buildParseTree
public static JPQLParseTree buildParseTree(java.lang.String queryText) throws JPQLException
INTERNAL Builds a parser, parses the specified query string and returns the parse tree. Any error in the query text results in an JPQLException. This method is used for dynamic queries.- Throws:
JPQLException
-
buildParseTree
public static JPQLParseTree buildParseTree(java.lang.String queryName, java.lang.String queryText) throws JPQLException
INTERNAL Builds a parser, parses the specified query string and returns the parse tree. Any error in the query text results in an JPQLException.- Throws:
JPQLException
-
buildParserFor
public static JPQLParser buildParserFor(java.lang.String queryText) throws JPQLException
INTERNAL Creates a parser for the specified query string. The query string is not parsed (see method parse). This method is used for dynamic queries.- Throws:
JPQLException
-
buildParserFor
public static JPQLParser buildParserFor(java.lang.String queryName, java.lang.String queryText) throws JPQLException
INTERNAL Creates a parser for the specified query string. The query string is not parsed (see method parse).- Throws:
JPQLException
-
parse
public JPQLParseTree parse() throws JPQLException
INTERNAL Parse the query string that was specified on parser creation.- Throws:
JPQLException
-
getParseTree
public JPQLParseTree getParseTree()
INTERNAL Returns the parse tree created by a successful run of the parse method.
-
getQueryText
public java.lang.String getQueryText()
INTERNAL Return the text of the current query being compiled.
-
setQueryText
public void setQueryText(java.lang.String queryText)
INTERNAL Set the text of the current query being compiled. Please note, setting the query text using this method is for error handling and debugging purposes.
-
getQueryName
public java.lang.String getQueryName()
INTERNAL Return the name of the current query being compiled. This method returnsnullif the current query is a dynamic query and not a named query.
-
setQueryName
public void setQueryName(java.lang.String queryName)
INTERNAL Set the name of the current query being compiled. Please note, setting the query name using this method is for error handling and debugging purposes.
-
getQueryInfo
public java.lang.String getQueryInfo()
INTERNAL Return the the query text prefixed by the query name in case of a named query. The method returns just the query text in case of a dynamic query.
-
setNodeFactory
public void setNodeFactory(NodeFactory factory)
INTERNAL Set the factory used by the parser to create a parse tree and parse tree nodes.
-
getNodeFactory
public NodeFactory getNodeFactory()
INTERNAL Returns the factory used by the parser to create a parse tree and parse tree nodes.
-
getErrors
public java.util.List getErrors()
INTERNAL Returns the list of errors found during the parsing process.
-
hasErrors
public boolean hasErrors()
INTERNAL Returns true if there were errors during the parsing process.
-
addError
public void addError(java.lang.Exception e)
INTERNAL Add the exception to the list of errors.
-
generateException
protected JPQLException generateException()
INTERNAL Generate an exception which encapsulates all the exceptions generated by this parser. Special case where the first exception is an JPQLException.
-
handleRecognitionException
protected JPQLException handleRecognitionException(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)
INTERNAL Map an exception thrown by the ANTLR generated code to an JPQLException.
-
reportError
public void reportError(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)
Method called by the ANTLR generated code in case of an error.- Overrides:
reportErrorin classorg.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer
-
document
public abstract void document() throws org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionExceptionThis is the parser start method. It will be implemented by the ANTLR generated subclass.- Throws:
org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException
-
getRootNode
public abstract java.lang.Object getRootNode()
Returns the root node after representing the parse tree for the current query string. It will be implemented by the ANTLR generated subclass.
-
-