JJTCalcTransParserState.java
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.forms.formcalc;
import com.adobe.forms.formcalc.Node;
import java.util.ArrayList;
import java.util.List;
public class JJTCalcTransParserState {
private List<Node> nodes = new ArrayList<Node>();
private List<Integer> marks = new ArrayList<Integer>();
private int sp = 0;
private int mk = 0;
private boolean node_created;
public boolean nodeCreated() {
return this.node_created;
}
public void reset() {
this.nodes.clear();
this.marks.clear();
this.sp = 0;
this.mk = 0;
}
public Node rootNode() {
return this.nodes.get(0);
}
public void pushNode(Node n) {
this.nodes.add(n);
++this.sp;
}
public Node popNode() {
if (--this.sp < this.mk) {
this.mk = this.marks.remove(this.marks.size() - 1);
}
return this.nodes.remove(this.nodes.size() - 1);
}
public Node peekNode() {
return this.nodes.get(this.nodes.size() - 1);
}
public int nodeArity() {
return this.sp - this.mk;
}
public void clearNodeScope(Node n) {
while (this.sp > this.mk) {
this.popNode();
}
this.mk = this.marks.remove(this.marks.size() - 1);
}
public void openNodeScope(Node n) {
this.marks.add(this.mk);
this.mk = this.sp;
n.jjtOpen();
}
public void closeNodeScope(Node n, int num) {
this.mk = this.marks.remove(this.marks.size() - 1);
while (num-- > 0) {
Node c = this.popNode();
c.jjtSetParent(n);
n.jjtAddChild(c, num);
}
n.jjtClose();
this.pushNode(n);
this.node_created = true;
}
public void closeNodeScope(Node n, boolean condition) {
if (condition) {
int a = this.nodeArity();
this.mk = this.marks.remove(this.marks.size() - 1);
while (a-- > 0) {
Node c = this.popNode();
c.jjtSetParent(n);
n.jjtAddChild(c, a);
}
n.jjtClose();
this.pushNode(n);
this.node_created = true;
} else {
this.mk = this.marks.remove(this.marks.size() - 1);
this.node_created = false;
}
}
}