Class JJTQLParserState

java.lang.Object
org.apache.cayenne.ql.JJTQLParserState

public class JJTQLParserState extends Object
The stack that QLParser builds expression trees on. An entry is a node or a plain literal value; the values become operands of the node that closes over them. Adapted from the JJTree-generated tree state and maintained by hand, together with the node classes it operates on. The class name is what the generated parser expects.
Since:
5.0
  • Constructor Details

    • JJTQLParserState

      public JJTQLParserState()
  • Method Details

    • nodeCreated

      public boolean nodeCreated()
      Determines whether the current node was actually closed and pushed. This should only be called in the final user action of a node scope.
    • reset

      public void reset()
      Reinitializes the node stack. Called by the parser's ReInit() method.
    • rootNode

      public Expression rootNode()
      Returns the root of the tree, wrapping a lone literal in a scalar node. Only makes sense after a successful parse.
    • pushNode

      public void pushNode(Object n)
      Pushes a node or a literal value.
    • popNode

      public Object popNode()
      Returns the entry on the top of the stack, removing it from the stack.
    • popExpression

      public Expression popExpression()
      Same as popNode(), wrapping a literal value in a scalar node.
    • peekNode

      public Object peekNode()
    • nodeArity

      public int nodeArity()
      Returns the number of children on the stack in the current node scope.
    • clearNodeScope

      public void clearNodeScope(Expression n)
    • openNodeScope

      public void openNodeScope(Expression n)
    • closeNodeScope

      public void closeNodeScope(Expression n, int num)
      A definite node is constructed from a specified number of children. That many nodes are popped from the stack and made the children of the definite node, which is then pushed on to the stack.
    • closeNodeScope

      public void closeNodeScope(Expression n, boolean condition)
      A conditional node is constructed if its condition is true. All the nodes that have been pushed since the node was opened are made children of the conditional node, which is then pushed on to the stack. If the condition is false the node is not constructed and they are left on the stack.