01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2007 New York University
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public License
07: * version 2.1 as published by the Free Software Foundation.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.typical;
20:
21: import xtc.tree.Node;
22:
23: import xtc.util.Pair;
24:
25: /**
26: * The predefined scope structure.
27: *
28: * @author Anh Le
29: * @version $Revision: 1.4 $
30: */
31:
32: public class Scope extends Variant<Tuple.T2<ScopeKind<?>, Pair<Node>>> {
33:
34: /**
35: * Create a new scope construct.
36: *
37: * @param member1 The kind of the new scope.
38: * @param member2 A list of nodes that have this scope.
39: */
40: public Scope(ScopeKind<?> member1, Pair<Node> member2) {
41: tuple = new Tuple.T2<ScopeKind<?>, Pair<Node>>(member1, member2);
42: }
43:
44: /**
45: * Test if this constructor is a scope.
46: *
47: * @return <code>true</code> if scope, false otherwise.
48: */
49: public boolean isScope() {
50: return true;
51: }
52:
53: public String getName() {
54: return "Scope";
55: }
56:
57: public String toString() {
58: return "Scope of " + tuple.toString();
59: }
60:
61: }
|