// // namespace.cs: Tracks namespaces // // Author: // Miguel de Icaza (miguel@ximian.com) // // (C) 2001 Ximian, Inc. // using System; using System.Collections; using Mono.Languages; namespace Mono.MonoBASIC { /// /// Keeps track of the namespaces defined in the C# code. /// public class Namespace { static ArrayList all_namespaces = new ArrayList (); Namespace parent; string name; /// /// Constructor Takes the current namespace and the /// name. This is bootstrapped with parent == null /// and name = "" /// public Namespace (Namespace parent, string name) { this.name = name; this.parent = parent; all_namespaces.Add (this); } /// /// The qualified name of the current namespace /// public string Name { get { string pname = parent != null ? parent.Name : ""; if (pname == "") return name; else return parent.Name + "." + name; } } /// /// The parent of this namespace, used by the parser to "Pop" /// the current namespace declaration /// public Namespace Parent { get { return parent; } } /// /// Show the qualified name of the namespace contained here /// public override string ToString() { return Name; } } }