ada.editor/src/org/netbeans/modules/ada/editor/ast/nodes/BlockStatement.java
author Andrea Lucarelli <raster@netbeans.org>
Sun, 22 Aug 2010 23:37:11 +0200
branchrelease68
changeset 16367 d2820c029d3a
parent 15779 367c7fdb5d23
permissions -rw-r--r--
Add JVM compiler support.
raster@15779
     1
/*
raster@15779
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
raster@15779
     3
 *
raster@15779
     4
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
raster@15779
     5
 *
raster@15779
     6
 * The contents of this file are subject to the terms of either the GNU
raster@15779
     7
 * General Public License Version 2 only ("GPL") or the Common
raster@15779
     8
 * Development and Distribution License("CDDL") (collectively, the
raster@15779
     9
 * "License"). You may not use this file except in compliance with the
raster@15779
    10
 * License. You can obtain a copy of the License at
raster@15779
    11
 * http://www.netbeans.org/cddl-gplv2.html
raster@15779
    12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
raster@15779
    13
 * specific language governing permissions and limitations under the
raster@15779
    14
 * License.  When distributing the software, include this License Header
raster@15779
    15
 * Notice in each file and include the License file at
raster@15779
    16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
raster@15779
    17
 * particular file as subject to the "Classpath" exception as provided
raster@15779
    18
 * by Sun in the GPL Version 2 section of the License file that
raster@15779
    19
 * accompanied this code. If applicable, add the following below the
raster@15779
    20
 * License Header, with the fields enclosed by brackets [] replaced by
raster@15779
    21
 * your own identifying information:
raster@15779
    22
 * "Portions Copyrighted [year] [name of copyright owner]"
raster@15779
    23
 *
raster@15779
    24
 * If you wish your version of this file to be governed by only the CDDL
raster@15779
    25
 * or only the GPL Version 2, indicate your decision by adding
raster@15779
    26
 * "[Contributor] elects to include this software in this distribution
raster@15779
    27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
raster@15779
    28
 * single choice of license, a recipient has the option to distribute
raster@15779
    29
 * your version of this file under either the CDDL, the GPL Version 2 or
raster@15779
    30
 * to extend the choice of license to its licensees as provided above.
raster@15779
    31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
raster@15779
    32
 * Version 2 license, then the option applies only if the new code is
raster@15779
    33
 * made subject to such option by the copyright holder.
raster@15779
    34
 *
raster@15779
    35
 * Contributor(s):
raster@15779
    36
 *
raster@15779
    37
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
raster@15779
    38
 */
raster@15779
    39
package org.netbeans.modules.ada.editor.ast.nodes;
raster@15779
    40
raster@15779
    41
import org.netbeans.modules.ada.editor.ast.nodes.visitors.Visitor;
raster@15779
    42
raster@15779
    43
/**
raster@15779
    44
 * Represents a block of statements
raster@15779
    45
 *
raster@15779
    46
 * <pre>e.g.<pre>
raster@15779
    47
 * Swap:
raster@15779
    48
 *    declare
raster@15779
    49
 *       Temp : Integer;
raster@15779
    50
 *    begin
raster@15779
    51
 *       Temp := V;
raster@15779
    52
 *       V := U;
raster@15779
    53
 *       U := Temp;
raster@15779
    54
 *    end Swap;
raster@15779
    55
 *
raster@15779
    56
 * @author Andrea Lucarelli
raster@15779
    57
 */
raster@15779
    58
public class BlockStatement extends Statement {
raster@15779
    59
raster@16367
    60
    private Identifier label;
raster@15779
    61
    private Block declarations;
raster@15779
    62
    private Block body;
raster@15779
    63
raster@15779
    64
    public BlockStatement(int start, int end, Identifier label, Block declarations, Block body) {
raster@15779
    65
        super(start, end);
raster@15779
    66
raster@16367
    67
        this.label = label;
raster@15779
    68
        this.declarations = declarations;
raster@15779
    69
        this.body = body;
raster@15779
    70
    }
raster@15779
    71
raster@16367
    72
    public Identifier getLabel() {
raster@16367
    73
        return this.label;
raster@16367
    74
    }
raster@15779
    75
raster@15779
    76
    /**
raster@15779
    77
     * Retrieves the declaration statements parts of this block
raster@15779
    78
     * @return declaration statements parts of this block
raster@15779
    79
     */
raster@15779
    80
    public Block getDeclarations() {
raster@16367
    81
        return this.declarations;
raster@15779
    82
    }
raster@15779
    83
raster@16367
    84
    /**
raster@15779
    85
     * Retrieves the body statements parts of this block
raster@15779
    86
     * @return body statements parts of this block
raster@15779
    87
     */
raster@15779
    88
    public Block getBody() {
raster@15779
    89
        return this.body;
raster@15779
    90
    }
raster@16367
    91
raster@15779
    92
    @Override
raster@15779
    93
    public void accept(Visitor visitor) {
raster@15779
    94
        visitor.visit(this);
raster@15779
    95
    }
raster@15779
    96
}
raster@15779
    97