Package org.datanucleus.query.compiler
Class JDOQLParser
- java.lang.Object
-
- org.datanucleus.query.compiler.AbstractParser
-
- org.datanucleus.query.compiler.JDOQLParser
-
- All Implemented Interfaces:
Parser
public class JDOQLParser extends AbstractParser
Implementation of a parser for JDOQL query language. Generates Node tree(s) by use of the various parseXXX() methods.
-
-
Field Summary
-
Fields inherited from class org.datanucleus.query.compiler.AbstractParser
lexer, stack, strict
-
-
Constructor Summary
Constructors Constructor Description JDOQLParser()
Constructor for a JDOQL Parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allowSingleEquals(boolean flag)
Method to set whether "=" is allowed.Node
parse(String expression)
Node[]
parseFrom(String expression)
Node[]
parseOrder(String expression)
Node[][]
parseParameters(String expression)
Node[]
parseResult(String expression)
The RESULT expression in JDOQL can include aggregates, fields, as well as aliases myfield [AS] alias, myfield2" The Node tree for this would beNode[]
parseTuple(String expression)
Node[]
parseUpdate(String expression)
Node
parseVariable(String expression)
Node[][]
parseVariables(String expression)
protected void
processAdditiveExpression()
protected boolean
processLiteral()
A literal is one value of any type.protected void
processMultiplicativeExpression()
protected void
processPrimary()
Parses the primary.protected void
processUnaryExpression()
void
setExplicitParameters(boolean flag)
-
Methods inherited from class org.datanucleus.query.compiler.AbstractParser
getLastDescendantNodeForNode, setStrict
-
-
-
-
Method Detail
-
setExplicitParameters
public void setExplicitParameters(boolean flag)
- Specified by:
setExplicitParameters
in interfaceParser
- Overrides:
setExplicitParameters
in classAbstractParser
-
allowSingleEquals
public void allowSingleEquals(boolean flag)
Method to set whether "=" is allowed. It is valid in an UPDATE clause, but not in a WHERE clause, for example.- Parameters:
flag
- Whether to allow it
-
parseResult
public Node[] parseResult(String expression)
The RESULT expression in JDOQL can include aggregates, fields, as well as aliases- myfield [AS] alias, myfield2"
[ [IDENTIFIER : myfield. [NAME : alias]], [IDENTIFIER : myfield2] ]
- Returns:
- Node tree(s) for the RESULT expression
-
processAdditiveExpression
protected void processAdditiveExpression()
-
processMultiplicativeExpression
protected void processMultiplicativeExpression()
-
processUnaryExpression
protected void processUnaryExpression()
-
processPrimary
protected void processPrimary()
Parses the primary. First look for a literal (e.g. "text"), then an identifier(e.g. variable) In the next step, call a function, if executing a function, on the literal or the identifier found.
-
processLiteral
protected boolean processLiteral()
A literal is one value of any type. Supported literals are of types String, Floating Point, Integer, Character, Boolean and null e.g. 'J', "String", 1, 1.8, true, false, null.- Returns:
- The parsed literal
-
-