ada.editor/src/org/netbeans/modules/ada/editor/ast/nodes/visitors/DefaultVisitor.java
Add JVM compiler support.
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common
8 * Development and Distribution License("CDDL") (collectively, the
9 * "License"). You may not use this file except in compliance with the
10 * License. You can obtain a copy of the License at
11 * http://www.netbeans.org/cddl-gplv2.html
12 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13 * specific language governing permissions and limitations under the
14 * License. When distributing the software, include this License Header
15 * Notice in each file and include the License file at
16 * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17 * particular file as subject to the "Classpath" exception as provided
18 * by Sun in the GPL Version 2 section of the License file that
19 * accompanied this code. If applicable, add the following below the
20 * License Header, with the fields enclosed by brackets [] replaced by
21 * your own identifying information:
22 * "Portions Copyrighted [year] [name of copyright owner]"
24 * If you wish your version of this file to be governed by only the CDDL
25 * or only the GPL Version 2, indicate your decision by adding
26 * "[Contributor] elects to include this software in this distribution
27 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28 * single choice of license, a recipient has the option to distribute
29 * your version of this file under either the CDDL, the GPL Version 2 or
30 * to extend the choice of license to its licensees as provided above.
31 * However, if you add GPL Version 2 code and therefore, elected the GPL
32 * Version 2 license, then the option applies only if the new code is
33 * made subject to such option by the copyright holder.
37 * Portions Copyrighted 2008 Sun Microsystems, Inc.
39 package org.netbeans.modules.ada.editor.ast.nodes.visitors;
41 import org.netbeans.modules.ada.editor.ast.ASTError;
42 import org.netbeans.modules.ada.editor.ast.ASTNode;
43 import org.netbeans.modules.ada.editor.ast.nodes.AbortStatement;
44 import org.netbeans.modules.ada.editor.ast.nodes.ArrayAccess;
45 import org.netbeans.modules.ada.editor.ast.nodes.Assignment;
46 import org.netbeans.modules.ada.editor.ast.nodes.Block;
47 import org.netbeans.modules.ada.editor.ast.nodes.BlockStatement;
48 import org.netbeans.modules.ada.editor.ast.nodes.CaseStatement;
49 import org.netbeans.modules.ada.editor.ast.nodes.CaseWhen;
50 import org.netbeans.modules.ada.editor.ast.nodes.CodeStatement;
51 import org.netbeans.modules.ada.editor.ast.nodes.Comment;
52 import org.netbeans.modules.ada.editor.ast.nodes.DelayStatement;
53 import org.netbeans.modules.ada.editor.ast.nodes.ExitStatement;
54 import org.netbeans.modules.ada.editor.ast.nodes.FieldsDeclaration;
55 import org.netbeans.modules.ada.editor.ast.nodes.FormalParameter;
56 import org.netbeans.modules.ada.editor.ast.nodes.GotoStatement;
57 import org.netbeans.modules.ada.editor.ast.nodes.Identifier;
58 import org.netbeans.modules.ada.editor.ast.nodes.IfStatement;
59 import org.netbeans.modules.ada.editor.ast.nodes.InfixExpression;
60 import org.netbeans.modules.ada.editor.ast.nodes.LoopStatement;
61 import org.netbeans.modules.ada.editor.ast.nodes.MethodDeclaration;
62 import org.netbeans.modules.ada.editor.ast.nodes.NullStatement;
63 import org.netbeans.modules.ada.editor.ast.nodes.PackageBody;
64 import org.netbeans.modules.ada.editor.ast.nodes.PackageInstanceCreation;
65 import org.netbeans.modules.ada.editor.ast.nodes.PackageRenames;
66 import org.netbeans.modules.ada.editor.ast.nodes.PackageSpecification;
67 import org.netbeans.modules.ada.editor.ast.nodes.PackageName;
68 import org.netbeans.modules.ada.editor.ast.nodes.Program;
69 import org.netbeans.modules.ada.editor.ast.nodes.QualifiedExpression;
70 import org.netbeans.modules.ada.editor.ast.nodes.RaiseStatement;
71 import org.netbeans.modules.ada.editor.ast.nodes.Range;
72 import org.netbeans.modules.ada.editor.ast.nodes.Reference;
73 import org.netbeans.modules.ada.editor.ast.nodes.ReturnStatement;
74 import org.netbeans.modules.ada.editor.ast.nodes.Scalar;
75 import org.netbeans.modules.ada.editor.ast.nodes.SingleFieldDeclaration;
76 import org.netbeans.modules.ada.editor.ast.nodes.SubprogramBody;
77 import org.netbeans.modules.ada.editor.ast.nodes.SubprogramSpecification;
78 import org.netbeans.modules.ada.editor.ast.nodes.SubtypeDeclaration;
79 import org.netbeans.modules.ada.editor.ast.nodes.TaskName;
80 import org.netbeans.modules.ada.editor.ast.nodes.TypeDeclaration;
81 import org.netbeans.modules.ada.editor.ast.nodes.TypeName;
82 import org.netbeans.modules.ada.editor.ast.nodes.UnaryOperation;
83 import org.netbeans.modules.ada.editor.ast.nodes.Use;
84 import org.netbeans.modules.ada.editor.ast.nodes.Variable;
85 import org.netbeans.modules.ada.editor.ast.nodes.With;
88 * Based on org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor
90 * @author Andrea Lucarelli
92 public class DefaultVisitor implements Visitor {
94 public void scan(ASTNode node) {
100 public void scan(Iterable<? extends ASTNode> nodes) {
102 for (ASTNode n : nodes) {
108 public void visit(ASTError node) {
111 public void visit(ASTNode node) {
114 public void visit(AbortStatement node) {
115 scan(node.getTasks());
118 public void visit(ArrayAccess node) {
119 scan(node.getName());
120 scan(node.getIndex());
123 public void visit(Assignment node) {
124 scan(node.getLeftHandSide());
125 scan(node.getRightHandSide());
128 public void visit(Block node) {
129 scan(node.getStatements());
132 public void visit(BlockStatement node) {
133 scan(node.getLabel());
134 scan(node.getDeclarations());
135 scan(node.getBody());
138 public void visit(CaseStatement node) {
139 scan(node.getExpression());
140 scan(node.getBody());
143 public void visit(CaseWhen node) {
144 scan(node.getValue());
145 scan(node.getActions());
148 public void visit(CodeStatement node) {
149 scan(node.getExpression());
152 public void visit(Comment comment) {
155 public void visit(ExitStatement node) {
156 scan(node.getWhenCondition());
159 public void visit(DelayStatement node) {
160 scan(node.getExpression());
163 public void visit(FieldsDeclaration node) {
164 scan(node.getFields());
167 public void visit(FormalParameter node) {
168 scan(node.getParameterName());
169 scan(node.getParameterType());
170 scan(node.getDefaultValue());
173 public void visit(GotoStatement node) {
176 public void visit(Identifier node) {
179 public void visit(IfStatement node) {
180 scan(node.getCondition());
181 scan(node.getTrueStatement());
182 scan(node.getFalseStatement());
185 public void visit(InfixExpression node) {
186 scan(node.getLeft());
187 scan(node.getRight());
190 public void visit(LoopStatement node) {
191 scan(node.getCondition());
192 scan(node.getBody());
195 public void visit(MethodDeclaration node) {
196 if (node.isSpefication()) {
197 scan(node.getSubprogramSpecification());
199 scan(node.getSubprogramBody());
203 public void visit(NullStatement node) {
206 public void visit(PackageBody node) {
207 scan(node.getName());
208 scan(node.getBody());
211 public void visit(PackageInstanceCreation node) {
212 scan(node.getPackageName());
213 scan(node.ctorParams());
216 public void visit(PackageName node) {
217 scan(node.getPackageName());
220 public void visit(PackageSpecification node) {
221 scan(node.getName());
222 scan(node.getBody());
225 public void visit(PackageRenames node) {
226 scan(node.getName());
227 scan(node.getPackageRenames());
230 public void visit(Program node) {
231 scan(node.getStatements());
234 public void visit(QualifiedExpression node) {
235 scan(node.getSubtypeMark());
236 scan(node.getExpression());
239 public void visit(Range node) {
240 scan(node.getLeft());
241 scan(node.getRight());
244 public void visit(Reference node) {
245 scan(node.getExpression());
248 public void visit(SubprogramBody node) {
249 scan(node.getSubprogramSpecification().getSubprogramName());
250 scan(node.getSubprogramSpecification().getFormalParameters());
251 scan(node.getDeclarations());
252 scan(node.getBody());
255 public void visit(SubprogramSpecification node) {
256 scan(node.getSubprogramName());
257 scan(node.getFormalParameters());
260 public void visit(SubtypeDeclaration node) {
261 scan(node.getSubTypeName());
262 scan(node.getParentType());
265 public void visit(TaskName node) {
266 scan(node.getTaskName());
269 public void visit(TypeName node) {
270 scan(node.getTypeName());
273 public void visit(TypeDeclaration node) {
274 scan(node.getTypeName());
277 public void visit(RaiseStatement node) {
280 public void visit(ReturnStatement node) {
281 scan(node.getExpression());
284 public void visit(Scalar scalar) {
287 public void visit(SingleFieldDeclaration node) {
288 scan(node.getName());
289 scan(node.getValue());
292 public void visit(Use node) {
293 scan(node.getPackages());
296 public void visit(Variable node) {
297 scan(node.getName());
298 scan(node.getVariableType());
301 public void visit(With node) {
302 scan(node.getPackages());
305 public void visit(UnaryOperation node) {
306 scan(node.getExpression());