Skip to content

Package: JJTELParserState

JJTELParserState

nameinstructionbranchcomplexitylinemethod
JJTELParserState()
M: 19 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
clearNodeScope(Node)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
closeNodeScope(Node, boolean)
M: 56 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 15 C: 0
0%
M: 1 C: 0
0%
closeNodeScope(Node, int)
M: 35 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
nodeArity()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
nodeCreated()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
openNodeScope(Node)
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
peekNode()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
popNode()
M: 32 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
pushNode(Node)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
reset()
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
rootNode()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: /* Generated By:JavaCC: Do not edit this line. JJTELParserState.java Version 5.0 */
18: package com.sun.el.parser;
19:
20: public class JJTELParserState {
21: private java.util.List<Node> nodes;
22: private java.util.List<Integer> marks;
23:
24: private int sp; // number of nodes on stack
25: private int mk; // current mark
26: private boolean node_created;
27:
28: public JJTELParserState() {
29: nodes = new java.util.ArrayList<Node>();
30: marks = new java.util.ArrayList<Integer>();
31: sp = 0;
32: mk = 0;
33: }
34:
35: /* Determines whether the current node was actually closed and
36: pushed. This should only be called in the final user action of a
37: node scope. */
38: public boolean nodeCreated() {
39: return node_created;
40: }
41:
42: /* Call this to reinitialize the node stack. It is called
43: automatically by the parser's ReInit() method. */
44: public void reset() {
45: nodes.clear();
46: marks.clear();
47: sp = 0;
48: mk = 0;
49: }
50:
51: /* Returns the root node of the AST. It only makes sense to call
52: this after a successful parse. */
53: public Node rootNode() {
54: return nodes.get(0);
55: }
56:
57: /* Pushes a node on to the stack. */
58: public void pushNode(Node n) {
59: nodes.add(n);
60: ++sp;
61: }
62:
63: /* Returns the node on the top of the stack, and remove it from the
64: stack. */
65: public Node popNode() {
66:• if (--sp < mk) {
67: mk = marks.remove(marks.size()-1);
68: }
69: return nodes.remove(nodes.size()-1);
70: }
71:
72: /* Returns the node currently on the top of the stack. */
73: public Node peekNode() {
74: return nodes.get(nodes.size()-1);
75: }
76:
77: /* Returns the number of children on the stack in the current node
78: scope. */
79: public int nodeArity() {
80: return sp - mk;
81: }
82:
83:
84: public void clearNodeScope(Node n) {
85:• while (sp > mk) {
86: popNode();
87: }
88: mk = marks.remove(marks.size()-1);
89: }
90:
91:
92: public void openNodeScope(Node n) {
93: marks.add(mk);
94: mk = sp;
95: n.jjtOpen();
96: }
97:
98:
99: /* A definite node is constructed from a specified number of
100: children. That number of nodes are popped from the stack and
101: made the children of the definite node. Then the definite node
102: is pushed on to the stack. */
103: public void closeNodeScope(Node n, int num) {
104: mk = marks.remove(marks.size()-1);
105:• while (num-- > 0) {
106: Node c = popNode();
107: c.jjtSetParent(n);
108: n.jjtAddChild(c, num);
109: }
110: n.jjtClose();
111: pushNode(n);
112: node_created = true;
113: }
114:
115:
116: /* A conditional node is constructed if its condition is true. All
117: the nodes that have been pushed since the node was opened are
118: made children of the conditional node, which is then pushed
119: on to the stack. If the condition is false the node is not
120: constructed and they are left on the stack. */
121: public void closeNodeScope(Node n, boolean condition) {
122:• if (condition) {
123: int a = nodeArity();
124: mk = marks.remove(marks.size()-1);
125:• while (a-- > 0) {
126: Node c = popNode();
127: c.jjtSetParent(n);
128: n.jjtAddChild(c, a);
129: }
130: n.jjtClose();
131: pushNode(n);
132: node_created = true;
133: } else {
134: mk = marks.remove(marks.size()-1);
135: node_created = false;
136: }
137: }
138: }
139: /* JavaCC - OriginalChecksum=a169ec9bf66edaa6db0c5550b112beee (do not edit this line) */