1 /* Generated By:JJTree: Do not edit this line. /Users/trevor/Documents/School/othercode/pig-src/src/com/yahoo/pig/impl/logicalLayer/parser/JJTQueryParserState.java */
3 package com
.yahoo
.pig
.impl
.logicalLayer
.parser
;
5 class JJTQueryParserState
{
6 private java
.util
.Stack nodes
;
7 private java
.util
.Stack marks
;
9 private int sp
; // number of nodes on stack
10 private int mk
; // current mark
11 private boolean node_created
;
13 JJTQueryParserState() {
14 nodes
= new java
.util
.Stack();
15 marks
= new java
.util
.Stack();
20 /* Determines whether the current node was actually closed and
21 pushed. This should only be called in the final user action of a
23 boolean nodeCreated() {
27 /* Call this to reinitialize the node stack. It is called
28 automatically by the parser's ReInit() method. */
30 nodes
.removeAllElements();
31 marks
.removeAllElements();
36 /* Returns the root node of the AST. It only makes sense to call
37 this after a successful parse. */
39 return (Node
)nodes
.elementAt(0);
42 /* Pushes a node on to the stack. */
43 void pushNode(Node n
) {
48 /* Returns the node on the top of the stack, and remove it from the
52 mk
= ((Integer
)marks
.pop()).intValue();
54 return (Node
)nodes
.pop();
57 /* Returns the node currently on the top of the stack. */
59 return (Node
)nodes
.peek();
62 /* Returns the number of children on the stack in the current node
69 void clearNodeScope(Node n
) {
73 mk
= ((Integer
)marks
.pop()).intValue();
77 void openNodeScope(Node n
) {
78 marks
.push(new Integer(mk
));
84 /* A definite node is constructed from a specified number of
85 children. That number of nodes are popped from the stack and
86 made the children of the definite node. Then the definite node
87 is pushed on to the stack. */
88 void closeNodeScope(Node n
, int num
) {
89 mk
= ((Integer
)marks
.pop()).intValue();
93 n
.jjtAddChild(c
, num
);
101 /* A conditional node is constructed if its condition is true. All
102 the nodes that have been pushed since the node was opened are
103 made children of the the conditional node, which is then pushed
104 on to the stack. If the condition is false the node is not
105 constructed and they are left on the stack. */
106 void closeNodeScope(Node n
, boolean condition
) {
109 mk
= ((Integer
)marks
.pop()).intValue();
119 mk
= ((Integer
)marks
.pop()).intValue();
120 node_created
= false;