public override void EnterNamespace_([NotNull] XSharpParser.Namespace_Context context) { XSharpParser.Namespace_Context current = (XSharpParser.Namespace_Context)context; // XType nSpace = new XType(current.Name.GetText(), Kind.Namespace, Modifiers.None, Modifiers.Public, new TextRange(context), new TextInterval(context)); this._currentNSpaces.Push(nSpace); }
public override void ExitNamespace_([NotNull] XSharpParser.Namespace_Context context) { // So, we end a Namespace declaration, was it empty ? if (!IsEmpty(this.CurrentNamespace)) { this.CodeCompileUnit.Namespaces.Add(this.CurrentNamespace); } // Ok, get the previous one this.CurrentNamespace = this.NamespaceStack.Pop(); }
public override void ExitNamespace_([NotNull] XSharpParser.Namespace_Context context) { if (this._currentNSpaces.Count > 0) { XType cNS = this._currentNSpaces.Peek(); // Is it necessary to Add the NameSpace in the TypeList ?? this.addType(cNS); // Pop to support nested NameSpaces this._currentNSpaces.Pop(); } }
public override void EnterNamespace_(XSharpParser.Namespace_Context context) { string newNamespaceName = context.Name.GetCleanText(); // We already have something in Stack // so we are nesting Namespaces, get the previous name prefix if (this.NamespaceStack.Count > 0 && !string.IsNullOrEmpty(CurrentNamespace.Name)) { newNamespaceName = this.CurrentNamespace.Name + "." + newNamespaceName; } XCodeNamespace newNamespace = new XCodeNamespace(newNamespaceName); writeTrivia(newNamespace, context); this.NamespaceStack.Push(this.CurrentNamespace); this.CurrentNamespace = newNamespace; }
public override void ExitNamespace_([NotNull] XSharpParser.Namespace_Context context) { TagRegion(context, context.ChildCount - 2); }