ada.editor/src/org/netbeans/modules/ada/editor/ast/nodes/visitors/DefaultTreePathVisitor.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 java.util.Collections;
42 import java.util.LinkedList;
43 import java.util.List;
44 import org.netbeans.modules.ada.editor.ast.ASTError;
45 import org.netbeans.modules.ada.editor.ast.ASTNode;
46 import org.netbeans.modules.ada.editor.ast.nodes.AbortStatement;
47 import org.netbeans.modules.ada.editor.ast.nodes.ArrayAccess;
48 import org.netbeans.modules.ada.editor.ast.nodes.Assignment;
49 import org.netbeans.modules.ada.editor.ast.nodes.Block;
50 import org.netbeans.modules.ada.editor.ast.nodes.BlockStatement;
51 import org.netbeans.modules.ada.editor.ast.nodes.CaseStatement;
52 import org.netbeans.modules.ada.editor.ast.nodes.CaseWhen;
53 import org.netbeans.modules.ada.editor.ast.nodes.CodeStatement;
54 import org.netbeans.modules.ada.editor.ast.nodes.Comment;
55 import org.netbeans.modules.ada.editor.ast.nodes.DelayStatement;
56 import org.netbeans.modules.ada.editor.ast.nodes.ExitStatement;
57 import org.netbeans.modules.ada.editor.ast.nodes.FieldsDeclaration;
58 import org.netbeans.modules.ada.editor.ast.nodes.FormalParameter;
59 import org.netbeans.modules.ada.editor.ast.nodes.GotoStatement;
60 import org.netbeans.modules.ada.editor.ast.nodes.Identifier;
61 import org.netbeans.modules.ada.editor.ast.nodes.IfStatement;
62 import org.netbeans.modules.ada.editor.ast.nodes.InfixExpression;
63 import org.netbeans.modules.ada.editor.ast.nodes.LoopStatement;
64 import org.netbeans.modules.ada.editor.ast.nodes.MethodDeclaration;
65 import org.netbeans.modules.ada.editor.ast.nodes.NullStatement;
66 import org.netbeans.modules.ada.editor.ast.nodes.PackageBody;
67 import org.netbeans.modules.ada.editor.ast.nodes.PackageInstanceCreation;
68 import org.netbeans.modules.ada.editor.ast.nodes.PackageSpecification;
69 import org.netbeans.modules.ada.editor.ast.nodes.PackageName;
70 import org.netbeans.modules.ada.editor.ast.nodes.PackageRenames;
71 import org.netbeans.modules.ada.editor.ast.nodes.Program;
72 import org.netbeans.modules.ada.editor.ast.nodes.QualifiedExpression;
73 import org.netbeans.modules.ada.editor.ast.nodes.RaiseStatement;
74 import org.netbeans.modules.ada.editor.ast.nodes.Range;
75 import org.netbeans.modules.ada.editor.ast.nodes.Reference;
76 import org.netbeans.modules.ada.editor.ast.nodes.ReturnStatement;
77 import org.netbeans.modules.ada.editor.ast.nodes.Scalar;
78 import org.netbeans.modules.ada.editor.ast.nodes.SingleFieldDeclaration;
79 import org.netbeans.modules.ada.editor.ast.nodes.SubprogramBody;
80 import org.netbeans.modules.ada.editor.ast.nodes.SubprogramSpecification;
81 import org.netbeans.modules.ada.editor.ast.nodes.SubtypeDeclaration;
82 import org.netbeans.modules.ada.editor.ast.nodes.TaskName;
83 import org.netbeans.modules.ada.editor.ast.nodes.TypeDeclaration;
84 import org.netbeans.modules.ada.editor.ast.nodes.TypeName;
85 import org.netbeans.modules.ada.editor.ast.nodes.UnaryOperation;
86 import org.netbeans.modules.ada.editor.ast.nodes.Use;
87 import org.netbeans.modules.ada.editor.ast.nodes.Variable;
88 import org.netbeans.modules.ada.editor.ast.nodes.With;
91 * Based on org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultTreePathVisitor
93 * @author Andrea Lucarelli
95 public class DefaultTreePathVisitor extends DefaultVisitor {
97 private LinkedList<ASTNode> path = new LinkedList<ASTNode>();
98 private List<ASTNode> unmodifiablePath;
100 public DefaultTreePathVisitor() {
101 unmodifiablePath = Collections.unmodifiableList(path);
105 * ... reversed order ....
110 public List<ASTNode> getPath() {
111 return unmodifiablePath;
115 public void visit(ASTError astError) {
116 super.visit(astError);
120 public void visit(ASTNode node) {
127 public void visit(AbortStatement node) {
134 public void visit(ArrayAccess node) {
141 public void visit(Assignment node) {
148 public void visit(Block node) {
155 public void visit(BlockStatement node) {
162 public void visit(CaseStatement node) {
169 public void visit(CaseWhen node) {
176 public void visit(CodeStatement node) {
183 public void visit(Comment node) {
190 public void visit(DelayStatement node) {
197 public void visit(ExitStatement node) {
204 public void visit(FieldsDeclaration node) {
211 public void visit(FormalParameter node) {
218 public void visit(GotoStatement node) {
225 public void visit(Identifier node) {
232 public void visit(IfStatement node) {
239 public void visit(InfixExpression node) {
246 public void visit(LoopStatement node) {
253 public void visit(MethodDeclaration node) {
260 public void visit(NullStatement node) {
267 public void visit(PackageBody node) {
274 public void visit(PackageInstanceCreation node) {
281 public void visit(PackageName node) {
288 public void visit(PackageRenames node) {
295 public void visit(PackageSpecification node) {
302 public void visit(Program node) {
309 public void visit(QualifiedExpression node) {
316 public void visit(Range node) {
323 public void visit(RaiseStatement node) {
330 public void visit(ReturnStatement node) {
337 public void visit(Reference node) {
344 public void visit(Scalar node) {
351 public void visit(SingleFieldDeclaration node) {
358 public void visit(SubprogramBody node) {
365 public void visit(SubprogramSpecification node) {
372 public void visit(SubtypeDeclaration node) {
379 public void visit(TaskName node) {
386 public void visit(TypeName node) {
393 public void visit(TypeDeclaration node) {
400 public void visit(Use node) {
407 public void visit(Variable node) {
414 public void visit(With node) {
421 public void visit(UnaryOperation node) {