1
2
3 package net.sourceforge.pmd.jsp.ast;
4
5
6 public class SimpleNode extends net.sourceforge.pmd.ast.SimpleNode implements Node {
7 protected JspParser parser;
8
9 public SimpleNode(int i) {
10 super(i);
11 }
12
13 public SimpleNode(JspParser p, int i) {
14 this(i);
15 parser = p;
16 }
17
18 public void jjtOpen() {
19 if (beginLine == -1 && parser.token.next != null) {
20 beginLine = parser.token.next.beginLine;
21 beginColumn = parser.token.next.beginColumn;
22 }
23 }
24
25 public void jjtClose() {
26 if (beginLine == -1 && (children == null || children.length == 0)) {
27 beginColumn = parser.token.beginColumn;
28 }
29 if (beginLine == -1) {
30 beginLine = parser.token.beginLine;
31 }
32 endLine = parser.token.endLine;
33 endColumn = parser.token.endColumn;
34 }
35
36 /***
37 * Accept the visitor. *
38 */
39 public Object jjtAccept(JspParserVisitor visitor, Object data) {
40 return visitor.visit(this, data);
41 }
42
43 /***
44 * Accept the visitor. *
45 */
46 public Object childrenAccept(JspParserVisitor visitor, Object data) {
47 if (children != null) {
48 for (int i = 0; i < children.length; ++i) {
49 ((Node) children[i]).jjtAccept(visitor, data);
50 }
51 }
52 return data;
53 }
54
55 public String toString() {
56 return JspParserTreeConstants.jjtNodeName[id];
57 }
58 }
59