View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   
5   /* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.1 */
6   /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=net.sourceforge.pmd.lang.ast.AbstractNode,NODE_FACTORY= */
7   package net.sourceforge.pmd.lang.plsql.ast;
8   
9   import net.sourceforge.pmd.lang.symboltable.Scope;
10  
11  public abstract class AbstractPLSQLNode extends net.sourceforge.pmd.lang.ast.AbstractNode implements PLSQLNode {
12    protected Object value;
13    protected PLSQLParser parser;
14    protected Scope scope;
15  
16    public AbstractPLSQLNode(int i) {
17  	  super(i);
18    }
19  
20    public AbstractPLSQLNode(PLSQLParser p, int i) {
21      this(i);
22      parser = p;
23    }
24  
25    public void jjtOpen() {
26  	if (beginLine == -1 && parser.token.next != null) {
27  	    beginLine = parser.token.next.beginLine;
28  	    beginColumn = parser.token.next.beginColumn;
29  	}
30    }
31  
32    public void jjtClose() {
33  	if (beginLine == -1 && (children == null || children.length == 0)) {
34  	    beginColumn = parser.token.beginColumn;
35  	}
36  	if (beginLine == -1) {
37  	    beginLine = parser.token.beginLine;
38  	}
39  	endLine = parser.token.endLine;
40  	endColumn = parser.token.endColumn;
41    }
42  
43    public void jjtSetValue(Object value) { this.value = value; }
44    public Object jjtGetValue() { return value; }
45  
46    @Override
47  public Object jjtAccept(PLSQLParserVisitor visitor, Object data) {
48      return visitor.visit(this, data);
49    }
50  
51    @Override
52  public Object childrenAccept(PLSQLParserVisitor visitor, Object data) {
53      if (children != null) {
54        for (int i = 0; i < children.length; ++i) {
55          ((PLSQLNode)children[i]).jjtAccept(visitor, data);
56        }
57      }
58      return data;
59    }
60  
61    /* You can override these two methods in subclasses of SimpleNode to
62       customize the way the node appears when the tree is dumped.  If
63       your output uses more than one line you should override
64       toString(String), otherwise overriding toString() is probably all
65       you need to do. */
66  
67    public String toString() { return PLSQLParserTreeConstants.jjtNodeName[id]; }
68    public String toString(String prefix) { return prefix + toString(); }
69  
70    /* Override this method if you want to customize how the node dumps
71       out its children. */
72  
73    public void dump(String prefix) {
74      System.out.println(toString(prefix));
75      if (children != null) {
76        for (int i = 0; i < children.length; ++i) {
77    AbstractPLSQLNode n = (AbstractPLSQLNode)children[i];
78    if (n != null) {
79      n.dump(prefix + " ");
80    }
81        }
82      }
83    }
84  
85    /**
86     * Return node image converted to the normal Oracle form.
87     * 
88     * <p>
89     * Normally this is uppercase, unless the names is quoted ("name").  
90     * </p>
91     */
92    public String getCanonicalImage() { return PLSQLParser.canonicalName(this.getImage()); }
93    
94    /** Convert arbitrary String to normal Oracle format, under assumption that the passed image is an Oracle name.
95     * 
96     * <p>
97     * This a helper method for PLSQL classes dependent on SimpleNode, that would otherwise have to import PLSQParser.
98     * </p>
99     * @param image
100    * @return 
101    */
102   static public String getCanonicalImage(String image) { return PLSQLParser.canonicalName(image); }
103 
104   @Override
105   public Scope getScope() {
106     if (scope == null) {
107       return ((PLSQLNode) parent).getScope();
108     }
109     return scope;
110   }
111 
112   @Override
113   public void setScope(Scope scope) {
114     this.scope = scope;
115   }
116 }
117 
118 /* JavaCC - OriginalChecksum=3f651517d5069f856891d89230562ac4 (do not edit this line) */